Give a Friend an Address

An nf1… address opens one service of your machine to whoever holds it, with no account on their side. The session is end to end encrypted: the relay sees neither the address's secret nor the bytes.


Goal

A friend opens a web app on your machine's port 8080 from their own laptop, without an nfltr account.

Prerequisites

1. A service on your machine

Use your own service. This tutorial serves one page on port 8080:

$ echo 'hello, friend' > index.html
$ python3 -u -m http.server 8080
Serving HTTP on :: port 8080 (http://[::]:8080/) ...

2. Serve it under an address

In a second terminal, serve port 8080 as the service web under an address, written to a file only you can read:

$ nfltr cat serve web --forward localhost:8080 --address --address-file friend.addr
Address of you/web written to friend.addr (mode 0600; anyone who has it can open the service; keep it secret)

The address is never printed, so it stays out of terminal scrollback and logs. It is a password for this one service: send the file over a channel you trust (a password manager's share, an encrypted message). The same address comes back each time you serve web again.

One agent name (by default this machine's) serves one nfltr cat serve process at a time: a second service served from the same machine in another terminal takes its own name, --agent <name>, or both run from one process with nfltr up -c FILE.

3. Your friend connects

Your friend saves the address in a file only they can read (chmod 600 friend.addr) and opens a local port to the service:

$ nfltr cat forward --address-file friend.addr --listen 127.0.0.1:18080
connect forward: listening -> nf1:14efa3ee@nfltr.xyz on 127.0.0.1:18080
$ curl -s http://127.0.0.1:18080/
hello, friend

The two machines take a direct path between them when their networks allow it; otherwise the relay carries the session, still end to end encrypted, and sessions count against your account. An address on the command line is refused: other users of a machine can read a command line.

Each connection to the local port is one session, and the relay caps sessions: on nfltr.xyz one friend's network opens at most 64 at once (10 more a second) and holds at most 64, and one address holds at most 128 across all its friends (20 new ones a second). A browser's 6 connections at once fit. A connection beyond a cap is closed at once (nfltr cat pipe exits 4, refused); a later one gets in once the rate has refilled and fewer than the cap are open.

The relayed sessions of an address are billed to your account, whoever opens them, so each address has a daily cap on what the relay carries for them: 4 GiB a UTC day unless you set another with --relay-cap (for example --relay-cap 500MB). Bytes on a direct path do not count. At the cap a new session is refused and an open relayed one is cut (nfltr cat pipe exits 4, refused) until 00:00 UTC; a new address (--new-address) starts at zero. A leaked address costs you at most its cap a day.

4. Revoke it

Stop nfltr cat serve (Ctrl+C) and the address reaches nothing. To revoke it for good, serve the service with --new-address: the old address stops working at once, and the file holds the new one, for whoever you give it to next.

# Ctrl+C in the nfltr cat forward terminal
# Ctrl+C in the nfltr cat serve terminal
$ nfltr cat serve web --forward localhost:8080 --address --new-address --address-file friend.addr
Address of you/web written to friend.addr (mode 0600; anyone who has it can open the service; keep it secret)

UDP services

An address can serve a UDP port, such as a DNS resolver or a game server. --udp goes on both sides, and the friend's end is a datagram listener:

$ nfltr cat serve dns --udp --forward 127.0.0.1:53 --address --address-file dns.addr
$ nfltr cat forward --udp --address-file dns.addr --listen udp:127.0.0.1:5353 --status 127.0.0.1:7801

Next