Documentation ¶
Index ¶
- type AuthResponseHandler
- type FindPlayerResponseHandler
- type PacketHandler
- type PlayerInfoResponse
- type PlayerInfoResponseHandler
- type Portal
- func (portal *Portal) Authenticate(name, secret string) error
- func (portal *Portal) Authenticated() bool
- func (portal *Portal) FindPlayerFromName(playerName string) (string, error)
- func (portal *Portal) FindPlayerFromUUID(playerUuid uuid.UUID) (string, error)
- func (portal *Portal) Name() string
- func (portal *Portal) PlayerInfo(p *player.Player) (*PlayerInfoResponse, error)
- func (portal *Portal) PlayerLatency(p *player.Player) int64
- func (portal *Portal) RegisterServerInfo(address string) error
- func (portal *Portal) Run() error
- func (portal *Portal) ServerList() ([]packet.ServerEntry, error)
- func (portal *Portal) Transfer(p *player.Player, server string) (byte, error)
- func (portal *Portal) WritePacket(pk packet.Packet) error
- type ServerListResponseHandler
- type TransferResponseHandler
- type UpdatePlayerLatencyHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthResponseHandler ¶
type AuthResponseHandler struct {
// contains filtered or unexported fields
}
AuthResponseHandler is responsible for handling the AuthResponse packet sent by the proxy.
type FindPlayerResponseHandler ¶
type FindPlayerResponseHandler struct {
// contains filtered or unexported fields
}
FindPlayerResponseHandler is responsible for handling the FindPlayer packet sent by the proxy.
type PacketHandler ¶
type PacketHandler interface { // Handle is responsible for handling an incoming packet for the client. Handle(p packet.Packet, portal *Portal) error }
PacketHandler represents a type which handles a specific packet coming from a client.
type PlayerInfoResponse ¶
type PlayerInfoResponseHandler ¶
type PlayerInfoResponseHandler struct {
// contains filtered or unexported fields
}
PlayerInfoResponseHandler is responsible for handling the PlayerInfoResponse packet sent by the proxy.
type Portal ¶
type Portal struct {
// contains filtered or unexported fields
}
Portal represents a client that connections to a portal proxy over a TCP socket connection.
func New ¶
New returns a new portal client and attempts to connect to the proxy's socket connection on the provided added.
func (*Portal) Authenticate ¶
Authenticate attempts to authenticate the client with the proxy's socket server. The method blocks until it receives an auth response from the proxy.
func (*Portal) Authenticated ¶
Authenticated returns if the client is authenticated with the proxy's socket server.
func (*Portal) FindPlayerFromName ¶
FindPlayerFromName returns the name of the server the player is connected to. If they are not connected to portal, an empty string and false will be returned.
func (*Portal) FindPlayerFromUUID ¶
FindPlayerFromUUID returns the name of the server the player is connected to. If they are not connected to portal, an empty string and false will be returned.
func (*Portal) Name ¶
Name returns the name of the client if it is connected to the proxy's socket server. If not connected, an empty string will be returned.
func (*Portal) PlayerInfo ¶
func (portal *Portal) PlayerInfo(p *player.Player) (*PlayerInfoResponse, error)
PlayerInfo returns the information of the player provided. This information includes their IP address and their XUID.
func (*Portal) PlayerLatency ¶
PlayerLatency returns the latency of the player provided.
func (*Portal) RegisterServerInfo ¶
RegisterServerInfo registers the provided address to the proxy to make it a joinable server.
func (*Portal) Run ¶
Run is a blocking function that constantly attempts to read packets from the client's socket connection.
func (*Portal) ServerList ¶
func (portal *Portal) ServerList() ([]packet.ServerEntry, error)
ServerList returns a list of servers that are registered to the connected portal.
type ServerListResponseHandler ¶
type ServerListResponseHandler struct {
// contains filtered or unexported fields
}
ServerListResponseHandler is responsible for handling the ServerListResponse packet sent by the proxy.
type TransferResponseHandler ¶
type TransferResponseHandler struct {
// contains filtered or unexported fields
}
TransferResponseHandler is responsible for handling the TransferResponse packet sent by the proxy.
type UpdatePlayerLatencyHandler ¶
type UpdatePlayerLatencyHandler struct {
// contains filtered or unexported fields
}
UpdatePlayerLatencyHandler is responsible for handling the UpdatePlayerLatency packet sent by the proxy.
func NewUpdatePlayerLatencyHandler ¶
func NewUpdatePlayerLatencyHandler(defaultExpiration, cleanupInterval time.Duration) *UpdatePlayerLatencyHandler