Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrEmptyPktList = errors.New("empty pkt list") ErrPktCountMismatch = errors.New("pkt count mismatch") ErrWrongSeq = errors.New("wrong seq number") ErrWrongPktSeq = errors.New("wrong pkt seq number") BytesAssembler = &Assembler{} )
var ( // BytesDisassembler is a global disassembler for disassembling bytes slice. BytesDisassembler = &Disassembler{minPktLen: defaultMinPktLen} ErrProtocolTooLang = errors.New("protocol too lang") )
Functions ¶
func SetMinPktLen ¶
func SetMinPktLen(minPktLen uint64)
SetMinPktLen will set the value of min pkt length for global bytes disassembler.
Types ¶
type Assembler ¶
type Assembler struct { }
Assembler provides a function assemble some Pkt instances which disassembled to a slice of bytes.
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache for collecting Pkt of payloads. If all Pkt belong to the same payload collecting finished, a FullPktResult contains sender id string and all Pkt list will be push to fullPktNotifyC.
func (*Cache) FullPktC ¶
func (c *Cache) FullPktC() <-chan *FullPktResult
FullPktC return the fullPktNotifyC of Cache.
type Disassembler ¶
type Disassembler struct {
// contains filtered or unexported fields
}
Disassembler provides a function that can disassemble a slice of bytes to some Pkt instances.
func (*Disassembler) DisassembleBytes ¶
func (d *Disassembler) DisassembleBytes(bytes []byte, protocol []byte) ([]*Pkt, error)
DisassembleBytes disassembles bytes slice to some Pkt instances. The length of protocol given must not be greater than 255. If success, The max size of Pkt list will not be greater than 256.
type FullPktResult ¶
FullPktResult wraps the sender string and the Pkt list of a msg payload whose seq is the same value.