common

package
v0.0.0-...-52d6a69 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxCompressSize = 1024
	MaxCmdSize      = 2
)

Variables

This section is empty.

Functions

func EncodeCmd

func EncodeCmd(cmd uint16, msg Message) ([]byte, byte, error)

生成二进制数据,返回数据和是否压缩标识

func GetCmd

func GetCmd(buf []byte) uint16

获取指令号

Types

type Message

type Message interface {
	Marshal() (data []byte, err error)
	MarshalTo(data []byte) (n int, err error)
	Size() (n int)
	Unmarshal(data []byte) error
}

func DecodeCmd

func DecodeCmd(buf []byte, flag byte, pb Message) Message

生成protobuf数据

Jump to

Keyboard shortcuts

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