Forwards and exec.
Besides terminals, an osewa connection carries port forwards and commands. Each gets its own QUIC stream, so a big transfer never stalls your typing in another window.
Port forwarding
osewa forward works like ssh -L: it listens on a local port and carries each connection to a target the host can reach.
osewa forward devbox 3000 # localhost:3000 -> the host's localhost:3000
osewa forward devbox 8080:localhost:3000 # localhost:8080 -> the host's localhost:3000
osewa forward devbox 5432:db.internal:5432 # a database the host can reach
osewa forward devbox 0.0.0.0:3000:localhost:3000 # listen on every interface here
osewa forward devbox 3000 5173 9229 # several at onceEach forward is [bind:]port[:host:hostport]. Two numbers alone, like 8080:3000, read as a bind address and a port, so write the target host when the ports differ:
- bind is the local address to listen on. It defaults to
127.0.0.1, so only this machine can use the forward. - host:hostport is where the host connects. It defaults to
localhoston the host, at the same port. - Write IPv6 addresses in brackets:
[::1]:3000.
It prints a line per forward and runs until you press Ctrl-C:
forwarding 127.0.0.1:3000 -> localhost:3000 on devboxLike attach, forward survives network changes: it redials and keeps listening. A transfer that was open when the network dropped may need to be retried by the program using it.
Running commands
osewa exec runs a command on the host without a terminal. stdin, stdout and stderr pass through, so it works in pipes and scripts.
osewa exec devbox -- make test
osewa exec --cwd /srv/app devbox -- git status
osewa exec --env RUST_LOG=debug devbox -- cargo run
tar cz src | osewa exec devbox -- tar xz -C /tmp/copy- The command runs directly, not through a shell, so
*,|and$VARare not expanded on the host. For those, run a shell:osewa exec devbox -- sh -c 'ls *.log | wc -l'. - It starts in your home directory, with the same clean environment as a new session.
--cwdand--env K=V(repeatable) change that. - The exit code is the command's own, or 128 plus the signal number if a signal ended it. Interrupting osewa exits 130; an error in osewa itself exits 1.
When the host refuses
A host's server can turn these off with --no-forward and --no-exec (see server flags). Then you get:
the host's server doesn't allow forwarding (--no-forward)
osewa: bad_request: the server does not offer execosewa update uses exec, so it can't update a host whose server runs with --no-exec.