Documentation
¶
Index ¶
- Constants
- Variables
- type AuthBody
- func (*AuthBody) Descriptor() ([]byte, []int)deprecated
- func (x *AuthBody) GetAppId() string
- func (x *AuthBody) GetExt() []byte
- func (x *AuthBody) GetToken() string
- func (*AuthBody) ProtoMessage()
- func (x *AuthBody) ProtoReflect() protoreflect.Message
- func (x *AuthBody) Reset()
- func (x *AuthBody) String() string
- type Op
- type Proto
- func (*Proto) Descriptor() ([]byte, []int)deprecated
- func (x *Proto) GetAck() int32
- func (x *Proto) GetBody() []byte
- func (x *Proto) GetOp() int32
- func (x *Proto) GetSeq() int32
- func (x *Proto) GetVer() int32
- func (*Proto) ProtoMessage()
- func (x *Proto) ProtoReflect() protoreflect.Message
- func (p *Proto) ReadTCP(rr *bufio.Reader) (err error)
- func (p *Proto) ReadWebsocket(ws *websocket.Conn) (err error)
- func (p *Proto) ReadWebsocket2(ws *gws.Conn) (err error)
- func (x *Proto) Reset()
- func (x *Proto) String() string
- func (p *Proto) WriteTCP(wr *bufio.Writer) (err error)
- func (p *Proto) WriteTCPHeart(wr *bufio.Writer, online int32) (err error)
- func (p *Proto) WriteTo(b *bytes.Writer)
- func (p *Proto) WriteWebsocket(ws *websocket.Conn) (err error)
- func (p *Proto) WriteWebsocket2(ws *gws.Conn) (err error)
- func (p *Proto) WriteWebsocketHeart(wr *websocket.Conn, online int32) (err error)
Constants ¶
View Source
const ( // MaxBodySize max proto body size MaxBodySize = int32(1 << 14) )
Variables ¶
View Source
var ( // ErrProtoPackLen proto packet len error ErrProtoPackLen = errors.New("default server codec pack length error") // ErrProtoHeaderLen proto header len error ErrProtoHeaderLen = errors.New("default server codec header length error") )
View Source
var ( // ProtoReady proto ready ProtoReady = &Proto{Op: int32(Op_ProtoReady)} // ProtoFinish proto finish ProtoFinish = &Proto{Op: int32(Op_ProtoFinish)} // ProtoResend proto resend ProtoResend = &Proto{Op: int32(Op_ProtoResend)} )
View Source
var ( Op_name = map[int32]string{ 0: "Undefined", 1: "Auth", 2: "AuthReply", 3: "Heartbeat", 4: "HeartbeatReply", 5: "Disconnect", 6: "DisconnectReply", 7: "Message", 8: "MessageReply", 20: "ProtoReady", 21: "ProtoFinish", 22: "ProtoResend", 23: "Raw", } Op_value = map[string]int32{ "Undefined": 0, "Auth": 1, "AuthReply": 2, "Heartbeat": 3, "HeartbeatReply": 4, "Disconnect": 5, "DisconnectReply": 6, "Message": 7, "MessageReply": 8, "ProtoReady": 20, "ProtoFinish": 21, "ProtoResend": 22, "Raw": 23, } )
Enum value maps for Op.
View Source
var File_protocol_protocol_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type AuthBody ¶
type AuthBody struct {
AppId string `protobuf:"bytes,1,opt,name=appId,proto3" json:"appId,omitempty"`
Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"`
Ext []byte `protobuf:"bytes,3,opt,name=ext,proto3" json:"ext,omitempty"` // 其它业务方可能需要的信息
// contains filtered or unexported fields
}
Proto 中 Op 为 OpAuth 时, body 必须可以反序列化为 AuthMsg
func (*AuthBody) Descriptor
deprecated
func (*AuthBody) ProtoMessage ¶
func (*AuthBody) ProtoMessage()
func (*AuthBody) ProtoReflect ¶
func (x *AuthBody) ProtoReflect() protoreflect.Message
type Op ¶
type Op int32
func (Op) Descriptor ¶
func (Op) Descriptor() protoreflect.EnumDescriptor
func (Op) EnumDescriptor
deprecated
func (Op) Number ¶
func (x Op) Number() protoreflect.EnumNumber
func (Op) Type ¶
func (Op) Type() protoreflect.EnumType
type Proto ¶
type Proto struct {
Ver int32 `protobuf:"varint,1,opt,name=ver,proto3" json:"ver,omitempty"`
Op int32 `protobuf:"varint,2,opt,name=op,proto3" json:"op,omitempty"`
Seq int32 `protobuf:"varint,3,opt,name=seq,proto3" json:"seq,omitempty"`
Ack int32 `protobuf:"varint,4,opt,name=ack,proto3" json:"ack,omitempty"`
Body []byte `protobuf:"bytes,5,opt,name=body,proto3" json:"body,omitempty"`
// contains filtered or unexported fields
}
func (*Proto) Descriptor
deprecated
func (*Proto) ProtoMessage ¶
func (*Proto) ProtoMessage()
func (*Proto) ProtoReflect ¶
func (x *Proto) ProtoReflect() protoreflect.Message
func (*Proto) ReadWebsocket ¶
ReadWebsocket read a proto from websocket connection.
func (*Proto) ReadWebsocket2 ¶
ReadWebsocket read a proto from websocket connection.
func (*Proto) WriteTCPHeart ¶
WriteTCPHeart write TCP heartbeat with room online.
func (*Proto) WriteWebsocket ¶
WriteWebsocket write a proto to websocket connection.
func (*Proto) WriteWebsocket2 ¶
WriteWebsocket write a proto to websocket connection.
Click to show internal directories.
Click to hide internal directories.