aboutsummaryrefslogtreecommitdiff
path: root/message.go
diff options
context:
space:
mode:
authoronur1 <onur1@onurgunduz.com>2023-01-01 18:44:45 +0100
committeronur1 <onur1@onurgunduz.com>2023-01-01 18:44:45 +0100
commit77e13c055fdc76ff9babbb43754a8f8e44ca6128 (patch)
tree298ba0734bf93cee47aad6150c9ffcd4ca3d87dc /message.go
parent02387a1dc1ec156e0613920645cf47a51a04a930 (diff)
downloadmuxer-77e13c055fdc76ff9babbb43754a8f8e44ca6128.tar.gz
muxer-77e13c055fdc76ff9babbb43754a8f8e44ca6128.zip
Add documentation
Diffstat (limited to 'message.go')
-rw-r--r--message.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/message.go b/message.go
index 1ffa919..e66b731 100644
--- a/message.go
+++ b/message.go
@@ -1,11 +1,17 @@
package binproto
+// A Message represents a single binproto message.
+//
+// Each message starts with an header which is a varint encoded
+// unsigned 64-bit integer which consists of an ID (first 60-bits) and
+// a Channel number (last 4-bits), the rest of the message is payload.
type Message struct {
ID int
Channel rune
Data []byte
}
+// NewMessage returns a new Message.
func NewMessage(id int, ch rune, data []byte) *Message {
return &Message{
ID: id,