proto

package
v0.8.5 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2022 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HandshakeID is the ID of the Handshake packet.
	HandshakeID = 0x00
	// LegacyServerListPingID is the ID of the LegacyServerListPing packet.
	LegacyServerListPingID = 0xFE
)
View Source
const (
	// StateHandshaking is the initial state of a minecraft connection.
	StateHandshaking = iota
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Frame

type Frame struct {
	// contains filtered or unexported fields
}

Frame represents a single frame in the communication.

func (*Frame) String

func (f *Frame) String() string

type Handshake

type Handshake struct {
	ProtocolVersion int
	ServerAddress   string
	ServerPort      uint16
	NextState       int
}

Handshake is the first packet in the minecraft protocol send by the client.

func ReadHandshake

func ReadHandshake(data interface{}) (*Handshake, error)

ReadHandshake reads a Handshake packet from the given data.

type LegacyServerListPing

type LegacyServerListPing struct {
	ProtocolVersion int
	ServerAddress   string
	ServerPort      uint16
}

LegacyServerListPing is send by legacy minecraft client.

type Packet

type Packet struct {
	// Length is the length of the packet.
	Length int
	// PacketID is the ID of the packet.
	PacketID int
	// Data is either a byte slice of raw content or a parsed message
	Data interface{}
}

Packet represents a single packet in the minecraft communication.

func ReadPacket

func ReadPacket(reader io.Reader, addr net.Addr, state State) (*Packet, error)

ReadPacket reads a single packet from the given reader.

func (*Packet) String

func (p *Packet) String() string

type State

type State int

State represents the state a minecraft connection is in.

Jump to

Keyboard shortcuts

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