nfltr-pipe: a stream between two machines whose exit code says whether it all arrived

nfltr-pipe is a small open-source command that joins the standard input and output of two machines. One end listens and prints an address; whoever holds the address dials. What one end writes to its standard input the other reads on its standard output, both ways at once. It is github.com/nfltr/pipe, Apache-2.0, with signed binaries for Linux, macOS and Windows on amd64 and arm64 (Install), and the sibling of nfltr-send, which sends files.

Latest release: v0.1.8, 2026-11-22.

Updated 2026-11-22 for v0.1.8: a direct path seals each byte once, and asks for few acknowledgements also on paths that reorder deeply.

src$ tar -C ~/project -cf - . | nfltr-pipe listen
listening; give the other end this address (a secret: whoever holds it can connect):
nf1...
dst$ nfltr-pipe dial --address-file addr | tar -C ~/project -xf -

addr holds the address in a file only its owner can read; dial refuses one that others can read.

The problem

A pipeline across two machines (an archive into an extract, a database dump into a restore, a container image into a loader) needs a path between them when neither accepts inbound connections, privacy from whatever carries the bytes, and an honest end. The last is the one that is easy to get wrong. If a connection that was cut reads as a clean end of file, the restore on the far side commits half a database and the pipeline exits 0. A script that copies a backup this way has to be able to tell a complete copy from a prefix by the exit code alone, without a checksum step of its own.

nfltr-pipe is built around that end. The bytes on the session are exactly the bytes of standard input, with no framing and no encoding, so anything that reads or writes a stream works over it. Each direction ends on its own: when one end's standard input ends, the other end's standard output ends after the last byte, and the other direction goes on. An end exits 0 only once both directions ended and the other side took every byte it sent. Anything else (a read or write error, a signal, a cut session, a peer that vanished) resets the session, and the other end exits non-zero; it never takes a cut stream for a whole one.

How it connects

The session is TLS 1.3 between the two machines, and the address pins the listener's key. Both ends try a direct QUIC path, hole punched with the relay's help, and move the session to it when it works; the relay carries the session until then, and whenever the direct path dies. On a direct path each byte is sealed once, by the QUIC connection's own TLS 1.3, which checks the key the address pins; a relayed path keeps the session's end-to-end TLS, also when a session moves between the two.

when what happens
a direct path forms the two machines talk directly; no account is needed
no direct path, and the listening machine has an nfltr machine certificate the relay carries the session, still end to end encrypted
no direct path and no certificate the dial exits 12

Dialling never needs an account. The relay carries the signalling (the TLS handshake and the direct path's candidates, inside that TLS) and, when it relays, the session's encrypted bytes. It sees the two ends' network addresses, when the session opens and closes, and how many bytes pass; not the address's secret and not a byte of the stream. The address is a capability: whoever holds it can connect, so pass it as you would a password. A listener serves one session; a second dial of the same address is reset.

Ends that tell

Each end runs two copies and nothing else: standard input into the session, and the session into standard output. At standard input's end it half closes the session, as TCP does with FIN. At the other side's half close it closes standard output, so a reader such as tar x sees its end there. When both have ended it closes the session, and that close returns only once the other side acknowledged every byte and the end. Then it exits 0.

A failure resets the session instead, as TCP does with RST, and an end that reads a reset exits 6. A peer that is killed sends nothing: relayed, the relay sees its connection end and cuts the session at once; on a direct path the transport's liveness check cuts it within about 30 s. Memory does not grow with the stream: one 32 KiB buffer per direction, and a write waits for the session's credit, so a slow reader slows the writer at the other end.

The exit codes are the relay SDK's table, the same as nfltr-send's, so a script can branch on them:

exit meaning
0 both directions ended and every byte was taken
3 nothing listens at the address, or it already served its session
5 the relay or the listener was not reached in time: worth a retry
6 the session was cut: whatever arrived is a prefix
12 no direct path to a listener serving with no account

The rest (1 usage, 2 auth, 4 refused, 7 and 10 for a failed end to end check, 9 an exhausted balance) are in the README.

The end is a checked model

The design (who closes what and when, a peer that stops or vanishes, the buffer bounds) is a TLA+ model, Pipe.tla, in the repository's spec/ directory. Its two ends copy over a session with a half close, a reset and a bounded credit, and a fault can kill an end or fail its input or output at any step. TLC checks three properties: an end that exited 0 wrote every byte of the other's input and the other side took every byte of its own (CleanExit); an end reads the other's end only after all its bytes, so a failed end never reads as a finished one (NoFalseEOF); and every end that is not killed exits (Terminates). Four witness properties must be violated, to show that the model reaches the cases that matter (both ends clean, a killed end seen typed, a half close that keeps sending, a reset after data). Six planted mutants must be caught. Two of them are bugs found in the relay client while it was built: a failed end that ended its TLS cleanly, so the other side read an end of file, and a clean close that dropped frames still buffered.

The tests' own session ends are checked against the model too: built with a trace tag, each end writes its steps, and TLC accepts each trace as a behaviour of the model; four planted bad traces must be rejected. That shows that the recorded runs follow the design; it does not prove that every run of the code does.

Evidence: the model check

Setup
Pipe.tla with TLC 1.8.0, two bytes each way, a credit of 2 messages per direction, one fault.
Numbers
909 states, under a second, run with -coverage 1; 4 of 4 witnesses violated; 6 of 6 mutants caught; the trace check accepts the tests' traces and rejects 4 of 4 planted bad ones.
Reproduce
make spec and make spec-traces in a checkout of the pipe repository (they need Java; the Makefile fetches the pinned TLA+ tools).
Limits
small constants: more bytes or more faults are not checked by this configuration. The model abstracts the relay SDK's session to its half close, reset, credit and liveness; link's own models cover those.

Reliability

A rerunnable matrix runs a private relay, a listener and a dialler in their own network namespaces on one Linux machine, netem setting the rate, round trip and loss for the direct and the relayed path alike. Each session is judged by both exit codes against the table above and by what each end's standard output received against what the other end's standard input held: every byte, in order, exactly once; a prefix only when the session was cut; the whole stream whenever an end exits 0. Any defect fails the run.

The matrix holds the layers under nfltr-pipe to four rules, each from a defect it found there, each fixed in those layers rather than worked around in nfltr-pipe:

  1. Bytes the receiving transport acknowledged stay readable after a reset. A direct path's end acknowledges bytes once it holds them, before its reader reads them; a reset right after a clean close does not discard them, so an end never exits 0 while the other holds a short stream.
  2. A reset reaches the peer at once. Reset returns once the peer has it, at most 2 s, so when one end fails the other exits 6 in about a second, not at the liveness bound.
  3. A second dial of an address in use exits 6, the listener's reset, never 10 (a refused secret), whichever reaches the dialler first.
  4. Relayed, an end exits 0 only once the far end has every byte. A relayed close waits for the far end's acknowledgement through the relay, as a direct close does, and gives up when the far end stays silent, so that end exits 6, not 0. The matrix's link drops come at 30 % of a stream, so a focused test holds this one.

Evidence: the reliability matrix, its latest run

Setup
one shared Linux machine (16 CPUs, Linux 6.12, the kernel's default net.core.rmem_max), a private relay (nfltr-relay v2.1.73). Streams of 0 B to 1 GiB one way or both ways; 10, 100 and 1000 Mbit/s at 1, 40 and 150 ms, with and without 1 % loss; the listener or the dialler killed or stopped part way; half closes; a reader that closes early; a slow reader; link drops of 3, 10 and 60 s; the relay killed and restarted; a second dial; no account. Direct and relayed.
Numbers
nfltr-pipe v0.1.8, 2026-11-22 (103 cells, 3 runs each): the run passed, 309 of 309, 0 corrupted (a wrong, duplicated, reordered or extra byte, or exit 0 with a short stream), in 40 minutes.
Reproduce
on a Linux machine with docker, make reliability in a checkout of the pipe repository; its docs/reliability.md has every table and each run's versions.
Limits
one machine and netem between namespaces, not a real network; 3 runs per cell; the latest run is on v0.1.8, and it kept its verdict, not its rates.

nfltr-pipe's rates on v0.1.8 are not measured. It rides the same relay client, link and direct path as nfltr-send, one session per pipe, so a pipe moves like one of nfltr-send's connections; nfltr-send in depth has that command's own numbers.

Examples

Each example in the README runs as written in the repository's tests, both ends on one machine against a relay started in the test. A database dump straight into a restore, with no dump file on either side:

src$ sqlite3 app.db .dump | nfltr-pipe listen
dst$ nfltr-pipe dial --address-file addr | sqlite3 app.db

A container image without a registry:

src$ docker save myapp:1.4 | nfltr-pipe listen
dst$ nfltr-pipe dial --address-file addr | docker load

ssh through a listener in front of the machine's sshd, one ssh session per address; ssh still checks the host key and authenticates as usual:

server$ mkfifo sshd.in; sudo /usr/sbin/sshd -i <sshd.in | nfltr-pipe listen >sshd.in
laptop$ ssh -o ProxyCommand='nfltr-pipe dial --address-file ~/.ssh/server.addr' server

A script that retries when the listener was not reached (5) and discards a copy that was cut (6):

dst$ for try in 1 2 3; do
       nfltr-pipe dial --address-file addr > backup.tar; code=$?
       [ $code -eq 5 ] || break; sleep 10
     done
dst$ case $code in 0) echo complete ;; 6) rm backup.tar; echo cut ;; *) echo "failed: $code" ;; esac

What 1.x keeps

  • The relay you chose. listen uses --relay, else $NFLTR_PIPE_RELAY, else the one nfltr config set-relay saved; dial takes no relay flag, because the address names its relay. --cert-sha256 accepts a private relay's certificate.
  • The address off the command line. dial --address-file reads the address from a file only its owner can read, and dial --address-file - reads it from standard input's first line and pipes the rest. Flags may follow the address.
  • The exit table is nfltr-send's, the relay SDK's. The repository's docs/v1-contract.md lists the whole contract, a test fails when the code and that document differ, and make cross-version runs the previous release against the current one both ways, relayed and direct.
  • The certificate renews itself. A listener renews its machine certificate at half its lifetime and keeps retrying while the relay cannot be reached, past the expiry too (a relay renews an expired certificate within a grace of 90 days), so a listener cut off for a while needs no new nfltr config login. A machine that was off past its certificate's life renews it before connecting, and renewal through a pinned private relay trusts that pin. A listener moves to another relay replica when the relay asks, again if a move failed.
  • The direct path. BBR congestion control, so a long path that reorders packets keeps its rate; a hole punch whose first packet goes once the other end's NAT is open, with up to three attempts; datagrams read and written in batches on Linux; each byte sealed once, by the QUIC connection's TLS 1.3; and an acknowledgement about every 10 packets (QUIC's ACK Frequency), with the receiving end asked not to acknowledge reordered packets at once on a path that reorders deeply. Both ends need v0.1.8 for a direct path: with an earlier release at one end, a listener with an account carries the session relayed, and a dial of a listener with none ends at once with nothing piped.
  • Built on link v0.13.3, the stream multiplexer's API that link 1.0 keeps. 1.0 is tagged with nfltr-send's and link's, when the link's gate holds; the nfltr-send post has the gate and the network-fault runs of the transport both commands share.

Install

Release binaries for Linux, macOS and Windows on amd64 and arm64 are on the releases. Each release carries SHA256SUMS, the SHA-256 of every binary, and SHA256SUMS.sshsig, its signature by nfltr-pipe's own release key in the repository's release/allowed_signers, Ed25519 SHA256:f6CMaXVMYmUA1RGI6EmJ/0SNrAWN8xS7UQgCiXdwkaM. Checking both needs ssh-keygen from OpenSSH 8.1 or later (ssh -V prints the version); its Good "nfltr-release" signature line names the key's fingerprint, which is the one above. The commands take the latest release; download/<version> in place of latest/download takes another.

Linux (on arm64, nfltr-pipe_linux_arm64):

$ f=nfltr-pipe_linux_amd64; u=https://github.com/nfltr/pipe/releases/latest/download
$ for x in $f SHA256SUMS SHA256SUMS.sshsig; do curl -fsSLO $u/$x; done
$ curl -fsSLO https://raw.githubusercontent.com/nfltr/pipe/main/release/allowed_signers
$ ssh-keygen -Y verify -f allowed_signers -I nfltr-release -n nfltr-release -s SHA256SUMS.sshsig < SHA256SUMS
$ grep " $f\$" SHA256SUMS | sha256sum -c && mkdir -p ~/.local/bin && install -m 755 $f ~/.local/bin/nfltr-pipe

macOS (on Intel, nfltr-pipe_darwin_amd64), which checks the sum with shasum:

$ f=nfltr-pipe_darwin_arm64; u=https://github.com/nfltr/pipe/releases/latest/download
$ for x in $f SHA256SUMS SHA256SUMS.sshsig; do curl -fsSLO $u/$x; done
$ curl -fsSLO https://raw.githubusercontent.com/nfltr/pipe/main/release/allowed_signers
$ ssh-keygen -Y verify -f allowed_signers -I nfltr-release -n nfltr-release -s SHA256SUMS.sshsig < SHA256SUMS
$ grep " $f\$" SHA256SUMS | shasum -a 256 -c && mkdir -p ~/.local/bin && install -m 755 $f ~/.local/bin/nfltr-pipe

~/.local/bin is where nfltr's installer puts nfltr; add it to PATH if it is not there yet.

Windows, in PowerShell (on arm64, nfltr-pipe_windows_arm64.exe):

PS> $ProgressPreference = "SilentlyContinue"; $f = "nfltr-pipe_windows_amd64.exe"; $u = "https://github.com/nfltr/pipe/releases/latest/download"
PS> foreach ($x in $f, "SHA256SUMS", "SHA256SUMS.sshsig") { Invoke-WebRequest "$u/$x" -OutFile $x }
PS> Invoke-WebRequest "https://raw.githubusercontent.com/nfltr/pipe/main/release/allowed_signers" -OutFile allowed_signers
PS> cmd /c "ssh-keygen -Y verify -f allowed_signers -I nfltr-release -n nfltr-release -s SHA256SUMS.sshsig < SHA256SUMS"; if ($LASTEXITCODE) { throw "SHA256SUMS is not signed by the release key" }
PS> $sum = (Select-String -Path SHA256SUMS -SimpleMatch " $f").Line.Split(" ")[0]
PS> if ((Get-FileHash $f -Algorithm SHA256).Hash -ne $sum) { throw "$f does not match SHA256SUMS" }
PS> New-Item -ItemType Directory -Force "$HOME\bin" | Out-Null; Move-Item -Force $f "$HOME\bin\nfltr-pipe.exe"

cmd /c hands SHA256SUMS to ssh-keygen byte for byte, which a PowerShell pipe does not; add $HOME\bin to PATH if it is not there yet.

With Go, built from source instead of the signed binary:

$ go install github.com/nfltr/pipe/cmd/nfltr-pipe@latest

No account is needed to dial, or to listen over a direct path. For the relay to carry a session whose direct path does not form, the listening machine needs nfltr and its machine certificate: nfltr config login once, which saves it beside nfltr's config, where nfltr-pipe finds it.

Is it for you?

Fits if you move a stream between two machines, in a pipeline or a script, and need to know from the exit code whether all of it arrived: backups, dumps into restores, images, logs; or want one ssh session to a machine with no open port, without installing anything else on it.

Not ready for more than one session per address (run the listener again for the next one), or a service that many clients reach over time: that is what nfltr's own forwarding is for. Nor for two machines behind NATs that block hole punching when the listener has no nfltr account: the dial exits 12. A killed peer on a direct path is seen only after about 30 s. And 1.0 is not yet tagged.

Try next: install a release binary and check it as Install shows, then copy a directory with tar between two machines and look at both exit codes. If two machines cannot reach each other, try it with an nfltr machine certificate on the listening side (nfltr config login), and if it fails, please open an issue. Issues and pull requests are welcome.

← All posts