main/main.rs
1use anyhow::Result;
2use rcon_rs::{Client, PacketType};
3
4fn main() -> Result<(), ()> {
5 println!("Hello, world!");
6 // create new connect using ip and port
7 let mut conn = Client::new("127.0.0.1", "25575");
8 // you MUST auth the connection before attempting to use it
9 conn.auth("password")?;
10 // send any command you would like, the packet type is option and inferred to be a command by
11 // default
12 conn.send("say hi", Some(PacketType::Cmd))?;
13 println!("done");
14 Ok(())
15}
16