Documentation ¶
Index ¶
Constants ¶
View Source
const ( MsgFlagCompress uint8 = 1 << 0 MsgFlagJSON uint8 = 1 << 1 MsgFlagProtoBuf uint8 = 1 << 2 MsgFlagAES uint8 = 1 << 3 )
View Source
const ( MaxCompressSize = 1024 HeaderSize = 4 CmdHeaderSize = 8 MsgErrorHeaderSize = 4 )
Variables ¶
View Source
var (
ErrMsgDataTooShort = errors.New("err msg data too short")
)
Functions ¶
Types ¶
type FrameCoder ¶
type FrameCoder interface { EncodeMsg(mainCmd uint8, subCmd uint32, msg interface{}) ([]byte, error) DecodeMsg(buf []byte, pb interface{}) error MainCmd(buf []byte) uint8 SubCmd(buf []byte) (cmd uint32) HeaderSize() int Size(data []byte) (int, error) }
func NewFrameCoder ¶
func NewFrameCoder(marshallType string) FrameCoder
Click to show internal directories.
Click to hide internal directories.