Documentation
¶
Index ¶
- Constants
- Variables
- 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)} )
View Source
var ( Op_name = map[int32]string{ 0: "Undefined", 1: "Auth", 2: "AuthReply", 3: "Heartbeat", 4: "HeartbeatReply", 5: "Disconnect", 6: "DisconnectReply", 7: "SendMsg", 8: "SendMsgReply", 9: "ReceiveMsg", 10: "ReceiveMsgReply", 11: "ProtoReady", 12: "ProtoFinish", 13: "Raw", 14: "SyncMsgReq", 15: "SyncMsgReply", 16: "RePush", } Op_value = map[string]int32{ "Undefined": 0, "Auth": 1, "AuthReply": 2, "Heartbeat": 3, "HeartbeatReply": 4, "Disconnect": 5, "DisconnectReply": 6, "SendMsg": 7, "SendMsgReply": 8, "ReceiveMsg": 9, "ReceiveMsgReply": 10, "ProtoReady": 11, "ProtoFinish": 12, "Raw": 13, "SyncMsgReq": 14, "SyncMsgReply": 15, "RePush": 16, } )
Enum value maps for Op.
View Source
var File_protocol_protocol_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type Op ¶
type Op int32
const ( Op_Undefined Op = 0 Op_Auth Op = 1 Op_AuthReply Op = 2 Op_Heartbeat Op = 3 Op_HeartbeatReply Op = 4 Op_Disconnect Op = 5 Op_DisconnectReply Op = 6 Op_SendMsg Op = 7 Op_SendMsgReply Op = 8 //客户端回复消息已收到 Op_ReceiveMsg Op = 9 Op_ReceiveMsgReply Op = 10 Op_ProtoReady Op = 11 Op_ProtoFinish Op = 12 Op_Raw Op = 13 Op_SyncMsgReq Op = 14 Op_SyncMsgReply Op = 15 Op_RePush Op = 16 )
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.