proto

package
v0.0.0-...-e5fb36a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultHeadLength = 4

	DefaultProtocolVersion = 0x01 // test protocol version

	Ping = 0x00
	Send = 0x01
	Push = 0x02
)

default custom protocol const

Variables

This section is empty.

Functions

This section is empty.

Types

type MsgProtocol

type MsgProtocol struct {
	Version    uint8
	Type       uint8
	DataLength uint16
	Data       []byte
}

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

func NewMsgProtocol

func NewMsgProtocol(msgType uint8) *MsgProtocol

func NewMsgProtocolByBytes

func NewMsgProtocolByBytes(data []byte) (*MsgProtocol, error)

func (*MsgProtocol) Bytes

func (cc *MsgProtocol) Bytes() []byte

func (*MsgProtocol) Decode

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

Decode ...

func (*MsgProtocol) Encode

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

Encode ...

func (*MsgProtocol) SetData

func (cc *MsgProtocol) SetData(message protobuf.Message) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL