package muxer // Message represents a single protocol message with a channel ID, type, and payload. // // ┌──────────────────────────────────────────────┐ // │ length | channel ID × message type │ payload │ // └──────────────────────────────────────────────┘ // // Each message starts with a varint encoded unsigned 64-bit integer which consists of // a channel ID (first 60-bits) and a message type (last 4-bits) followed by the payload. type Message struct { ID uint64 Type uint8 Data []byte } // NewMessage returns a new Message. func NewMessage(id uint64, messageType uint8, data []byte) *Message { return &Message{ ID: id, Type: messageType, Data: data, } }