protocol

package
v0.0.0-...-804a7a4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2019 License: GPL-3.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

View Source
const (
	BitFlagValid = 0x80
	BitFlagIsAck = 0x40
	BitFlagIsNak = 0x20

	BitFlagPacketPair     = 0x10
	BitFlagContinuousSend = 0x08
	BitFlagNeedsBAndAs    = 0x04
)
View Source
const (
	ReliabilityUnreliable byte = iota
	ReliabilityUnreliableSequenced
	ReliabilityReliable
	ReliabilityReliableOrdered
	ReliabilityReliableSequenced
	ReliabilityUnreliableWithAck
	ReliabilityReliableWithAck
	ReliabilityReliableOrderedWithAck

	SplitFlag = 0x10
)
View Source
const (
	FlagDatagramAck  = 0xc0
	FlagDatagramNack = 0xa0
)
View Source
const (
	IdConnectedPing = 0x00
	IdConnectedPong = 0x03

	IdUnconnectedPing = 0x01
	IdUnconnectedPong = 0x1c

	IdOpenConnectionRequest1 = 0x05
	IdOpenConnectionReply1   = 0x06
	IdOpenConnectionRequest2 = 0x07
	IdOpenConnectionReply2   = 0x08

	IdConnectionRequest = 0x09
	IdConnectionAccept  = 0x10

	IdNewIncomingConnection = 0x13

	IdDisconnectNotification = 0x15
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ACK

type ACK struct {
	*AcknowledgementPacket
}

func NewACK

func NewACK() *ACK

type AcknowledgementPacket

type AcknowledgementPacket struct {
	*Packet
	Packets []uint32
}

func (*AcknowledgementPacket) Decode

func (packet *AcknowledgementPacket) Decode()

func (*AcknowledgementPacket) Encode

func (packet *AcknowledgementPacket) Encode()

type ConnectedPing

type ConnectedPing struct {
	*Packet
	PingSendTime int64
}

func NewConnectedPing

func NewConnectedPing() *ConnectedPing

func (*ConnectedPing) Decode

func (ping *ConnectedPing) Decode()

func (*ConnectedPing) Encode

func (ping *ConnectedPing) Encode()

type ConnectedPong

type ConnectedPong struct {
	*Packet
	PingSendTime int64
	PongSendTime int64
}

func NewConnectedPong

func NewConnectedPong() *ConnectedPong

func (*ConnectedPong) Decode

func (pong *ConnectedPong) Decode()

func (*ConnectedPong) Encode

func (pong *ConnectedPong) Encode()

type ConnectionAccept

type ConnectionAccept struct {
	*Packet
	ClientAddress    string
	ClientPort       uint16
	PingSendTime     uint64
	PongSendTime     uint64
	SystemAddresses  []string
	SystemPorts      []uint16
	SystemIdVersions []byte
}

func NewConnectionAccept

func NewConnectionAccept() *ConnectionAccept

func (*ConnectionAccept) Decode

func (request *ConnectionAccept) Decode()

func (*ConnectionAccept) Encode

func (request *ConnectionAccept) Encode()

type ConnectionRequest

type ConnectionRequest struct {
	*Packet
	ClientId     uint64
	PingSendTime uint64
	Security     byte
}

func NewConnectionRequest

func NewConnectionRequest() *ConnectionRequest

func (*ConnectionRequest) Decode

func (request *ConnectionRequest) Decode()

func (*ConnectionRequest) Encode

func (request *ConnectionRequest) Encode()

type Datagram

type Datagram struct {
	*Packet

	PacketPair     bool
	ContinuousSend bool
	NeedsBAndAs    bool

	SequenceNumber uint32
	// contains filtered or unexported fields
}

func NewDatagram

func NewDatagram() *Datagram

func (*Datagram) AddPacket

func (datagram *Datagram) AddPacket(packet *EncapsulatedPacket)

func (*Datagram) Decode

func (datagram *Datagram) Decode()

func (*Datagram) Encode

func (datagram *Datagram) Encode()

func (*Datagram) GetLength

func (datagram *Datagram) GetLength() int

func (*Datagram) GetPackets

func (datagram *Datagram) GetPackets() *[]*EncapsulatedPacket

type EncapsulatedPacket

type EncapsulatedPacket struct {
	*Packet
	Reliability   byte
	HasSplit      bool
	Length        uint
	MessageIndex  uint32
	OrderIndex    uint32
	OrderChannel  byte
	SplitId       int16
	SplitCount    uint
	SplitIndex    uint
	SequenceIndex uint32
}

func NewEncapsulatedPacket

func NewEncapsulatedPacket() *EncapsulatedPacket

func (*EncapsulatedPacket) Encode

func (packet *EncapsulatedPacket) Encode()

func (*EncapsulatedPacket) GetFromBinary

func (packet *EncapsulatedPacket) GetFromBinary(stream *Datagram) (*EncapsulatedPacket, error)

func (*EncapsulatedPacket) GetLength

func (packet *EncapsulatedPacket) GetLength() int

func (*EncapsulatedPacket) IsOrdered

func (packet *EncapsulatedPacket) IsOrdered() bool

func (*EncapsulatedPacket) IsReliable

func (packet *EncapsulatedPacket) IsReliable() bool

func (*EncapsulatedPacket) IsSequenced

func (packet *EncapsulatedPacket) IsSequenced() bool

func (*EncapsulatedPacket) IsSequencedOrOrdered

func (packet *EncapsulatedPacket) IsSequencedOrOrdered() bool

type IConnectedPacket

type IConnectedPacket interface {
	Encode()
	GetBuffer() []byte
}

type IPacket

type IPacket interface {
	SetBuffer([]byte)
	GetBuffer() []byte
	GetId() int
	Encode()
	Decode()
	HasMagic() bool
}

type NAK

type NAK struct {
	*AcknowledgementPacket
}

func NewNAK

func NewNAK() *NAK

type NewIncomingConnection

type NewIncomingConnection struct {
	*Packet
	ServerAddress    string
	ServerPort       uint16
	PingSendTime     uint64
	PongSendTime     uint64
	SystemAddresses  []string
	SystemPorts      []uint16
	SystemIdVersions []byte
}

func NewNewIncomingConnection

func NewNewIncomingConnection() *NewIncomingConnection

func (*NewIncomingConnection) Decode

func (request *NewIncomingConnection) Decode()

func (*NewIncomingConnection) Encode

func (request *NewIncomingConnection) Encode()

type OpenConnectionReply1

type OpenConnectionReply1 struct {
	*UnconnectedMessage
	ServerId int64
	MtuSize  int16
	Security bool
}

func NewOpenConnectionReply1

func NewOpenConnectionReply1() *OpenConnectionReply1

func (*OpenConnectionReply1) Decode

func (response *OpenConnectionReply1) Decode()

func (*OpenConnectionReply1) Encode

func (response *OpenConnectionReply1) Encode()

type OpenConnectionReply2

type OpenConnectionReply2 struct {
	*UnconnectedMessage
	ServerId      int64
	MtuSize       int16
	ClientAddress string
	ClientPort    uint16
	UseEncryption bool
}

func NewOpenConnectionReply2

func NewOpenConnectionReply2() *OpenConnectionReply2

func (*OpenConnectionReply2) Decode

func (response *OpenConnectionReply2) Decode()

func (*OpenConnectionReply2) Encode

func (response *OpenConnectionReply2) Encode()

type OpenConnectionRequest1

type OpenConnectionRequest1 struct {
	*UnconnectedMessage
	Protocol byte
	MtuSize  int16
}

func NewOpenConnectionRequest1

func NewOpenConnectionRequest1() *OpenConnectionRequest1

func (*OpenConnectionRequest1) Decode

func (request *OpenConnectionRequest1) Decode()

func (*OpenConnectionRequest1) Encode

func (request *OpenConnectionRequest1) Encode()

type OpenConnectionRequest2

type OpenConnectionRequest2 struct {
	*UnconnectedMessage
	ServerAddress string
	ServerPort    uint16
	MtuSize       int16
	ClientId      int64
}

func NewOpenConnectionRequest2

func NewOpenConnectionRequest2() *OpenConnectionRequest2

func (*OpenConnectionRequest2) Decode

func (request *OpenConnectionRequest2) Decode()

func (*OpenConnectionRequest2) Encode

func (request *OpenConnectionRequest2) Encode()

type Packet

type Packet struct {
	*binutils.Stream
	// contains filtered or unexported fields
}

func NewPacket

func NewPacket(id int) *Packet

func (*Packet) DecodeStep

func (packet *Packet) DecodeStep()

func (*Packet) EncodeId

func (packet *Packet) EncodeId()

func (*Packet) GetAddress

func (packet *Packet) GetAddress() (address string, port uint16, ipVersion byte)

func (*Packet) GetId

func (packet *Packet) GetId() int

func (*Packet) HasMagic

func (packet *Packet) HasMagic() bool

func (*Packet) PutAddress

func (packet *Packet) PutAddress(address string, port uint16, ipVersion byte)

func (*Packet) ResetBase

func (packet *Packet) ResetBase()

type UnconnectedMessage

type UnconnectedMessage struct {
	*Packet
	// contains filtered or unexported fields
}

func NewUnconnectedMessage

func NewUnconnectedMessage(packet *Packet) *UnconnectedMessage

func (*UnconnectedMessage) HasValidMagic

func (message *UnconnectedMessage) HasValidMagic() bool

func (*UnconnectedMessage) PutMagic

func (message *UnconnectedMessage) PutMagic()

func (*UnconnectedMessage) ReadMagic

func (message *UnconnectedMessage) ReadMagic()

type UnconnectedPing

type UnconnectedPing struct {
	*UnconnectedMessage
	PingTime int64
}

func NewUnconnectedPing

func NewUnconnectedPing() *UnconnectedPing

func (*UnconnectedPing) Decode

func (ping *UnconnectedPing) Decode()

func (*UnconnectedPing) Encode

func (ping *UnconnectedPing) Encode()

type UnconnectedPong

type UnconnectedPong struct {
	*UnconnectedMessage
	PingTime int64
	ServerId int64
	PongData string
}

func NewUnconnectedPong

func NewUnconnectedPong() *UnconnectedPong

func (*UnconnectedPong) Decode

func (pong *UnconnectedPong) Decode()

func (*UnconnectedPong) Encode

func (pong *UnconnectedPong) Encode()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL