server_modules

package
v0.0.0-...-82b4563 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: LGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NotClientErr       = errors.New("not a servee")
	CantKickInStateErr = errors.New("cant kick in this state")
)
View Source
var StatusServedError = errors.New("status served")
View Source
var UnexpectedStatusRequest = UnexpectedNextStateError{proto_base.Status}

Functions

func Kick

func Kick(c *proto.Conn, reason *text.Component) (err error)

func ServeStatus

func ServeStatus(c *proto.Conn, s StatusResponse) (err error)

Types

type LoginServer

type LoginServer struct {
	*proto.Conn
	//OnlineMode           bool FIXME: implement this
	ServerHost           string
	ServerPort           uint16
	Requested            NameAndUUID
	Given                *NameAndUUID
	CompressionThreshold int32 //FIXME: implement this
	Status               []byte
	CompatibleVersions   []int32
}

func ServeLogin

func ServeLogin(c *proto.Conn, settings ...LoginServerSetting) (ret *LoginServer, err error)

func (*LoginServer) OnCycle

func (l *LoginServer) OnCycle(_ event.Tick) (err error)

func (*LoginServer) OnDefault

func (l *LoginServer) OnDefault(event event.Unhandled) (err error)

func (*LoginServer) OnHandshake

func (l *LoginServer) OnHandshake(packet *v1_21_8.HandshakingToServerPacketSetProtocol) (err error)

func (*LoginServer) OnLoginAcknowledged

func (l *LoginServer) OnLoginAcknowledged(_ *v1_21_8.LoginToServerPacketLoginAcknowledged) (err error)

func (*LoginServer) OnLoginStart

func (l *LoginServer) OnLoginStart(packet *v1_21_8.LoginToServerPacketLoginStart) (err error)

func (*LoginServer) OnStart

func (l *LoginServer) OnStart(_ event.OnStart) (err error)

func (*LoginServer) OnStatusPing

func (l *LoginServer) OnStatusPing(packet *v1_21_8.StatusToServerPacketPing) (err error)

func (*LoginServer) OnStatusRequest

func (l *LoginServer) OnStatusRequest(_ *v1_21_8.StatusToServerPacketPingStart) (err error)

func (*LoginServer) SetCompressionThreshold

func (l *LoginServer) SetCompressionThreshold(threshold int32) (err error)

type LoginServerSetting

type LoginServerSetting func(*LoginServer)

func WithCompatibleVersions

func WithCompatibleVersions(versions ...int32) LoginServerSetting

func WithCompatibleVersionsRange

func WithCompatibleVersionsRange(start, end int32) LoginServerSetting

func WithOtherAccount

func WithOtherAccount(a *api.Account) LoginServerSetting

func WithRawStatus

func WithRawStatus(status []byte) LoginServerSetting

func WithStatus

func WithStatus(response StatusResponse) LoginServerSetting

type NameAndUUID

type NameAndUUID struct {
	Name string
	UUID uuid.UUID
}

type StatusResponse

type StatusResponse struct {
	Version            StatusResponseVersion `json:"version"`
	Players            StatusResponsePlayers `json:"players"`
	Description        *text.Component       `json:"description"`
	Favicon            string                `json:"favicon"`
	EnforcesSecureChat bool                  `json:"enforcesSecureChat"`
}

StatusResponse here is the structure I used: https://minecraft.wiki/w/Java_Edition_protocol/Server_List_Ping#Status_Response

type StatusResponsePlayers

type StatusResponsePlayers struct {
	Max    int                    `json:"max"`
	Online int                    `json:"online"`
	Sample []StatusResponseSample `json:"sample"`
}

type StatusResponseSample

type StatusResponseSample struct {
	Name *text.Component `json:"name"`
	ID   string          `json:"id"`
}

type StatusResponseVersion

type StatusResponseVersion struct {
	Name     *text.Component `json:"name"`
	Protocol int32           `json:"protocol"`
}

type StatusServer

type StatusServer struct {
	*proto.Conn
	Status string
}

func (*StatusServer) Default

func (p *StatusServer) Default(_ any) (err error)

func (*StatusServer) OnStatusPing

func (p *StatusServer) OnStatusPing(packet *v1_21_8.StatusToServerPacketPing) (err error)

func (*StatusServer) OnStatusRequest

func (p *StatusServer) OnStatusRequest(_ *v1_21_8.StatusToServerPacketPingStart) (err error)

type UnexpectedNextStateError

type UnexpectedNextStateError struct {
	NextState proto_base.State
}

func (UnexpectedNextStateError) Error

func (u UnexpectedNextStateError) Error() string

Jump to

Keyboard shortcuts

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