...

Package p2p

import "github.com/Diarkis/diarkis/proto/go/p2p"
Overview
Index

Overview ▾

Code generated by Diarkis Puffer module: DO NOT EDIT.

Auto-generated by Diarkis Version 1.0.0

- Maximum length of a string is 65535 bytes - Maximum length of a byte array is 65535 bytes - Maximum length of any array is 65535 elements

Code generated by Diarkis Puffer module: DO NOT EDIT.

Auto-generated by Diarkis Version 1.0.0

- Maximum length of a string is 65535 bytes - Maximum length of a byte array is 65535 bytes - Maximum length of any array is 65535 elements

Code generated by Diarkis Puffer module: DO NOT EDIT.

Auto-generated by Diarkis Version 1.0.0

- Maximum length of a string is 65535 bytes - Maximum length of a byte array is 65535 bytes - Maximum length of any array is 65535 elements

Code generated by Diarkis Puffer module: DO NOT EDIT.

Auto-generated by Diarkis Version 1.0.0

- Maximum length of a string is 65535 bytes - Maximum length of a byte array is 65535 bytes - Maximum length of any array is 65535 elements

Constants

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

type Init

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

func NewInit() *Init

NewInit creates a new instance of Init struct.

func (*Init) GetCmd

func (proto *Init) GetCmd() uint16

func (*Init) GetVer

func (proto *Init) GetVer() uint8

func (*Init) Pack

func (proto *Init) Pack() []byte

Pack encodes Init struct to a byte array to be delivered over the command.

func (*Init) String

func (proto *Init) String() string

func (*Init) Unpack

func (proto *Init) Unpack(bytes []byte) error

Unpack decodes the command payload byte array to Init struct.

type Relay

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

func NewRelay() *Relay

NewRelay creates a new instance of Relay struct.

func (*Relay) GetCmd

func (proto *Relay) GetCmd() uint16

func (*Relay) GetVer

func (proto *Relay) GetVer() uint8

func (*Relay) Pack

func (proto *Relay) Pack() []byte

Pack encodes Relay struct to a byte array to be delivered over the command.

func (*Relay) String

func (proto *Relay) String() string

func (*Relay) Unpack

func (proto *Relay) Unpack(bytes []byte) error

Unpack decodes the command payload byte array to Relay struct.

type RequestHolePunch

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

func NewRequestHolePunch() *RequestHolePunch

NewRequestHolePunch creates a new instance of RequestHolePunch struct.

func (*RequestHolePunch) GetCmd

func (proto *RequestHolePunch) GetCmd() uint16

func (*RequestHolePunch) GetVer

func (proto *RequestHolePunch) GetVer() uint8

func (*RequestHolePunch) Pack

func (proto *RequestHolePunch) Pack() []byte

Pack encodes RequestHolePunch struct to a byte array to be delivered over the command.

func (*RequestHolePunch) String

func (proto *RequestHolePunch) String() string

func (*RequestHolePunch) Unpack

func (proto *RequestHolePunch) Unpack(bytes []byte) error

Unpack decodes the command payload byte array to RequestHolePunch struct.

type Success

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

func NewSuccess() *Success

NewSuccess creates a new instance of Success struct.

func (*Success) GetCmd

func (proto *Success) GetCmd() uint16

func (*Success) GetVer

func (proto *Success) GetVer() uint8

func (*Success) Pack

func (proto *Success) Pack() []byte

Pack encodes Success struct to a byte array to be delivered over the command.

func (*Success) String

func (proto *Success) String() string

func (*Success) Unpack

func (proto *Success) Unpack(bytes []byte) error

Unpack decodes the command payload byte array to Success struct.