| Crates.io | ratel-rust |
| lib.rs | ratel-rust |
| version | 0.1.1 |
| created_at | 2026-01-20 16:10:35.44294+00 |
| updated_at | 2026-01-20 17:22:01.932603+00 |
| description | A Rust implementation of Ratel the landlord game client. |
| homepage | |
| repository | |
| max_upload_size | |
| id | 2056927 |
| size | 73,169 |
A Rust implementation of the Ratel client library, rewritten from Go to Rust with PTY interface support.
cargo run --release --example basic -- <host:port>
Example:
cargo run --release --example basic -- 192.252.182.94:9999
Add this to your Cargo.toml:
[dependencies]
ratel-rust = { path = "/path/to/ratel-rust" }
Basic usage:
use ratel_rust::RatelClient;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Create a new client with address and optional name
let mut client = RatelClient::new(
"127.0.0.1:9999".to_string(),
Some("my_name".to_string())
);
// Start the client (will connect, authenticate, and listen)
client.start().await?;
Ok(())
}
cargo run --example basic
src/lib.rs - Main library entry pointsrc/model.rs - Data models (AuthInfo, Packet, etc.)src/network.rs - Network connections (TCP and WebSocket)src/shell.rs - Shell logic and listenersrc/util.rs - Utility functions (random name generation, etc.)src/pty.rs - PTY interface for terminal I/OThe client automatically detects the network type based on the port:
9998 → WebSocketThe client uses an AuthInfo structure containing:
id: Unique user ID (auto-generated timestamp)name: Username (auto-generated if not provided)score: User score (default: 100)cargo build
cargo test
cargo check
tokio - Async runtimetokio-tungstenite - WebSocket supportserde - Serializationanyhow - Error handlingcrossterm - Terminal handlingpty-process - PTY supportThis project is a Rust port of the original Go Ratel client.