server

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

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

Conn is a connection to a server. It is used to read and write packets to the server, and to manage the connection to the server.

func NewConn

func NewConn(conn io.ReadWriteCloser, pool packet.Pool) *Conn

NewConn creates a new Conn with the conn and pool passed.

func (*Conn) Close

func (c *Conn) Close() (err error)

Close ...

func (*Conn) Connect added in v0.0.13

func (c *Conn) Connect(client *minecraft.Conn, token string) (err error)

Connect send a connection request to the server with the client and token passed. It returns an error if the server doesn't respond.

func (*Conn) GameData

func (c *Conn) GameData() minecraft.GameData

GameData ...

func (*Conn) ReadPacket

func (c *Conn) ReadPacket() (any, error)

ReadPacket reads a packet from the connection. It returns the packet read, or an error if the packet could not be read.

func (*Conn) Spawn

func (c *Conn) Spawn() (err error)

Spawn will start the spawning sequence using the game data found in conn.GameData(), which was sent earlier by the server.

func (*Conn) WritePacket

func (c *Conn) WritePacket(pk packet.Packet) error

WritePacket writes a packet to the connection. It returns an error if the packet could not be written.

type Discovery

type Discovery interface {
	Discover(conn *minecraft.Conn) (string, error)
}

type StaticDiscovery

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

func NewStaticDiscovery

func NewStaticDiscovery(server string) *StaticDiscovery

func (*StaticDiscovery) Discover

func (s *StaticDiscovery) Discover(*minecraft.Conn) (string, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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