A peer-to-peer group terminal chat that rides on the
rnet WireGuard overlay. Everyone on the
same rnet network runs rchat and talks in one room — no server, no cloud. The
links are already encrypted + authenticated by WireGuard. The UI is a calm
greyscale ratatui with a block-font banner.
- rnet puts every node on
10.42.0.0/24viamynet0(up to 254 peers). rchatreads its own overlay IP frommynet0and the full member list from rnet's~/.config/mynet/peers.toml(falling back to the classic.1/.2pair before that file exists).- Mesh rule: every node listens, and only dials peers with a lower
overlay IP — so each pair forms exactly one TCP connection. A peer is
identified by the overlay IP it declares in its
Hello. - A message is broadcast to all connected peers. Messages are newline-delimited JSON; TCP gives ordering + reliability, WireGuard gives confidentiality.
- New members that join rnet mid-session are picked up automatically — the
dialer re-reads
peers.tomlevery couple of seconds.
cargo build --release # binary at target/release/rchatOn every laptop, after rnet is connected:
rchat # auto-discovers overlay IP + all peers, opens the room
rchat --nick alice # override display name (default: $USER)
rchat --port 8086 # override TCP port (default 8086)
rchat status # print own IP, discovered peers + roles, history pathThe status bar shows the live roster: your name, how many peers are online, and their names. Keys: Enter send · PgUp/PgDn scroll · Esc / Ctrl-C quit.
Appended as JSON Lines under ~/.config/rchat/history/:
group.jsonl— rolling group history (replayed on restart)session-<ts>.jsonl— this run only
Each line: {"ts":…,"iso":"…","dir":"in|out|event","nick":"…","body":"…"}.
src/
├── main.rs # CLI + orchestration
├── config.rs # own overlay IP (mynet0 → local.toml) + peer set (peers.toml)
├── proto.rs # JSON wire protocol (hello{from,nick} / msg / ping / bye)
├── net.rs # full-mesh hub: listener + dialer, per-conn reader/writer, broadcast
├── history.rs # group JSONL logging under ~/.config/rchat
└── ui.rs # greyscale ratatui UI (block banner, roster, chat + input)