| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- package main
- const (
- OP_HANDSHARE = int32(0)
- OP_HANDSHARE_REPLY = int32(1)
- OP_HEARTBEAT = int32(2)
- OP_HEARTBEAT_REPLY = int32(3)
- OP_SEND_SMS = int32(4)
- OP_SEND_SMS_REPLY = int32(5)
- OP_DISCONNECT_REPLY = int32(6)
- OP_AUTH = int32(7)
- OP_AUTH_REPLY = int32(8)
- OP_TEST = int32(254)
- OP_TEST_REPLY = int32(255)
- )
- const (
- MaxBodySize = int32(1 << 11)
- // size
- CmdSize = 4
- PackSize = 4
- HeaderSize = 2
- VerSize = 2
- OperationSize = 4
- SeqIdSize = 4
- HeartbeatSize = 4
- RawHeaderSize = PackSize + HeaderSize + VerSize + OperationSize + SeqIdSize
- MaxPackSize = MaxBodySize + int32(RawHeaderSize)
- // offset
- PackOffset = 0
- HeaderOffset = PackOffset + PackSize
- VerOffset = HeaderOffset + HeaderSize
- OperationOffset = VerOffset + VerSize
- SeqIdOffset = OperationOffset + OperationSize
- HeartbeatOffset = SeqIdOffset + SeqIdSize
- OP_RAW = int32(11)
- )
- const (
- ProtoVersion0 = iota
- ProtoVersion1
- ProtoVersion2
- ProtoVersion3
- )
- type Proto struct {
- PacketLength int32
- HeaderLength int16
- Version int16
- Operation int32
- SequenceId int32
- Body []byte
- BodyMuti [][]byte
- }
- type AuthRespParam struct {
- Code int64 `json:"code,omitempty"`
- }
|