Documentation
¶
Index ¶
Constants ¶
const ( ResponseSuccess = iota ResponseFail )
const ( IDConnectionRequest = iota IDConnectionResponse IDKick IDTransfer )
Variables ¶
This section is empty.
Functions ¶
func ReadString ¶
ReadString reads a string from buf, where the string is prefixed with its length encoded as an uint32 in little-endian order.
func WriteString ¶
WriteString writes the string s to buf, prefixing it with its length encoded as an uint32 in little-endian order.
Types ¶
type ConnectionRequest ¶
type ConnectionRequest struct {
// Token is the client's token which is used for authorization.
Token string
}
ConnectionRequest is sent by clients to connect and authenticate with the service using a token. The service responds to this request with a ConnectionResponse.
func (*ConnectionRequest) Decode ¶
func (pk *ConnectionRequest) Decode(buf *bytes.Buffer)
Decode ...
func (*ConnectionRequest) Encode ¶
func (pk *ConnectionRequest) Encode(buf *bytes.Buffer)
Encode ...
type ConnectionResponse ¶
type ConnectionResponse struct {
// Response indicates the status of the connection request.
Response uint8
}
ConnectionResponse represents the response sent by the API service in reply to a ConnectionRequest.
func (*ConnectionResponse) Decode ¶
func (pk *ConnectionResponse) Decode(buf *bytes.Buffer)
Decode ...
func (*ConnectionResponse) Encode ¶
func (pk *ConnectionResponse) Encode(buf *bytes.Buffer)
Encode ...
type Kick ¶
type Kick struct {
// Reason is the reason displayed in the disconnection screen for the kick.
Reason string
// Username is the username of the player to be kicked.
Username string
}
Kick is sent by the client to initiate the removal of a specific player from the proxy.
type Packet ¶
type Packet interface {
// ID returns the unique identifier of the packet.
ID() uint32
// Encode will encode the packet into binary form and write it to buf.
Encode(buf *bytes.Buffer)
// Decode will decode binary data from buf into the packet.
Decode(buf *bytes.Buffer)
}
Packet represents a protocol packet that can be sent over an API connection. It defines methods for identifying the packet, encoding itself to binary, and decoding itself from binary.