Documentation
¶
Index ¶
- Constants
- Variables
- type JsonProcessor
- func (jp *JsonProcessor) GetBigEndian() bool
- func (jp *JsonProcessor) OnReceivedPackage(writer interface{}, body []byte) error
- func (jp *JsonProcessor) RegisterHandler(id int, entity interface{}, handle func(args ...interface{}))
- func (jp *JsonProcessor) SetBigEndian()
- func (jp *JsonProcessor) SetEncryptor(enc iduck.Encryptor)
- func (jp *JsonProcessor) WarpMsg(message interface{}) ([]byte, error)
- type JsonProtocol
- type PbfProcessor
- func (pbf *PbfProcessor) GetBigEndian() bool
- func (pbf *PbfProcessor) OnReceivedPackage(writer interface{}, body []byte) error
- func (pbf *PbfProcessor) RegisterHandler(id int, entity interface{}, handle func(args ...interface{}))
- func (pbf *PbfProcessor) SetBigEndian()
- func (pbf *PbfProcessor) SetEncryptor(enc iduck.Encryptor)
- func (pbf *PbfProcessor) WarpMsg(message interface{}) ([]byte, error)
- func (pbf *PbfProcessor) WarpMsgNoHeader(message interface{}) ([]byte, error)
- type Protocol
- type ScFrame
- type ScProtocolPack
- func (*ScProtocolPack) Descriptor() ([]byte, []int)deprecated
- func (x *ScProtocolPack) GetId() uint32
- func (x *ScProtocolPack) GetPack() []*Protocol
- func (*ScProtocolPack) ProtoMessage()
- func (x *ScProtocolPack) ProtoReflect() protoreflect.Message
- func (x *ScProtocolPack) Reset()
- func (x *ScProtocolPack) String() string
Constants ¶
View Source
const ( Msg = iota Conn Raw )
回调传参常量
Variables ¶
View Source
var File_base_proto protoreflect.FileDescriptor
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) 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 (*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) 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) GetContent ¶
func (*Protocol) ProtoMessage ¶
func (*Protocol) ProtoMessage()
func (*Protocol) ProtoReflect ¶
func (x *Protocol) ProtoReflect() protoreflect.Message
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) GetProtocols ¶
func (*ScFrame) ProtoMessage ¶
func (*ScFrame) ProtoMessage()
func (*ScFrame) ProtoReflect ¶
func (x *ScFrame) ProtoReflect() protoreflect.Message
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
Click to show internal directories.
Click to hide internal directories.