Crate mc_rcon

Source
Expand description

This crate provides a client for Minecraft’s RCON protocol as specified at https://wiki.vg/RCON.

Connect to a server with RconClient::connect, log in with RconClient::log_in, and then send your commands RconClient::send_command. For example:

let client = RconClient::connect("localhost:25575")?;
client.log_in("SuperSecurePassword")?;
println!("{}", client.send_command("seed")?);

This example connects to a server running on localhost, with RCON configured on port 25575 (or omitted, as that is the default port) and with password SuperSecurePassword, after which it uses Minecraft’s seed command to query the world’s generation seed.

Assuming that the server is configured accordingly, this program will print a response from the server like Seed: [-1137927873379713691].

Note that, although RCON servers can send multiple response packets, this crate currently does not handle that possibility. If you need that functionality, please open an issue.

Structs§

RconClient
A client that has connected to an RCON server.

Enums§

CommandError
A failed attempt to send a command. See RconClient::send_command for details.
LogInError
A failed attempt to log in. See RconClient::log_in for details.

Constants§

DEFAULT_RCON_PORT
The default port used by Minecraft for RCON.
MAX_INCOMING_PAYLOAD_LEN
The maximum number of payload bytes that an RCON server will send in one packet.
MAX_OUTGOING_PAYLOAD_LEN
The maximum number of payload bytes that an RCON server will accept.