Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrWrongPacketType represents a wrong packet type. ErrWrongPacketType = errors.New("wrong packet type") // ErrPacketSizeExceed represents a wrong packet size. ErrPacketSizeExceed = errors.New("packet size exceed") )
Functions ¶
This section is empty.
Types ¶
type IPacket ¶
type IPacket interface { GetHeader() any // 数据帧头部 Header GetLen() uint64 // 数据帧长度 8bytes,根据实际情况进行转换 GetBody() []byte // 数据 Body }
IPacket 数据帧
func NewWSPacket ¶ added in v1.1.4
type Packer ¶
type Packer interface { // Pack 封包,将原始数据构造为二进制流数据帧 Pack(header any, data []byte) ([]byte, error) // Unpack 解包 Unpack(data []byte) ([]IPacket, error) }
Packer 数据帧 封包/解包
Click to show internal directories.
Click to hide internal directories.