base

package
v0.0.0-...-ca992e9 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValueOfPacketState

func ValueOfPacketState(s PacketState) int

Types

type Compacter

type Compacter struct {
	Values []int64
	// contains filtered or unexported fields
}

func NewCompacter

func NewCompacter(bits, size int) *Compacter

func (*Compacter) Get

func (c *Compacter) Get(index int) int

func (*Compacter) Set

func (c *Compacter) Set(index int, value int) int

type Connection

type Connection interface {
	Address() net.Addr

	GetState() PacketState
	SetState(state PacketState)

	Encrypt(data []byte) (output []byte)
	Decrypt(data []byte) (output []byte)

	CertifyName() string

	CertifyData() []byte

	CertifyValues(name string)
	CertifyUpdate(secret []byte)

	Deflate(data []byte) (output []byte)
	Inflate(data []byte) (output []byte)

	Pull(data []byte) (len int, err error)
	Push(data []byte) (len int, err error)

	Stop() (err error)

	SendPacket(packet PacketO)
}

type Network

type Network interface {
	base.State
}

type Packet

type Packet interface {
	// the uuid of this packet
	UUID() int32
}

type PacketI

type PacketI interface {
	Packet

	// decode the server_data from the reader into this packet
	Pull(reader buff.Buffer, conn Connection)
}

type PacketO

type PacketO interface {
	Packet

	// encode the server_data from the packet into this writer
	Push(writer buff.Buffer, conn Connection)
}

type PacketState

type PacketState int
const (
	SHAKE PacketState = iota
	STATUS
	LOGIN
	PLAY
)

func PacketStateValueOf

func PacketStateValueOf(s int) PacketState

func (PacketState) Next

func (state PacketState) Next() PacketState

func (PacketState) String

func (state PacketState) String() string

type Packets

type Packets interface {
	util.Watcher

	GetPacketI(uuid int32, state PacketState) PacketI
}

type PlayerAndConnection

type PlayerAndConnection struct {
	Connection
	ents.Player
}

Jump to

Keyboard shortcuts

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