packet

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2024 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ResponseSuccess = iota
	ResponseUnauthorized
	ResponseFail
)
View Source
const (
	IDConnectionRequest = iota
	IDConnectionResponse
	IDKick
	IDTransfer
)

Variables

This section is empty.

Functions

func Register

func Register(id uint32, factory func() Packet)

Types

type ConnectionRequest added in v0.0.4

type ConnectionRequest struct {
	Token string
}

func (*ConnectionRequest) Decode added in v0.0.4

func (pk *ConnectionRequest) Decode(buf *bytes.Buffer)

Decode ...

func (*ConnectionRequest) Encode added in v0.0.4

func (pk *ConnectionRequest) Encode(buf *bytes.Buffer)

Encode ...

func (*ConnectionRequest) ID added in v0.0.4

func (pk *ConnectionRequest) ID() uint32

ID ...

type ConnectionResponse added in v0.0.4

type ConnectionResponse struct {
	Response uint8
}

func (*ConnectionResponse) Decode added in v0.0.4

func (pk *ConnectionResponse) Decode(buf *bytes.Buffer)

Decode ...

func (*ConnectionResponse) Encode added in v0.0.4

func (pk *ConnectionResponse) Encode(buf *bytes.Buffer)

Encode ...

func (*ConnectionResponse) ID added in v0.0.4

func (pk *ConnectionResponse) ID() uint32

ID ...

type Kick

type Kick struct {
	Reason   string
	Username string
}

func (*Kick) Decode

func (pk *Kick) Decode(buf *bytes.Buffer)

Decode ...

func (*Kick) Encode

func (pk *Kick) Encode(buf *bytes.Buffer)

Encode ...

func (*Kick) ID

func (pk *Kick) ID() uint32

ID ...

type Packet

type Packet interface {
	ID() uint32
	Encode(buf *bytes.Buffer)
	Decode(buf *bytes.Buffer)
}

Packet ...

type Pool

type Pool map[uint32]func() Packet

func NewPool

func NewPool() Pool

type Transfer

type Transfer struct {
	Addr     string
	Username string
}

func (*Transfer) Decode

func (pk *Transfer) Decode(buf *bytes.Buffer)

Decode ...

func (*Transfer) Encode

func (pk *Transfer) Encode(buf *bytes.Buffer)

Encode ...

func (*Transfer) ID

func (pk *Transfer) ID() uint32

ID ...

Jump to

Keyboard shortcuts

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