Crates.io | facio |
lib.rs | facio |
version | 0.1.0 |
source | src |
created_at | 2019-05-15 12:13:35.947613 |
updated_at | 2019-05-15 12:13:35.947613 |
description | A RCON library with a higher-level client |
homepage | |
repository | https://github.com/aphorisme/facio |
max_upload_size | |
id | 134452 |
size | 25,720 |
Small RCON client/lib written in rust, providing a RCON packet wrapper and a higher-level RCON client type.
The client API is based on TcpStream
from the standard library. It's main goal
is to provide easy to use functions.
use facio::{raw_packet::*, client::*};
//!
fn main() -> std::io::Result<()> {
// open the rcon connection where `mypass` is the password and
// echoing `echo` is used as the safe/check command (see below).
// The last `None` denotes that the connection attempt has no timeout.
let mut rcon =
RconClient::open("127.0.0.1:38742",
"mypass",
Some("echo"),
None).expect("Cannot open rcon");
//!
// now execute the command `/help`.
if let Some(s) = rcon.exec("/help").ok() {
println!("/help from server:\n{}", s);
} else {
println!("Error?");
}
} // connection is closed here.
This project was basically a small study on how to work with Rust. Future plans
involve making the client API async by using the async/await
language
features, once they are stable.