Skip to content

v0.5.0

Choose a tag to compare

@richlegrand richlegrand released this 29 Aug 00:33
· 46 commits to main since this release

bitbang serve now takes words for what it serves, access links let one URL
reach less than the next, and there are Windows and macOS binaries for the
first time.

Upgrading from 0.4.7 means changing your command line -- see Breaking
changes
below.

Access links

A listener can hand out URLs that reach less than it does, each with its own
expiry, each revocable on its own. The terms live in ~/.bitbang/<program>/links.json:

[
  {"label": "ana", "grant": "files", "expires": "2026-09-01T00:00:00Z"},
  {"label": "ben", "grant": "files /srv/photos"},
  {"label": "dev", "grant": "shell forward 127.0.0.1:5432"}
]

A grant is written in the same words serve takes, and can only narrow what
the listener already serves -- so a link is not limited to picking
capabilities. It can name a subdirectory of the share, a subset of the forward
targets, or a single command for the shell.

Revocation and expiry reach sessions that are already open: the connection
closes and the holder is told why. An expired code is retired rather than
paused, so renewing mints a new one and the URL you already sent stays dead.

bitbang link ls|edit|rm|qr manages the table from outside. Pressing Enter at
a running listener opens a console that does the same thing live, mints links
with add, and walks you through a grant a question at a time.

Capability words

serve names what it offers instead of carrying a flag per mode:

bitbang serve                                    everything
bitbang serve shell files ~/share
bitbang serve proxy nas.lan:8096,pi.lan:80
bitbang serve forward 127.0.0.1:22 files ~/pub

One rule holds it together: a positional says what is served, a flag says
how. proxy a:80 and files /srv are what; -files-upload and
-proxy-client-ip are how. A target therefore has exactly one spelling, and no
flag repeats it.

Naming targets restricts them. serve proxy nas.lan:8096 reaches that and
nothing else, and the browser's address box is disabled rather than offering a
box whose answers get refused.

TCP forwarding

connect -L forwards a local port to any host the listener can reach, the way
ssh spells it:

bitbang serve forward 127.0.0.1:22
bitbang connect <url> -L 2222:127.0.0.1:22
ssh -p 2222 you@localhost

forward is its own capability, so a listener can be a wire and nothing else
-- there is no shell to escalate to. Naming targets restricts what it will
dial, and a link can narrow that further.

Terminal sharing

bitbang share publishes the tmux session you are in as a pair of URLs, one
that can type and one that can only watch. Needs tmux, so Linux and macOS;
Windows can open share URLs but not host one.

Also

  • Bring your own TURN. -ice-servers points the listener at your own relay,
    and the server hands it to whoever connects, so ours is never involved.
  • Windows and macOS binaries. Previously Linux only. Windows shells run on
    ConPTY.
  • A pinned command is pinned. serve shell /bin/login runs that and refuses
    a connector asking for something else, so it works as a second factor.
  • Head-of-line latency. The send queue was allowed to grow to 8MB, which is
    standing delay for everything sharing the channel. Bounded at 1MB: a ping
    during a bulk transfer went from ~70ms to ~8ms.
  • connect -nosave leaves nothing in the device table. connect -norelay
    refuses STUN/TURN so a connection fails rather than quietly relaying, and
    -v now says which path it got.
  • An ephemeral listener marks its URLs, so connectors do not save a credential
    for an identity that disappears when it exits.
  • A listener says out loud when a URL reaches more than it looks like: a shell,
    or forwarding with no targets named.

Breaking changes

0.4.7 0.5.0
bitbang shell, bitbang files, bitbang proxy bitbang serve shell, serve files, serve proxy
-shell-cmd "CMD" the argument to shell, quoted if more than one word
-shell-mirror=false -disable-shell-mirror
-target HOST:PORT the argument to proxy
-files PATH the argument to files
-forward-client-ip -proxy-client-ip

A removed flag is an error, not a setting that quietly does nothing, so an old
command line fails at startup rather than serving something you did not ask
for.

Two behavior changes worth naming. A command after shell used to be a
default that a connector could replace by passing its own argv; it is a pin
now, with no flag to enable. And a command of more than one word must be
quoted -- serve shell "tmux attach" -- because every word takes exactly one
argument.

Identities and devices.json from 0.4.7 carry over unchanged.