iproto

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Msg = iota
	Conn
	Raw
)

回调传参常量

Variables

Functions

This section is empty.

Types

type JsonProcessor

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

JsonProcessor one of Processor implement

func NewJSONProcessor

func NewJSONProcessor() *JsonProcessor

NewJSONProcessor return new JsonProcessor

func (*JsonProcessor) GetBigEndian

func (jp *JsonProcessor) GetBigEndian() bool

GetBigEndian of the order

func (*JsonProcessor) OnReceivedPackage

func (jp *JsonProcessor) OnReceivedPackage(writer interface{}, body []byte) error

OnReceivedPackage 收到完整数据包

func (*JsonProcessor) RegisterHandler

func (jp *JsonProcessor) RegisterHandler(id int, entity interface{}, handle func(args ...interface{}))

RegisterHandler for logic

func (*JsonProcessor) SetBigEndian

func (jp *JsonProcessor) SetBigEndian()

SetBigEndian for order

func (*JsonProcessor) SetEncryptor

func (jp *JsonProcessor) SetEncryptor(enc iduck.Encryptor)

SetEncryptor for processor

func (*JsonProcessor) WarpMsg

func (jp *JsonProcessor) WarpMsg(message interface{}) ([]byte, error)

WarpMsg format the interface message to []byte

type JsonProtocol

type JsonProtocol struct {
	Id      int         `json:"id"`
	Content interface{} `json:"content"`
}

JsonProtocol is the protocol for JsonProcessor

type PbfProcessor

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

PbfProcessor one of Processor implement protoc --go_out=. *.proto

func NewPBProcessor

func NewPBProcessor() *PbfProcessor

NewPBProcessor return PB processor

func (*PbfProcessor) GetBigEndian

func (pbf *PbfProcessor) GetBigEndian() bool

GetBigEndian of the order

func (*PbfProcessor) OnReceivedPackage

func (pbf *PbfProcessor) OnReceivedPackage(writer interface{}, body []byte) error

OnReceivedPackage 收到完整数据包, 返回解包错误

func (*PbfProcessor) RegisterHandler

func (pbf *PbfProcessor) RegisterHandler(id int, entity interface{}, handle func(args ...interface{}))

RegisterHandler for logic

func (*PbfProcessor) SetBigEndian

func (pbf *PbfProcessor) SetBigEndian()

SetBigEndian for order

func (*PbfProcessor) SetEncryptor

func (pbf *PbfProcessor) SetEncryptor(enc iduck.Encryptor)

SetEncryptor for processor

func (*PbfProcessor) WarpMsg

func (pbf *PbfProcessor) WarpMsg(message interface{}) ([]byte, error)

WarpMsg format the interface message to []byte

func (*PbfProcessor) WarpMsgNoHeader

func (pbf *PbfProcessor) WarpMsgNoHeader(message interface{}) ([]byte, error)

WarpMsgNoHeader without header length

type Protocol

type Protocol struct {
	Id      uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Content []byte `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"`
	// contains filtered or unexported fields
}

协议消息

func (*Protocol) Descriptor deprecated

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

Deprecated: Use Protocol.ProtoReflect.Descriptor instead.

func (*Protocol) GetContent

func (x *Protocol) GetContent() []byte

func (*Protocol) GetId

func (x *Protocol) GetId() uint32

func (*Protocol) ProtoMessage

func (*Protocol) ProtoMessage()

func (*Protocol) ProtoReflect

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

func (*Protocol) Reset

func (x *Protocol) Reset()

func (*Protocol) String

func (x *Protocol) String() string

type ScFrame

type ScFrame struct {
	Frame     uint32   `protobuf:"varint,1,opt,name=frame,proto3" json:"frame,omitempty"`
	Protocols [][]byte `protobuf:"bytes,2,rep,name=protocols,proto3" json:"protocols,omitempty"`
	// contains filtered or unexported fields
}

帧消息

func (*ScFrame) Descriptor deprecated

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

Deprecated: Use ScFrame.ProtoReflect.Descriptor instead.

func (*ScFrame) GetFrame

func (x *ScFrame) GetFrame() uint32

func (*ScFrame) GetProtocols

func (x *ScFrame) GetProtocols() [][]byte

func (*ScFrame) ProtoMessage

func (*ScFrame) ProtoMessage()

func (*ScFrame) ProtoReflect

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

func (*ScFrame) Reset

func (x *ScFrame) Reset()

func (*ScFrame) String

func (x *ScFrame) String() string

type ScProtocolPack

type ScProtocolPack struct {
	Id   uint32      `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Pack []*Protocol `protobuf:"bytes,2,rep,name=pack,proto3" json:"pack,omitempty"`
	// contains filtered or unexported fields
}

打包消息

func (*ScProtocolPack) Descriptor deprecated

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

Deprecated: Use ScProtocolPack.ProtoReflect.Descriptor instead.

func (*ScProtocolPack) GetId

func (x *ScProtocolPack) GetId() uint32

func (*ScProtocolPack) GetPack

func (x *ScProtocolPack) GetPack() []*Protocol

func (*ScProtocolPack) ProtoMessage

func (*ScProtocolPack) ProtoMessage()

func (*ScProtocolPack) ProtoReflect

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

func (*ScProtocolPack) Reset

func (x *ScProtocolPack) Reset()

func (*ScProtocolPack) String

func (x *ScProtocolPack) String() string

Jump to

Keyboard shortcuts

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