Documentation
¶
Index ¶
- Constants
- func Register(id uint16, pk func() Packet)
- type AuthRequest
- type AuthResponse
- type FindPlayerRequest
- type FindPlayerResponse
- type Header
- type Packet
- type PlayerInfoRequest
- type PlayerInfoResponse
- type Pool
- type RegisterServer
- type ServerEntry
- type ServerListRequest
- type ServerListResponse
- type TransferRequest
- type TransferResponse
- type UpdatePlayerLatency
Constants ¶
const ( AuthResponseSuccess byte = iota AuthResponseUnsupportedProtocol AuthResponseIncorrectSecret AuthResponseAlreadyConnected AuthResponseUnauthenticated )
const ( IDAuthRequest uint16 = iota IDAuthResponse IDRegisterServer IDTransferRequest IDTransferResponse IDPlayerInfoRequest IDPlayerInfoResponse IDServerListRequest IDServerListResponse IDFindPlayerRequest IDFindPlayerResponse IDUpdatePlayerLatency )
const ( PlayerInfoResponseSuccess byte = iota PlayerInfoResponsePlayerNotFound )
const ( TransferResponseSuccess byte = iota TransferResponseServerNotFound TransferResponseAlreadyOnServer TransferResponsePlayerNotFound TransferResponseError )
const ProtocolVersion = 1
ProtocolVersion is the protocol version supported by the proxy. It will only accept clients that match this version, and it should be incremented every time the protocol changes.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuthRequest ¶
type AuthRequest struct { // Protocol is the protocol version supported by the client. It must match the proxy version otherwise the client // cannot authenticate. Protocol uint32 // Secret is the secret key to authenticate with. It must match the configured key in the proxy otherwise // the client will not be authenticated. Secret string // Name is the name of the client that is being authenticated. The name must be different to existing // connections. Name string }
AuthRequest is sent by a connection to authenticate with the proxy.
type AuthResponse ¶
type AuthResponse struct { // Protocol is the protocol version supported by the socket server. Protocol uint32 // Status is the response status from authentication. The possible values for this can be found above. Status byte }
AuthResponse is sent by the proxy in response to AuthRequest. It tells the client if the authentication request was successful or not.
func (*AuthResponse) Unmarshal ¶
func (pk *AuthResponse) Unmarshal(r *protocol.Reader)
Unmarshal ...
type FindPlayerRequest ¶
type FindPlayerRequest struct { // PlayerUUID is the UUID of the player to find. PlayerUUID uuid.UUID // PlayerName is the name of the player to find. PlayerName string }
FindPlayerRequest is sent by a connection to find the server the request player is currently on.
func (*FindPlayerRequest) Marshal ¶
func (pk *FindPlayerRequest) Marshal(w *protocol.Writer)
Marshal ...
func (*FindPlayerRequest) Unmarshal ¶
func (pk *FindPlayerRequest) Unmarshal(r *protocol.Reader)
Unmarshal ...
type FindPlayerResponse ¶
type FindPlayerResponse struct { // PlayerUUID is the UUID of the player that has been searched for. PlayerUUID uuid.UUID // PlayerName is the name of the player that has been searched for. PlayerName string // Online is if the player is connected to the proxy. Online bool // Server is the server within the group the player is in, if connected. Server string }
FindPlayerResponse is sent by the proxy in response to PlayerInfoRequest to tell the connection the XUID and IP address of the requested player.
func (*FindPlayerResponse) Marshal ¶
func (pk *FindPlayerResponse) Marshal(w *protocol.Writer)
Marshal ...
func (*FindPlayerResponse) Unmarshal ¶
func (pk *FindPlayerResponse) Unmarshal(r *protocol.Reader)
Unmarshal ...
type Packet ¶
type Packet interface { // ID returns the ID of the packet. All of these identifiers of packets may be found in id.go. ID() uint16 // Marshal encodes the packet to its binary representation into buf. Marshal(w *protocol.Writer) // Unmarshal decodes a serialised packet in buf into the Packet instance. The serialised packet passed // into Unmarshal will not have a header in it. Unmarshal(r *protocol.Reader) }
type PlayerInfoRequest ¶
type PlayerInfoRequest struct { // PlayerUUID is the UUID of the player to get information about. PlayerUUID uuid.UUID }
PlayerInfoRequest is sent by a connection to request information such as the XUID and IP address of a player connected to the proxy.
func (*PlayerInfoRequest) Marshal ¶
func (pk *PlayerInfoRequest) Marshal(w *protocol.Writer)
Marshal ...
func (*PlayerInfoRequest) Unmarshal ¶
func (pk *PlayerInfoRequest) Unmarshal(r *protocol.Reader)
Unmarshal ...
type PlayerInfoResponse ¶
type PlayerInfoResponse struct { // PlayerUUID is the UUID of the player the information belongs to. PlayerUUID uuid.UUID // Status is the response status from fetching the player information. The possible values for this can // be found above. Status byte // XUID is the Xbox Unique Identifier of the requested player. XUID string // Address is the IP address of the requested player. This can be IPv4 or IPv6 depending on which address // they join with. Address string }
PlayerInfoResponse is sent by the proxy in response to PlayerInfoRequest to tell the connection the XUID and IP address of the requested player.
func (*PlayerInfoResponse) Marshal ¶
func (pk *PlayerInfoResponse) Marshal(w *protocol.Writer)
Marshal ...
func (*PlayerInfoResponse) Unmarshal ¶
func (pk *PlayerInfoResponse) Unmarshal(r *protocol.Reader)
Unmarshal ...
type RegisterServer ¶ added in v0.2.0
type RegisterServer struct { // Address is the address of the server in the format ip:port. Address string }
RegisterServer is sent by a connection to register itself as a server with the provided address.
func (*RegisterServer) Marshal ¶ added in v0.2.0
func (pk *RegisterServer) Marshal(w *protocol.Writer)
Marshal ...
func (*RegisterServer) Unmarshal ¶ added in v0.2.0
func (pk *RegisterServer) Unmarshal(r *protocol.Reader)
Unmarshal ...
type ServerEntry ¶
type ServerEntry struct { // Name is name of the server. Name string // PlayerCount returns player count of the server. PlayerCount int64 }
ServerEntry represents server connected the proxy.
type ServerListRequest ¶
type ServerListRequest struct{}
ServerListRequest is sent by the client to request list of all the servers connected to portal proxy (including offline servers).
func (*ServerListRequest) Marshal ¶
func (pk *ServerListRequest) Marshal(*protocol.Writer)
Marshal ...
func (*ServerListRequest) Unmarshal ¶
func (pk *ServerListRequest) Unmarshal(*protocol.Reader)
Unmarshal ...
type ServerListResponse ¶
type ServerListResponse struct { // Servers represents all the servers connected to the proxy. Servers []ServerEntry }
ServerListResponse is sent by the proxy in response to ServerListRequest. It sends list of all the servers connected to the proxy.
func (*ServerListResponse) Marshal ¶
func (pk *ServerListResponse) Marshal(w *protocol.Writer)
Marshal ...
func (*ServerListResponse) Unmarshal ¶
func (pk *ServerListResponse) Unmarshal(r *protocol.Reader)
Unmarshal ...
type TransferRequest ¶
type TransferRequest struct { // PlayerUUID is the UUID of the player to be transferred. PlayerUUID uuid.UUID // Server is the name of the server in the group to transfer to. Server string }
TransferRequest is sent by a server to request the transfer of a player.
func (*TransferRequest) Marshal ¶
func (pk *TransferRequest) Marshal(w *protocol.Writer)
Marshal ...
func (*TransferRequest) Unmarshal ¶
func (pk *TransferRequest) Unmarshal(r *protocol.Reader)
Unmarshal ...
type TransferResponse ¶
type TransferResponse struct { // PlayerUUID is the UUID of the player being transferred. PlayerUUID uuid.UUID // Status is the response status from the transfer. The possible values for this can be found above. Status byte // Error is the error message when the Status field is TransferResponseError. Error string }
TransferResponse is sent by the proxy in response to a transfer request.
func (*TransferResponse) Marshal ¶
func (pk *TransferResponse) Marshal(w *protocol.Writer)
Marshal ...
func (*TransferResponse) Unmarshal ¶
func (pk *TransferResponse) Unmarshal(r *protocol.Reader)
Unmarshal ...
type UpdatePlayerLatency ¶
type UpdatePlayerLatency struct { // PlayerUUID is the UUID of the player the latency belongs to. PlayerUUID uuid.UUID // Latency is the latency of the player's connection to the proxy in milliseconds. Latency int64 }
UpdatePlayerLatency is sent by the proxy to update a player's latency on the server they are connected to.
func (*UpdatePlayerLatency) Marshal ¶
func (pk *UpdatePlayerLatency) Marshal(w *protocol.Writer)
Marshal ...
func (*UpdatePlayerLatency) Unmarshal ¶
func (pk *UpdatePlayerLatency) Unmarshal(r *protocol.Reader)
Unmarshal ...