server

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 13 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 net.Conn, 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) GameData

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

GameData ...

func (*Conn) ReadDeferred

func (c *Conn) ReadDeferred() []packet.Packet

ReadDeferred reads all packets deferred in the connection and returns them. It returns an empty slice if no packets were deferred.

func (*Conn) ReadPacket

func (c *Conn) ReadPacket(decode bool) (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) RemoteAddr

func (c *Conn) RemoteAddr() net.Addr

RemoteAddr ...

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 Dialer

type Dialer struct {
	Origin       string
	Token        string
	ClientData   login.ClientData
	IdentityData login.IdentityData
}

func (Dialer) Dial

func (d Dialer) Dial(addr string) (*Conn, error)

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