Documentation ¶
Index ¶
- Constants
- Variables
- func CompressBytes(data []byte) ([]byte, error)
- func DecodePacket(pkt *fatchoy.Packet, decrypt cipher.BlockCryptor) error
- func EncodePacket(pkt *fatchoy.Packet, threshold int, encrypt cipher.BlockCryptor) error
- func NewClientProtocolCodec() fatchoy.ProtocolCodec
- func NewServerProtocolCodec() fatchoy.ProtocolCodec
- func UncompressBytes(data []byte) ([]byte, error)
Constants ¶
View Source
const ( ClientCodecVersion = 2 // 协议版本 ClientCodecHeaderSize = 16 // 消息头大小 )
View Source
const ( ServerCodecVersion = 2 // 协议版本 ServerCodecHeaderSize = 18 // 消息头大小 )
View Source
const (
SimpleCodecHeaderSize = 12 // 消息头大小
)
Variables ¶
View Source
var ( MaxAllowedV1SendBytes = 60 * 1024 // 最大发送消息大小(60k) MaxAllowedV1RecvBytes = 8 * 1024 // 最大接收消息大小(8k) )
View Source
var ClientProtocolCodec = NewClientProtocolCodec()
View Source
var MaxAllowedServerCodecPayloadSize = 8 * 1024 * 1024 // 最大包体大小(8M)
View Source
var MaxAllowedSimpleCodecPayloadSize = 8 * 1024 * 1024 // 最大包体大小(8M)
View Source
var ServerProtocolCodec = NewServerProtocolCodec()
Functions ¶
func DecodePacket ¶ added in v1.0.5
func DecodePacket(pkt *fatchoy.Packet, decrypt cipher.BlockCryptor) error
根据pkt的Flag标志位,对body进行解密和解压缩
func EncodePacket ¶ added in v1.0.5
根据pkt的Flag标志位,对body进行压缩和加密
func NewClientProtocolCodec ¶
func NewClientProtocolCodec() fatchoy.ProtocolCodec
func NewServerProtocolCodec ¶
func NewServerProtocolCodec() fatchoy.ProtocolCodec
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.