InitCmd represents the command ID of the protocol's command ID.
[NOTE] The value is optional and if cmd is not given in the definition JSON, it will be 0.
const InitCmd uint16 = 127
InitVer represents the ver of the protocol's command.
[NOTE] The value is optional and if ver is not given in the definition JSON, it will be 0.
const InitVer uint8 = 1
RelayCmd represents the command ID of the protocol's command ID.
[NOTE] The value is optional and if cmd is not given in the definition JSON, it will be 0.
const RelayCmd uint16 = 302
RelayVer represents the ver of the protocol's command.
[NOTE] The value is optional and if ver is not given in the definition JSON, it will be 0.
const RelayVer uint8 = 1
RequestHolePunchCmd represents the command ID of the protocol's command ID.
[NOTE] The value is optional and if cmd is not given in the definition JSON, it will be 0.
const RequestHolePunchCmd uint16 = 303
RequestHolePunchVer represents the ver of the protocol's command.
[NOTE] The value is optional and if ver is not given in the definition JSON, it will be 0.
const RequestHolePunchVer uint8 = 1
SuccessCmd represents the command ID of the protocol's command ID.
[NOTE] The value is optional and if cmd is not given in the definition JSON, it will be 0.
const SuccessCmd uint16 = 301
SuccessVer represents the ver of the protocol's command.
[NOTE] The value is optional and if ver is not given in the definition JSON, it will be 0.
const SuccessVer uint8 = 1
Init represents the command protocol data structure.
type Init struct { // Command version of the protocol Ver uint8 // Command ID of the protocol Cmd uint16 LinkedClients uint8 }
func NewInit() *Init
NewInit creates a new instance of Init struct.
func (proto *Init) GetCmd() uint16
func (proto *Init) GetVer() uint8
func (proto *Init) Pack() []byte
Pack encodes Init struct to a byte array to be delivered over the command.
func (proto *Init) String() string
func (proto *Init) Unpack(bytes []byte) error
Unpack decodes the command payload byte array to Init struct.
Relay represents the command protocol data structure.
type Relay struct { // Command version of the protocol Ver uint8 // Command ID of the protocol Cmd uint16 Message []byte Reliable bool }
func NewRelay() *Relay
NewRelay creates a new instance of Relay struct.
func (proto *Relay) GetCmd() uint16
func (proto *Relay) GetVer() uint8
func (proto *Relay) Pack() []byte
Pack encodes Relay struct to a byte array to be delivered over the command.
func (proto *Relay) String() string
func (proto *Relay) Unpack(bytes []byte) error
Unpack decodes the command payload byte array to Relay struct.
RequestHolePunch represents the command protocol data structure.
type RequestHolePunch struct { // Command version of the protocol Ver uint8 // Command ID of the protocol Cmd uint16 TargetAddress string }
func NewRequestHolePunch() *RequestHolePunch
NewRequestHolePunch creates a new instance of RequestHolePunch struct.
func (proto *RequestHolePunch) GetCmd() uint16
func (proto *RequestHolePunch) GetVer() uint8
func (proto *RequestHolePunch) Pack() []byte
Pack encodes RequestHolePunch struct to a byte array to be delivered over the command.
func (proto *RequestHolePunch) String() string
func (proto *RequestHolePunch) Unpack(bytes []byte) error
Unpack decodes the command payload byte array to RequestHolePunch struct.
Success represents the command protocol data structure.
type Success struct { // Command version of the protocol Ver uint8 // Command ID of the protocol Cmd uint16 }
func NewSuccess() *Success
NewSuccess creates a new instance of Success struct.
func (proto *Success) GetCmd() uint16
func (proto *Success) GetVer() uint8
func (proto *Success) Pack() []byte
Pack encodes Success struct to a byte array to be delivered over the command.
func (proto *Success) String() string
func (proto *Success) Unpack(bytes []byte) error
Unpack decodes the command payload byte array to Success struct.