Skip to main content

Crate koh

Crate koh 

Source
Expand description

The library behind the koh remote shell: koh serve hosts PTYs for allowlisted peers and koh connect relays one to the user’s terminal with predictive local echo, reconnecting transparently; koh exec runs a command there, koh run a job that outlives the connection, and koh cp brings files into line.

transport_iroh sets up endpoints; identity loads the keys; keycmd is koh id and koh key reset; names names the servers and clients a machine knows. request is what a connection opens with, proto a shell’s wire protocol, stream what of a program’s output reaches the user’s terminal, events the input it carries, sync a copy’s; terminal, predict and pty the server’s emulator, the prediction and the PTY; server hosts sessions, commands and jobs and client drives them. bounded holds every queue.

Production code is panic-free by construction: Cargo.toml forbids the panic lints, lossy casts and unchecked arithmetic, and a forbid cannot be lifted locally. Tests may panic.

The library exists so the binary, tests and fuzz targets share code; all of it is internal.

Modules§

bounded
Containers of at most a fixed number of items, so nothing a peer or a program does grows one without limit.
client
The koh client: koh connect’s loop, and the commands that dial a server (cli).
events
Input as the client decoded it, on the wire, and what the user’s terminal said of its colours.
identity
Identities: a machine’s client and server keys, each in a KeyFile.
keycmd
koh id and koh key reset: print or delete an on-disk identity key.
log
What koh writes outside the session, its stderr and its log, through one sink.
menu
The menu koh alone opens on a terminal: this machine’s keys, the servers it connects to and the clients allowed here, by name, and what can be done with each.
names
Names for endpoint ids, kept beside the keys.
predict
Local-echo prediction: the client guesses what each keystroke does to the screen and shows it at once, then confirms or corrects it when the server’s frame arrives.
proto
The koh/17 shell protocol: what a session’s connection carries after its opening request (crate::request).
pty
PTYs: start the session’s program on one, pump its output and input, resize it, reap it.
request
What a connection is for: the opening request the client makes on its first stream, and the server’s answers to it.
server
The koh server.
stream
What of a program’s output reaches the user’s terminal: all of it but the questions the server answers and the shell’s marks, which travel apart (Piece::Mark).
sync
koh cp: files and trees brought into line from one end to the other, the same whichever end is the server.
terminal
The server’s terminal.
transport_iroh
The iroh glue: endpoint setup, the identity key’s default path, dial addresses and a connection’s path RTT.