Documentation
¶
Index ¶
Constants ¶
const ( IDConnectionRequest = iota + 500 IDConnectionResponse IDLatency IDTransfer )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectionRequest ¶
type ConnectionRequest struct { // Addr is the address of the player. Addr string // Token is the proxy's token that's used for authorization by the server. Token string // ClientData is the player's login.ClientData. ClientData []byte // IdentityData is the player's login.IdentityData. IdentityData []byte }
ConnectionRequest is the initial packet sent by the proxy to the server. The server responds to this packet with a ConnectionResponse packet.
func (*ConnectionRequest) Marshal ¶
func (pk *ConnectionRequest) Marshal(io protocol.IO)
Marshal ...
type ConnectionResponse ¶
type ConnectionResponse struct { // RuntimeID is the deterministic runtime ID of the player. RuntimeID uint64 // UniqueID is the deterministic unique ID of the player. UniqueID int64 }
ConnectionResponse is sent by the server in response to a ConnectionRequest. It includes unique and deterministic identifiers for the player's connection. Both RuntimeID and UniqueID remain unchanged throughout the player's session, ensuring consistency across all servers the player transfers or connects to.
func (*ConnectionResponse) Marshal ¶
func (pk *ConnectionResponse) Marshal(io protocol.IO)
Marshal ...
type Latency ¶
type Latency struct { // Latency is the measured latency in milliseconds. Latency int64 // Timestamp is the timestamp (in milliseconds) when the latency measurement was sent. Timestamp int64 }
Latency is used for latency measurement between a client connected to the proxy and the server: 1. Proxy sends a Latency packet with the current timestamp and the client's ping. 2. Server measures the time taken for the packet to arrive and adds the client's latency. 3. Server responds with a Latency packet containing the total calculated latency.