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
- Your machine with the
nfltrCLI, enrolled in your account withnfltr config login. - Your friend's machine with the
nfltrCLI. No account, no login.
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
- Flows. One
nfltr cat forward --udpopens one session to the service and carries every local sender inside it. A flow is one sourceip:portat the listener. On your machine each flow has its own UDP socket, connected to the--forwardaddress. The service sees your machine's address with one port per flow, not your friend's address. Replies go back to the flow's source. - A new source port is a new flow. A sender that changes its source port gets a new flow, and the service sees a new port. The old flow stays open until it is idle. A protocol that identifies a peer by its address and port sees the new flow as a new peer.
- What ends a flow. A flow ends after 60 s with no datagram in either direction at the forward (
--udp-idle). On the serving side it ends after 120 s with no datagram from the friend. The session ends after 5 min with no flows. Stopping either side ends every flow, and so does serving the address with--new-address(flow_closewithreasonresetorrevoked). The next datagram from the same source opens a new flow on a new socket. - Loss and order. Over the relay, datagrams travel inside the session's reliable stream. None is lost on the way and they arrive in order. A lost packet on any TCP hop holds up every datagram behind it until it is resent, as with UDP carried over TCP, so latency rises under loss. On a direct path, datagrams travel as QUIC DATAGRAM frames (RFC 9221). They can be lost or reordered, as UDP can, but they never wait behind a lost packet. No datagram is delivered twice on either path.
- Size. A datagram can be up to 65535 bytes.
--max-datagramsets a lower limit, and a larger datagram is dropped and counted astoo_large. The sender gets no error, as with any UDP loss. IPv4 carries at most 65507 bytes, so the sender's own kernel refuses anything larger (macOS sends at most 9216 bytes by default). On a direct path, a datagram larger than fits in one QUIC packet goes on the reliable stream instead. It is never fragmented. That limit starts at about 1200 bytes and grows once path MTU discovery has run. - Bounds. Each side holds at most 256 flows per session (
--udp-max-flowson the forward). The serving side also holds at most 1024 flows across all sessions of the service, so it never has more than 1024 sockets open for it. A new source past either limit is dropped and counted asflows_full; its next datagram tries again. Each flow queues at most 64 datagrams or 256 KiB in each direction (--udp-queue), the serving side's queue toward the service included. A full queue drops the datagram and counts it, and neither side blocks. - Counters.
--statusservesGET /statusandGET /metricson loopback. The mapping'sdatagramsrow lists open flows, flows opened, datagrams and bytes in each direction, and drops by reason:source_refused,flows_full,queue_full,too_large,budget,target_fullandclosed. The row also countsdirect(datagrams sent on the direct path) andspills(datagrams too large for one direct packet, sent on the session's stream instead).--log-format jsonaddsflow_openandflow_closeevents. The serving side has its own counters:nfltr cat serve --status <endpoint>(orstatus:in annfltr upfile) shows each udp service's open flows across all sessions, the datagrams to and from the service,direct,spillsand its drops by reason.target_fullmeans the service's queue was full, andtoo_largemeans the service's socket refused the size. - One port per service. Each flow's socket is connected to the service's single
host:port, so a datagram from any other port of that host is discarded. Addresses inside the payload are not rewritten. A protocol that negotiates extra ports (SIP with RTP, FTP-style data ports) works only for ports you serve and forward as separate services. Port ranges chosen at run time do not work. Multicast and broadcast (LAN discovery) are not carried.
Next
- Send a folder and pipe a stream: addresses for one transfer.
- Send files and messages:
cat cp,cat pipeand--recvover an address. - SSH to a machine behind NAT: ssh and rsync over an address.