SSH hub to pass on connection to other ssh games.
ssh frittura.org
The repo is a workspace with two crates: frittura-ssh-hub (the lobby binary) and frittura-tui-serve (the SSH/ratatui scaffolding I use across my games as a library). Add the core crate to your Cargo.toml:
frittura-tui-serve = { git = "https://github.com/ricott1/frittura-ssh" }and implement the TerminalGame trait:
use frittura_tui_serve::{run_server, ClientSession, ClientWriter, Credential, TerminalGame};
struct MyGame { /* ... */ }
impl TerminalGame for MyGame {
type Auth = ();
const SCREEN_SIZE: (u16, u16) = (160, 50);
const TITLE: &'static str = "My Game";
const SERVER_INACTIVITY: Duration = Duration::from_secs(3600);
async fn authenticate(&self, _: &str, _: Credential) -> anyhow::Result<()> {
Ok(())
}
async fn on_session<W: ClientWriter>(self: Arc<Self>, session: ClientSession<(), W>) {
// drive a ratatui Tui on `session.writer`, consume `session.data_rx`...
}
}See stonks for a real example with credential-based save lookup.
GPLv3.