Documentation
¶
Overview ¶
Package stream provides streaming protocol decoding from io.Reader.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FrameConfig ¶
type FrameConfig struct {
Type FrameType
LengthBytes int // For LengthPrefixed: 1, 2, or 4
LengthOffset int // Offset to add to length value
BigEndian bool // Byte order for length field
Delimiter []byte // For Delimited framing
FixedSize int // For FixedLength framing
}
FrameConfig configures message framing.
type StateMachine ¶
type StateMachine struct {
Current string
Transitions map[string]map[string]string // from -> trigger -> to
}
StateMachine tracks protocol state transitions.
func NewStateMachine ¶
func NewStateMachine(initial string) *StateMachine
NewStateMachine creates a state machine with an initial state.
func (*StateMachine) AddTransition ¶
func (sm *StateMachine) AddTransition(from, trigger, to string)
AddTransition adds a state transition rule.
type StreamDecoder ¶
type StreamDecoder struct {
// contains filtered or unexported fields
}
StreamDecoder reads and decodes protocol messages from a stream.
func NewStreamDecoder ¶
func NewStreamDecoder(r io.Reader, lib *protocol.Library, proto string, frame FrameConfig) *StreamDecoder
NewStreamDecoder creates a new stream decoder.
func (*StreamDecoder) Next ¶
func (sd *StreamDecoder) Next() (*Message, error)
Next reads and decodes the next message from the stream.
Click to show internal directories.
Click to hide internal directories.