Documentation
¶
Index ¶
- Variables
- func Kick(c *proto.Conn, reason *text.Component) (err error)
- func ServeStatus(c *proto.Conn, s StatusResponse) (err error)
- type LoginServer
- func (l *LoginServer) OnCycle(_ event.Tick) (err error)
- func (l *LoginServer) OnDefault(event event.Unhandled) (err error)
- func (l *LoginServer) OnHandshake(packet *v1_21_8.HandshakingToServerPacketSetProtocol) (err error)
- func (l *LoginServer) OnLoginAcknowledged(_ *v1_21_8.LoginToServerPacketLoginAcknowledged) (err error)
- func (l *LoginServer) OnLoginStart(packet *v1_21_8.LoginToServerPacketLoginStart) (err error)
- func (l *LoginServer) OnStart(_ event.OnStart) (err error)
- func (l *LoginServer) OnStatusPing(packet *v1_21_8.StatusToServerPacketPing) (err error)
- func (l *LoginServer) OnStatusRequest(_ *v1_21_8.StatusToServerPacketPingStart) (err error)
- func (l *LoginServer) SetCompressionThreshold(threshold int32) (err error)
- type LoginServerSetting
- func WithCompatibleVersions(versions ...int32) LoginServerSetting
- func WithCompatibleVersionsRange(start, end int32) LoginServerSetting
- func WithOtherAccount(a *api.Account) LoginServerSetting
- func WithRawStatus(status []byte) LoginServerSetting
- func WithStatus(response StatusResponse) LoginServerSetting
- type NameAndUUID
- type StatusResponse
- type StatusResponsePlayers
- type StatusResponseSample
- type StatusResponseVersion
- type StatusServer
- type UnexpectedNextStateError
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 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) 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) 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 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 StatusResponseVersion ¶
type StatusServer ¶
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
Click to show internal directories.
Click to hide internal directories.