Documentation
¶
Overview ¶
Package msg provides utilities for constructing, sending and receiving binary messages with fixed-size headers and variable payloads.
Index ¶
- type Message
- func (m *Message) ID() [16]byte
- func (m *Message) Len() int
- func (m *Message) Read() iter.Seq2[[]byte, error]
- func (m *Message) ReadFull() ([]byte, error)
- func (m *Message) SetToken(tok [16]byte)
- func (m *Message) SetType(typ Type)
- func (m *Message) Timestamp() time.Time
- func (m *Message) Token() [16]byte
- func (m *Message) Type() Type
- func (m *Message) Write(pld []byte) (int, error)
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
Message represents a single structured message with a fixed header and a payload.
func New ¶
New creates a new Message associated with the given writer. It automatically generates a random message ID and sets the current timestamp.
func (*Message) Read ¶
Read returns an iterator that yields payload chunks and errors while reading.
Click to show internal directories.
Click to hide internal directories.