Documentation ¶
Overview ¶
Package protocol is a generated protocol buffer package.
import "google/protobuf/descriptor.proto";
It is generated from these files:
proto_hs.proto
It has these top-level messages:
ProtoSyn ProtoAsyn ProtoAck ProtoHeartBeat
Index ¶
- Constants
- Variables
- func FlodPayloadData(rawData []byte, cipherBlock cipher.Block) ([]byte, error)
- func PackAckMsg(msgId uint32, protoAck *ProtoAck) ([]byte, error)
- func PackAsynMsg(msgId uint32, protoAsyn *ProtoAsyn) ([]byte, error)
- func PackHeartBeat(msgId uint32, unix int64) ([]byte, error)
- func PackSynMsg(msgId uint32, protoSyn *ProtoSyn) ([]byte, error)
- func PackTransferData(msgId uint32, payLoad []byte) ([]byte, error)
- func UnFlodPayloadData(cipherData []byte, cipherBlock cipher.Block) ([]byte, error)
- type ProtoAck
- type ProtoAsyn
- type ProtoC2SCmd
- type ProtoC2SHead
- type ProtoHeartBeat
- type ProtoSyn
Constants ¶
View Source
const ( ProtoC2SMagic = uint32(0x98651210) //ProtoC2SHeadSize = int(unsafe.Sizeof(head_82732831712)) 这里无法使用sizeof,应为有align,可序列化时是pack 1的 ProtoC2SHeadSize int = 14 )
Variables ¶
Functions ¶
func FlodPayloadData ¶
压缩--->CRC校验--->加密
Types ¶
type ProtoAck ¶
type ProtoAck struct {
CipherText []byte `protobuf:"bytes,1,opt,name=CipherText,proto3" json:"CipherText,omitempty"`
}
func (*ProtoAck) Descriptor ¶
func (*ProtoAck) GetCipherText ¶
func (*ProtoAck) ProtoMessage ¶
func (*ProtoAck) ProtoMessage()
type ProtoAsyn ¶
type ProtoAsyn struct {
DHServerPubKey []byte `protobuf:"bytes,1,opt,name=DHServerPubKey,proto3" json:"DHServerPubKey,omitempty"`
}
func (*ProtoAsyn) Descriptor ¶
func (*ProtoAsyn) GetDHServerPubKey ¶
func (*ProtoAsyn) ProtoMessage ¶
func (*ProtoAsyn) ProtoMessage()
type ProtoC2SCmd ¶
type ProtoC2SCmd int16
const ( E_C2S_CMD_SYN ProtoC2SCmd = iota E_S2C_CMD_ASYN E_C2S_CMD_ACK // 握手协议,主要用来交换密钥,验证加密用 E_TRANSFER // 业务传输 E_HEARTBEAT )
func (ProtoC2SCmd) String ¶
func (i ProtoC2SCmd) String() string
type ProtoC2SHead ¶
type ProtoC2SHead struct { MagicValue uint32 // 魔术字 MsgId uint32 // 消息序号 Cmd ProtoC2SCmd // DataLen int32 // 数据长度 }
这里的数据类型不能是int,必须明确位宽,否则binary操作会报错
func UnPackProtoHead ¶
func UnPackProtoHead(data []byte) (*ProtoC2SHead, error)
type ProtoHeartBeat ¶
type ProtoHeartBeat struct {
Timestamp int64 `protobuf:"fixed64,1,opt,name=Timestamp" json:"Timestamp,omitempty"`
}
func (*ProtoHeartBeat) Descriptor ¶
func (*ProtoHeartBeat) Descriptor() ([]byte, []int)
func (*ProtoHeartBeat) GetTimestamp ¶
func (m *ProtoHeartBeat) GetTimestamp() int64
func (*ProtoHeartBeat) ProtoMessage ¶
func (*ProtoHeartBeat) ProtoMessage()
func (*ProtoHeartBeat) Reset ¶
func (m *ProtoHeartBeat) Reset()
func (*ProtoHeartBeat) String ¶
func (m *ProtoHeartBeat) String() string
type ProtoSyn ¶
type ProtoSyn struct { VerifyBuf []byte `protobuf:"bytes,1,opt,name=VerifyBuf,proto3" json:"VerifyBuf,omitempty"` DHClientPubKey []byte `protobuf:"bytes,2,opt,name=DHClientPubKey,proto3" json:"DHClientPubKey,omitempty"` }
func (*ProtoSyn) Descriptor ¶
func (*ProtoSyn) GetDHClientPubKey ¶
func (*ProtoSyn) GetVerifyBuf ¶
func (*ProtoSyn) ProtoMessage ¶
func (*ProtoSyn) ProtoMessage()
Click to show internal directories.
Click to hide internal directories.