gprotocol

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: MIT Imports: 5 Imported by: 8

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

func DecodeMsg

func DecodeMsg(buf []byte, pb interface{}) error

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

Jump to

Keyboard shortcuts

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