Documentation
¶
Index ¶
- Constants
- Variables
- func MarshalV1(w io.Writer, pkt fatchoy.IPacket, encryptor cipher.BlockCryptor) (int, error)
- func ReadLenData(r io.Reader) ([]byte, error)
- func ReadPacket(r io.Reader, decrypt cipher.BlockCryptor, pkt fatchoy.IPacket) error
- func UnmarshalV1(header Header, body []byte, decrypt cipher.BlockCryptor, pkt fatchoy.IPacket) error
- func WriteLenData(w io.Writer, data []byte) (int, error)
- func WritePacket(w io.Writer, encrypt cipher.BlockCryptor, pkt fatchoy.IPacket) error
- type Header
- func (h Header) CalcChecksum(payload []byte) uint32
- func (h Header) Checksum() uint32
- func (h Header) Command() int32
- func (h Header) Flag() uint8
- func (h Header) Len() uint32
- func (h Header) MD5Sum() string
- func (h Header) Pack(pkt fatchoy.IPacket, size uint32)
- func (h Header) Seq() int16
- func (h Header) SetChecksum(crc uint32)
- func (h Header) Type() uint8
- type Version
Constants ¶
View Source
const ( HeaderSize = 16 // 包头大小(包含长度) PacketBytesLimit = (1 << 24) - 1 // 3字节限制 MaxPayloadBytes = 16 * 1024 * 1024 // 16M )
Variables ¶
View Source
var CompressThreshold = 4096 // 默认压缩阈值,4K
Functions ¶
func ReadLenData ¶ added in v1.3.0
read length-prefixed data
func ReadPacket ¶ added in v1.3.0
func ReadPacket(r io.Reader, decrypt cipher.BlockCryptor, pkt fatchoy.IPacket) error
读取一个packet
func UnmarshalV1 ¶ added in v1.3.0
func UnmarshalV1(header Header, body []byte, decrypt cipher.BlockCryptor, pkt fatchoy.IPacket) error
func WriteLenData ¶ added in v1.3.0
write length-prefixed data
func WritePacket ¶ added in v1.3.0
func WritePacket(w io.Writer, encrypt cipher.BlockCryptor, pkt fatchoy.IPacket) error
写入一个packet
Types ¶
Click to show internal directories.
Click to hide internal directories.