Documentation

Index

Constants

View Source
const (
	DefaultHeadLength = 8

	DefaultProtocolVersion = 0x8001 // test protocol version

	ActionPing = 0x0001 // ping
	ActionPong = 0x0002 // pong
	ActionData = 0x00F0 // business
)

default custom protocol const

Variables

This section is empty.

Functions

This section is empty.

Types

type CustomLengthFieldProtocol

type CustomLengthFieldProtocol struct {
	Version    uint16
	ActionType uint16
	DataLength uint32
	Data       []byte
}

CustomLengthFieldProtocol : custom protocol custom protocol header contains Version, ActionType and DataLength fields its payload is Data field

func (*CustomLengthFieldProtocol) Decode

func (cc *CustomLengthFieldProtocol) Decode(c gnet.Conn) ([]byte, error)

Decode ...

func (*CustomLengthFieldProtocol) Encode

func (cc *CustomLengthFieldProtocol) Encode(c gnet.Conn, buf []byte) ([]byte, error)

Encode ...

Source Files