Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithPacketProcessor ¶
func WithPacketProcessor(pp PacketProcessor) func(s *SessionCtx)
func WithReact ¶
func WithReact() func(s *SessionCtx)
Types ¶
type HeaderTailPacketProcessor ¶
type HeaderTailPacketProcessor struct {
// contains filtered or unexported fields
}
HeaderTailPacketProcessor 固定包头包尾分包器
func (*HeaderTailPacketProcessor) Data ¶
func (spp *HeaderTailPacketProcessor) Data(data []byte) (n int)
func (*HeaderTailPacketProcessor) Listen ¶
func (spp *HeaderTailPacketProcessor) Listen(onPacket func(p []byte))
type Option ¶
type Option func(s *SessionCtx)
type PacketProcessor ¶
func NewHeadTailPP ¶
func NewHeadTailPP(head []byte, tail []byte) (pp PacketProcessor)
func NewSplitPP ¶
func NewSplitPP(split byte) (pp PacketProcessor)
type Session ¶
type Session interface { OnData(p []byte, size int, err error) Read(p []byte) (size int, err error) Write(p []byte) (size int, err error) OnIOErr(err func(interface{})) }
func NewSerialSession ¶
func NewSession ¶
type SessionCtx ¶
type SessionCtx struct {
// contains filtered or unexported fields
}
func (*SessionCtx) OnIOErr ¶ added in v1.16.1
func (s *SessionCtx) OnIOErr(errHandler func(interface{}))
type SplitPacketProcessor ¶
type SplitPacketProcessor struct {
// contains filtered or unexported fields
}
SplitPacketProcessor 分隔符分包器, 每个包用Split标记结尾
func (*SplitPacketProcessor) Data ¶
func (spp *SplitPacketProcessor) Data(data []byte) (n int)
func (*SplitPacketProcessor) Listen ¶
func (spp *SplitPacketProcessor) Listen(onPacket func(p []byte))
Click to show internal directories.
Click to hide internal directories.