Documentation ¶
Overview ¶
*
* * @author liangjf * @create on 2020/5/26 * @version 1.0
Index ¶
Constants ¶
View Source
const ( FrameHeadLen = 21 Magic = 0x45 Version = 0 )
View Source
const ( GeneralMsg = 0x00 HeartbeatMsg = 0x01 MsgAckMsg = 0x02 SyncOfflineMsg = 0x03 )
View Source
const (
Default = "default"
)
Variables ¶
View Source
var (
DefaultCodec = NewDefaultCodec()
)
View Source
var (
ErrDataEmpty = errors.New("data is empty")
)
Functions ¶
func CheckMagic ¶
func GetDataLen ¶
func GetMsgType ¶
func GetVersion ¶
func RegisterCodec ¶
Types ¶
type FrameHeader ¶
type FrameHeader struct { Magic uint8 //1 magic Version uint8 //1 version MsgType uint8 //1 msg type, 0x0: general req, 0x1: heartbeat ReqType uint8 //1 request type, 0x0: send and receive, 0x1: send but not receive CompressType uint8 //1 compression or not, 0x0: not compression, 0x1: compression StreamID uint64 //8 stream ID Length uint32 //4 total packet length Reserved uint32 //4 4 bytes reserved }
FrameHeader 帧头
Click to show internal directories.
Click to hide internal directories.