Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GameProfile ¶
type LoginChecker ¶
type LoginChecker interface {
CheckPlayer(name string, id uuid.UUID, protocol int32) (ok bool, reason chat.Message)
}
LoginChecker is the interface to check if a player is allowed to log in the server. The checking could be anything, server player number, protocol version, blacklist or whitelist. If a player is not allowed to, the reason should be returned and will be sent to the client by "LoginDisconnect" packet.
type LoginFailErr ¶
type LoginFailErr struct {
// contains filtered or unexported fields
}
func (LoginFailErr) Error ¶
func (l LoginFailErr) Error() string
type LoginHandler ¶
type LoginHandler interface {
AcceptLogin(conn *net.Conn, protocol int32) (name string, id uuid.UUID, profilePubKey *user.PublicKey, properties []user.Property, err error)
}
LoginHandler is used to handle player login process, that is, from clientbound "LoginStart" packet to serverbound "LoginSuccess" packet.
type MojangLoginHandler ¶
type MojangLoginHandler struct { // OnlineMode enables to check player's account. // And also encrypt the connection after login. OnlineMode bool // EnforceSecureProfile enforce to check the player's profile public key EnforceSecureProfile bool // Threshold set the smallest size of raw network payload to compress. // Set to 0 to compress all packets. Set to -1 to disable compression. Threshold int // LoginChecker is used to apply some checks before sending "LoginSuccess" packet // (e.g., blacklist or is server full). // This is an optional field and can be set to nil. LoginChecker // contains filtered or unexported fields }
MojangLoginHandler is a standard LoginHandler that implement both online and offline login progress. This implementation also supports custom LoginChecker. None of Custom login packets (also called LoginPluginRequest/Response) is supported for this implementation. To do that, implement your own LoginHandler imitate this code.