1 unstable release
Uses new Rust 2024
new 0.1.0 | Apr 16, 2025 |
---|
#60 in #decode
72 downloads per month
16KB
120 lines
rkon
Yet another RCON library.
Features
- No dependencies except for
std
. - Exposes the internal Packet structure, useful for writing a server.
Client
An example client is available under examples/client.rs which uses the Client
type.
Server
Since an RCON server would be tightly integrated with the game server, it doesn't make sense to provide a generic solution. Instead, you can use this crate to encode packets:
// read from client
let mut resp_bytes = [0u8; MAX_PACKET_SIZE];
stream.read(&mut resp_bytes).unwrap();
// decode
let request = Packet::decode(&resp_bytes);
// send response
let response = Packet {
request_id: request.request_id,
PacketType::Command,
body: "foobar"
};
let encoded = response.encode();
// send to the client
stream.write_all(&encoded).unwrap();
Credits
Thanks to the minecraft-client-rs project where some of this code is based off of. I took a different approach for the API, and plan on expanding support beyond just Minecraft.
License
This project is licensed under the GNU General Public License 3.