Documentation
¶
Index ¶
Constants ¶
const ( IDConnectionRequest = iota + 500 IDConnectionResponse IDFlush IDLatency IDTransfer IDUpdateCache )
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
// ClientData is the player's login.ClientData.
ClientData []byte
// IdentityData is the player's login.IdentityData.
IdentityData []byte
// ProtocolID is the protocol version identifier of the player.
ProtocolID int32
// Cache is optional data sent by the downstream server, intended to optimize
// communication between servers. This data can include shared information that
// is frequently used across multiple servers and can be used to avoid redundant
// data fetching (e.g., pre-cached player data or session information).
Cache []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 Flush ¶ added in v0.0.37
type Flush struct {
}
Flush signals the proxy to flush the client's buffer. Servers that implement a batching mechanism, such as PMMP, send this packet at the end of a batch to indicate that flushing should occur. This prevents the proxy from performing double batching, which would otherwise result in unnecessary delays for flushing (the default delay is 50ms).
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.
type Transfer ¶
type Transfer struct {
// Addr is the address of the new server.
Addr string
}
Transfer is sent by the server to initiate a server transfer.
type UpdateCache ¶ added in v0.0.38
type UpdateCache struct {
// Cache is optional data sent by the downstream server, intended to optimize
// communication between servers. This data can include shared information that
// is frequently used across multiple servers and can be used to avoid redundant
// data fetching (e.g., pre-cached player data or session information).
// If present, it should be handled by the receiving server to optimize its
// internal operations or to forward the data as needed.
Cache []byte
}
UpdateCache is sent by the server to update a session's cache.
func (*UpdateCache) Marshal ¶ added in v0.0.38
func (pk *UpdateCache) Marshal(io protocol.IO)
Marshal ...