network

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2024 License: MIT Imports: 2 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

type Buffer interface {
	Len() int32

	SAS() []int8

	UAS() []byte

	InI() int32

	InO() int32

	SkpAll()

	SkpLen(delta int32)

	// pull
	PullBit() bool

	PullByt() byte

	PullI16() int16

	PullU16() uint16

	PullI32() int32

	PullI64() int64

	PullU64() uint64

	PullF32() float32

	PullF64() float64

	PullVrI() int32

	PullVrL() int64

	PullTxt() string

	PullUAS() []byte

	PullSAS() []int8

	PullUID() data.UUID

	PullPos() data.PositionI

	// push
	PushBit(data bool)

	PushByt(data byte)

	PushI16(data int16)

	PushI32(data int32)

	PushI64(data int64)

	PushF32(data float32)

	PushF64(data float64)

	PushVrI(data int32)

	PushVrL(data int64)

	PushTxt(data string)

	PushUAS(data []byte, prefixWithLen bool)

	PushSAS(data []int8, prefixWithLen bool)

	PushUID(data data.UUID)

	PushPos(data data.PositionI)
}

type BufferCodec

type BufferCodec interface {
	BufferPush
	BufferPull
}

type BufferPull

type BufferPull interface {
	Pull(reader Buffer)
}

type BufferPush

type BufferPush interface {
	Push(writer Buffer)
}

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)

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

	Stop() (err error)

	SendPacket(packet PacketO)
}

type PacketI

type PacketI interface {
	Pull(in Buffer)
	UUID() int32
}

type PacketInput

type PacketInput int32
const (
	KeepAlive PacketInput = iota
	ChatMessage
	UseEntity
	Flying
	Position
	Look
	PositionLook
	BlockDig
	BlockPlace
	HeldItemSlot
	ArmAnimation
	EntityAction
	SteerVehicle
	CloseWindow
	WindowClick
	Transaction
	SetCreativeSlot
	EnchantItem
	UpdateSign
	Abilities
	TabComplete
	Settings
	ClientCommand
	CustomPayload
	Spectate
)

type PacketManager

type PacketManager interface {
	SetHandler(packetId PacketInput, handler func(Connection, PacketI))
	RemoveHandler(packetId PacketInput)
	GetPlayFunc(id int32) func(c Connection, packet PacketI)

	GetCompression() int
}

type PacketO

type PacketO interface {
	UUID() int32
	Push(out Buffer)
}

type PacketState

type PacketState int32
const (
	SHAKE PacketState = iota
	STATUS
	LOGIN
	PLAY
	INVALID
)

func StateValueOf

func StateValueOf(i int) PacketState

Directories

Path Synopsis
client
server

Jump to

Keyboard shortcuts

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