msg

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2022 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMsgNotProto = errors.New("msg not proto")
	ErrProtocol    = errors.New("protocol too much")
	ErrNotRegister = errors.New("protocol not register")
	ErrMsgShort    = errors.New("msg too short")
)
View Source
var (
	ErrExceedMaxConn = errors.New("maximum connections exceeded")
)

Functions

func NewMsgProtocol

func NewMsgProtocol(useBigEndian bool)

Types

type MsgProtocol

type MsgProtocol struct {
	// contains filtered or unexported fields
}

协议 id + proto.Message

func GetMsgProtocol

func GetMsgProtocol() *MsgProtocol

func (*MsgProtocol) Marshal

func (m *MsgProtocol) Marshal(msg interface{}) ([]byte, error)

func (*MsgProtocol) Register

func (m *MsgProtocol) Register(msg proto.Message, eventType uint16)

func (*MsgProtocol) Unmarshal

func (m *MsgProtocol) Unmarshal(msg []byte) (interface{}, error)

Jump to

Keyboard shortcuts

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