Documentation
¶
Index ¶
- Variables
- type Packet
- func (*Packet) Descriptor() ([]byte, []int)deprecated
- func (x *Packet) GetCompress() bool
- func (x *Packet) GetData() []byte
- func (x *Packet) GetDataVersion() uint64
- func (x *Packet) GetIndex() int32
- func (x *Packet) GetMod() int32
- func (x *Packet) GetObj() int64
- func (x *Packet) GetSeq() int32
- func (x *Packet) GetVer() int32
- func (*Packet) ProtoMessage()
- func (x *Packet) ProtoReflect() protoreflect.Message
- func (x *Packet) Reset()
- func (x *Packet) String() string
- func (m *Packet) Validate() error
- func (m *Packet) ValidateAll() error
- type PacketMultiError
- type PacketValidationError
Constants ¶
This section is empty.
Variables ¶
var File_packet_packet_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type Packet ¶
type Packet struct { Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` // Serialized bytes of the cs/sc protocol in the message. If the corresponding protocol specifies that the data needs to be cached on the client, use data_version to compare the data version number DataVersion uint64 `protobuf:"varint,2,opt,name=data_version,json=dataVersion,proto3" json:"data_version,omitempty"` // Data version number, default is 0. When greater than 0 and greater than the version of the same message (unique ID is the same), the data field is valid Obj int64 `protobuf:"varint,3,opt,name=obj,proto3" json:"obj,omitempty"` // Module object ID, according to the business agreement to pass the corresponding object ID Mod int32 `protobuf:"varint,4,opt,name=mod,proto3" json:"mod,omitempty"` // Module ID, globally unique Seq int32 `protobuf:"varint,5,opt,name=seq,proto3" json:"seq,omitempty"` // Message ID within the module, unique within the module Ver int32 `protobuf:"varint,6,opt,name=ver,proto3" json:"ver,omitempty"` // Packet Version, default 0 means no version Index int32 `protobuf:"varint,7,opt,name=index,proto3" json:"index,omitempty"` // Message index number, increment Compress bool `protobuf:"varint,8,opt,name=compress,proto3" json:"compress,omitempty"` // Whether the data in the body is compressed. The default compression method is zlib // contains filtered or unexported fields }
TCP packet structure definition For public network access The complete frame format: 4(4 + len(data), bigEndian) + data(encrypt(byte[](Marshal(Packet)))). The client and server send frames in this format. After the handshake protocol, all protocols use AES encryption and decryption The message index number is incremented by 1 each time, and the message index number is unique within the same module mod + seq + obj forms the unique ID of data
func (*Packet) Descriptor
deprecated
func (*Packet) GetCompress ¶
func (*Packet) GetDataVersion ¶
func (*Packet) ProtoMessage ¶
func (*Packet) ProtoMessage()
func (*Packet) ProtoReflect ¶
func (x *Packet) ProtoReflect() protoreflect.Message
func (*Packet) Validate ¶
Validate checks the field values on Packet with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*Packet) ValidateAll ¶
ValidateAll checks the field values on Packet with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in PacketMultiError, or nil if none found.
type PacketMultiError ¶
type PacketMultiError []error
PacketMultiError is an error wrapping multiple validation errors returned by Packet.ValidateAll() if the designated constraints aren't met.
func (PacketMultiError) AllErrors ¶
func (m PacketMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (PacketMultiError) Error ¶
func (m PacketMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type PacketValidationError ¶
type PacketValidationError struct {
// contains filtered or unexported fields
}
PacketValidationError is the validation error returned by Packet.Validate if the designated constraints aren't met.
func (PacketValidationError) Cause ¶
func (e PacketValidationError) Cause() error
Cause function returns cause value.
func (PacketValidationError) Error ¶
func (e PacketValidationError) Error() string
Error satisfies the builtin error interface
func (PacketValidationError) ErrorName ¶
func (e PacketValidationError) ErrorName() string
ErrorName returns error name.
func (PacketValidationError) Field ¶
func (e PacketValidationError) Field() string
Field function returns field value.
func (PacketValidationError) Key ¶
func (e PacketValidationError) Key() bool
Key function returns key value.
func (PacketValidationError) Reason ¶
func (e PacketValidationError) Reason() string
Reason function returns reason value.