protobuf

package
v0.0.0-...-ee5d6ac Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Heartbeat = iota

	AuthRequest
	AuthResponse
	LogoutRequest
	LogoutResponse
	KickOutRequest
	KickOutResponse

	C2CMsgR
	C2CMsgA
	C2CMsgN
	C2CAckR
	C2CAckA
	C2CAckN

	C2GSendRequest
	C2GSendResponse
	C2GPushRequest
	C2GPushResponse
	C2SPullMsgRequest
	C2SPullMsgResponse
)
View Source
const (
	CurVersion = 1
)

Variables

View Source
var (
	ErrIDAlreadyExists      = errors.New("id already exists")
	ErrMsgAlreadyExists     = errors.New("msg already exists")
	ErrProtobufDataTooShort = errors.New("protobuf data too short")
	ErrIncompatibleVersion  = errors.New("incompatible version")
)

Functions

func Marshal

func Marshal(seq, ack uint32, msg interface{}) ([]byte, error)

Types

type Processor

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

func NewProcessor

func NewProcessor() *Processor

func (*Processor) Marshal

func (p *Processor) Marshal(seq, ack uint32, msg interface{}) ([]byte, error)

func (*Processor) Register

func (p *Processor) Register(id uint32, msg proto.Message)

func (*Processor) SetByteOrder

func (p *Processor) SetByteOrder(byteOrder binary.ByteOrder)

func (*Processor) Unmarshal

func (p *Processor) Unmarshal(data []byte) (*RawMsg, error)

type RawMsg

type RawMsg struct {
	Version   uint32
	Cmd       uint32
	Seq       uint32
	Ack       uint32
	Timestamp uint32
	Msg       interface{}
}

func Unmarshal

func Unmarshal(data []byte) (*RawMsg, error)

func (*RawMsg) String

func (rawMsg *RawMsg) String() string

type Test

type Test struct {
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Age  uint32 `protobuf:"varint,2,opt,name=age,proto3" json:"age,omitempty"`
	// contains filtered or unexported fields
}

func (*Test) Descriptor deprecated

func (*Test) Descriptor() ([]byte, []int)

Deprecated: Use Test.ProtoReflect.Descriptor instead.

func (*Test) GetAge

func (x *Test) GetAge() uint32

func (*Test) GetName

func (x *Test) GetName() string

func (*Test) ProtoMessage

func (*Test) ProtoMessage()

func (*Test) ProtoReflect

func (x *Test) ProtoReflect() protoreflect.Message

func (*Test) Reset

func (x *Test) Reset()

func (*Test) String

func (x *Test) String() string

Jump to

Keyboard shortcuts

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