Documentation
¶
Overview ¶
Remote console client used to interact with Minecraft servers, the byte order for minecraft rcon is little endian and the packet structure is defined as follows:
[Length] length of packet: int32 [RequestID] client set id for each request used to track responses: int32 [Type] request packet type: int32 [Body] body of request/response: Null-terminated ASCII String [Padding] body must be terminated by two null bytes
DISCLAIMER This code has not been tested with commands that return data exceeding 4096 bytes and may not work.
Index ¶
Constants ¶
const ( //type value for failed authentication requests FailureType = int32(-1) //type value for command requests CommandType //2 //type value for authentication requests AuthenticationType //3 //tcp constants Protocol = "tcp" Timeout = time.Second * 10 //request id reset value ResetID = 1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
minecraft remote console client
func NewClient ¶
creates and returns a new remote console client using the supplied address (addr). The Connect method must be called before the client can be used to send commands
func (*Client) Close ¶
closes remote console connection and resets the request id. The remote console client can be reused by calling the Connect method again
func (*Client) Command ¶
sends a command to the minecraft server and returns the server response, an error is returned if the client has not connected to the server before attempting to send a command. Command examples can be found on the minecraft wiki: https://minecraft.wiki/w/Commands