A synchronous Source RCON library for Rust. This is a personal learning project; primarily tested for Minecraft.
The crate can be used a library in other Rust applications, or as a CLI.
fn main() -> Result<(), rcon::Error> {
let mut conn = rcon::Connection::connect("localhost:25575", "password")?;
let response = conn.exec("list")?;
println!("{response}");
Ok(())
}
The cli
feature flag installs a binary rcon
, which can dispatch one-off
commands or start an interactive RCON terminal.
cargo install -F cli --git https://github.com/lsjoeberg/rcon
Usage: rcon [OPTIONS] -p <PASSWORD> [-- <COMMANDS>...]
Arguments:
[COMMANDS]...
Options:
-H <HOST> Server address [env: RCON_HOST=] [default: localhost]
-P <PORT> Server port [env: RCON_PORT=] [default: 25575]
-p <PASSWORD> RCON password [env: RCON_PASS=]
-t Terminal mode
-h, --help Print help