This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
package packet
type (
// IPacket 数据帧
IPacket interface {
GetHeader() interface{} // 数据帧头部 Header
GetLen() uint64 // 数据帧长度 8bytes,根据实际情况进行转换
GetBody() []byte // 数据 Body
}
// Packer 数据帧 封包/解包
Packer interface {
// Pack 封包,将原始数据构造为二进制流数据帧
Pack(header interface{}, data []byte) ([]byte, error)
// Unpack 解包
Unpack(data []byte) ([]IPacket, error)
NewPackerFunc func() Packer
)