Documentation ¶
Index ¶
- Variables
- type DynamicReceiver
- type EmptyReceiver
- type SpliceStartAndDataLengthHexReceiver
- func (s *SpliceStartAndDataLengthHexReceiver) CanHandle(conn netInterface.IConnection, buffer []byte) bool
- func (s *SpliceStartAndDataLengthHexReceiver) GetHeadLen() int
- func (s *SpliceStartAndDataLengthHexReceiver) Receiver(conn netInterface.IConnection, buffer []byte) ([]byte, int)
- func (s *SpliceStartAndDataLengthHexReceiver) Reset()
- type SpliceStartAndDataLengthReceiver
- func (s *SpliceStartAndDataLengthReceiver) CanHandle(conn netInterface.IConnection, buffer []byte) bool
- func (s *SpliceStartAndDataLengthReceiver) GetHeadLen() int
- func (s *SpliceStartAndDataLengthReceiver) Receiver(conn netInterface.IConnection, buffer []byte) ([]byte, int)
- func (s *SpliceStartAndDataLengthReceiver) Reset()
- type SpliceStartAndLengthReceiver
- func (s *SpliceStartAndLengthReceiver) CanHandle(conn netInterface.IConnection, buffer []byte) bool
- func (s *SpliceStartAndLengthReceiver) GetHeadLen() int
- func (s *SpliceStartAndLengthReceiver) Receiver(conn netInterface.IConnection, buffer []byte) ([]byte, int)
- func (s *SpliceStartAndLengthReceiver) Reset()
- type SpliceStartFinishManyReceiver
- func (s *SpliceStartFinishManyReceiver) CanHandle(conn netInterface.IConnection, buffer []byte) bool
- func (s *SpliceStartFinishManyReceiver) GetHeadLen() int
- func (s *SpliceStartFinishManyReceiver) Receiver(conn netInterface.IConnection, buffer []byte) ([]byte, int)
- func (s *SpliceStartFinishManyReceiver) Reset()
- type SpliceSymbolReceiver
Constants ¶
This section is empty.
Variables ¶
var ( PackageMaxLen = 64 * 1024 //TCP缓存池最大包大小(全局配置,初始化生效) PackageMinLen = 1024 //TCP缓存池最小包大小(全局配置,初始化生效) )
Functions ¶
This section is empty.
Types ¶
type DynamicReceiver ¶
type DynamicReceiver struct {
// contains filtered or unexported fields
}
DynamicReceiver 策略分包器
func NewDynamicReceiver ¶
func NewDynamicReceiver(receivers []netInterface.IReceiver, size int, onReceive func(data []byte), errorCallback func(errStr string)) *DynamicReceiver
NewDynamicReceiver 实例化策略分包器
func (*DynamicReceiver) Receiver ¶
func (d *DynamicReceiver) Receiver(conn netInterface.IConnection, buffer []byte) (err error)
Receiver 分包处理
func (*DynamicReceiver) Recovery ¶ added in v1.8.17
func (d *DynamicReceiver) Recovery(conn netInterface.IConnection)
Recovery 回收资源
type EmptyReceiver ¶ added in v1.8.15
type EmptyReceiver struct { }
func (*EmptyReceiver) CanHandle ¶ added in v1.8.15
func (s *EmptyReceiver) CanHandle(conn netInterface.IConnection, buffer []byte) bool
CanHandle 是否能处理
func (*EmptyReceiver) GetHeadLen ¶ added in v1.8.15
func (s *EmptyReceiver) GetHeadLen() int
GetHeadLen 包头必须要的长度
func (*EmptyReceiver) Receiver ¶ added in v1.8.15
func (s *EmptyReceiver) Receiver(conn netInterface.IConnection, buffer []byte) ([]byte, int)
type SpliceStartAndDataLengthHexReceiver ¶ added in v1.8.17
type SpliceStartAndDataLengthHexReceiver struct {
// contains filtered or unexported fields
}
SpliceStartAndDataLengthHexReceiver 开始加数据长度分包算法
func NewSpliceStartAndDataLengthHexReceiver ¶ added in v1.8.17
func NewSpliceStartAndDataLengthHexReceiver(startSymbol []byte, appendCount int, dataLengthIndex int, dataLengthCount int) *SpliceStartAndDataLengthHexReceiver
NewSpliceStartAndDataLengthHexReceiver 开始加数据长度分包算法
func (*SpliceStartAndDataLengthHexReceiver) CanHandle ¶ added in v1.8.17
func (s *SpliceStartAndDataLengthHexReceiver) CanHandle(conn netInterface.IConnection, buffer []byte) bool
CanHandle 是否能处理
func (*SpliceStartAndDataLengthHexReceiver) GetHeadLen ¶ added in v1.8.17
func (s *SpliceStartAndDataLengthHexReceiver) GetHeadLen() int
GetHeadLen 包头必须要的长度
func (*SpliceStartAndDataLengthHexReceiver) Receiver ¶ added in v1.8.17
func (s *SpliceStartAndDataLengthHexReceiver) Receiver(conn netInterface.IConnection, buffer []byte) ([]byte, int)
Receiver 分包处理
func (*SpliceStartAndDataLengthHexReceiver) Reset ¶ added in v1.8.17
func (s *SpliceStartAndDataLengthHexReceiver) Reset()
Reset 重置分包状态为初始状态
type SpliceStartAndDataLengthReceiver ¶ added in v1.8.17
type SpliceStartAndDataLengthReceiver struct {
// contains filtered or unexported fields
}
SpliceStartAndDataLengthReceiver 开始加数据长度分包算法
func NewSpliceStartAndDataLengthReceiver ¶ added in v1.8.17
func NewSpliceStartAndDataLengthReceiver(startSymbol []byte, appendCount int, dataLengthIndex int, dataLengthCount int) *SpliceStartAndDataLengthReceiver
NewSpliceStartAndDataLengthReceiver 开始加数据长度分包算法
func (*SpliceStartAndDataLengthReceiver) CanHandle ¶ added in v1.8.17
func (s *SpliceStartAndDataLengthReceiver) CanHandle(conn netInterface.IConnection, buffer []byte) bool
CanHandle 是否能处理
func (*SpliceStartAndDataLengthReceiver) GetHeadLen ¶ added in v1.8.17
func (s *SpliceStartAndDataLengthReceiver) GetHeadLen() int
GetHeadLen 包头必须要的长度
func (*SpliceStartAndDataLengthReceiver) Receiver ¶ added in v1.8.17
func (s *SpliceStartAndDataLengthReceiver) Receiver(conn netInterface.IConnection, buffer []byte) ([]byte, int)
Receiver 分包处理
func (*SpliceStartAndDataLengthReceiver) Reset ¶ added in v1.8.17
func (s *SpliceStartAndDataLengthReceiver) Reset()
Reset 重置分包状态为初始状态
type SpliceStartAndLengthReceiver ¶ added in v1.8.17
type SpliceStartAndLengthReceiver struct {
// contains filtered or unexported fields
}
SpliceStartAndLengthReceiver 开始加长度分包
func NewSpliceStartAndLengthReceiver ¶ added in v1.8.17
func NewSpliceStartAndLengthReceiver(symbol byte, length int) *SpliceStartAndLengthReceiver
NewSpliceStartAndLengthReceiver 开始加长度分包
func (*SpliceStartAndLengthReceiver) CanHandle ¶ added in v1.8.17
func (s *SpliceStartAndLengthReceiver) CanHandle(conn netInterface.IConnection, buffer []byte) bool
CanHandle 是否能处理
func (*SpliceStartAndLengthReceiver) GetHeadLen ¶ added in v1.8.17
func (s *SpliceStartAndLengthReceiver) GetHeadLen() int
GetHeadLen 包头必须要的长度
func (*SpliceStartAndLengthReceiver) Receiver ¶ added in v1.8.17
func (s *SpliceStartAndLengthReceiver) Receiver(conn netInterface.IConnection, buffer []byte) ([]byte, int)
Receiver 分包处理
func (*SpliceStartAndLengthReceiver) Reset ¶ added in v1.8.17
func (s *SpliceStartAndLengthReceiver) Reset()
Reset 重置分包状态为初始状态
type SpliceStartFinishManyReceiver ¶ added in v1.8.17
type SpliceStartFinishManyReceiver struct {
// contains filtered or unexported fields
}
SpliceStartFinishManyReceiver 开始结束分包器,多字节【jt808适用】
func NewSpliceStartFinishManyReceiver ¶ added in v1.8.17
func NewSpliceStartFinishManyReceiver(startSymbol []byte, finishSymbol []byte) *SpliceStartFinishManyReceiver
NewSpliceStartFinishManyReceiver 按照开始结束符来粘包
func (*SpliceStartFinishManyReceiver) CanHandle ¶ added in v1.8.17
func (s *SpliceStartFinishManyReceiver) CanHandle(conn netInterface.IConnection, buffer []byte) bool
CanHandle 是否能处理
func (*SpliceStartFinishManyReceiver) GetHeadLen ¶ added in v1.8.17
func (s *SpliceStartFinishManyReceiver) GetHeadLen() int
GetHeadLen 包头必须要的长度
func (*SpliceStartFinishManyReceiver) Receiver ¶ added in v1.8.17
func (s *SpliceStartFinishManyReceiver) Receiver(conn netInterface.IConnection, buffer []byte) ([]byte, int)
Receiver 分包处理
func (*SpliceStartFinishManyReceiver) Reset ¶ added in v1.8.17
func (s *SpliceStartFinishManyReceiver) Reset()
Reset 重置分包状态为初始状态
type SpliceSymbolReceiver ¶
type SpliceSymbolReceiver struct {
// contains filtered or unexported fields
}
SpliceSymbolReceiver 按照开始结束符来粘包(单字节版)
func NewSpliceSymbolReceiver ¶
func NewSpliceSymbolReceiver(startSymbol byte, finishSymbol byte) *SpliceSymbolReceiver
NewSpliceSymbolReceiver 按照开始结束符来粘包
func (*SpliceSymbolReceiver) CanHandle ¶ added in v1.5.6
func (s *SpliceSymbolReceiver) CanHandle(conn netInterface.IConnection, buffer []byte) bool
CanHandle 是否能处理
func (*SpliceSymbolReceiver) GetHeadLen ¶ added in v1.5.6
func (s *SpliceSymbolReceiver) GetHeadLen() int
GetHeadLen 包头必须要的长度
func (*SpliceSymbolReceiver) Receiver ¶
func (s *SpliceSymbolReceiver) Receiver(conn netInterface.IConnection, buffer []byte) ([]byte, int)
Receiver 分包逻辑
func (*SpliceSymbolReceiver) Reset ¶ added in v1.8.11
func (s *SpliceSymbolReceiver) Reset()
Reset 重置分包状态为初始状态