Contact one STUN server and one tracker at a time

Both sides used to contact every STUN server and tracker at once, so each of them learned the IP
address and each tracker that A sent to B.

Connections now use one STUN server: the first in the list that reports a public address to a
throwaway probe connection within 2 s. It stays for the page's lifetime. If a connection gets no
address from it, the next connection probes on from the server after it. A probe runs only while a
session waits for it and stops once none does, STUN is turned off or the list changes.

The sender joins the first tracker that accepts it and moves to the next only once that one rejects
it, can't be reached within 10 s or is lost. The receiver walks the list with one offer each and
stays where a tracker reports a seeder (complete), which is the sender: it always announces before
anyone has the code. Trackers it passed keep its offer. backend/tracker.mjs now sends complete.

wss://tracker.pagequit.net comes first in the default trackers, the public ones are fallbacks.
TODO.md drops the server tasks, they aren't work on this codebase.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
SchluffeandClaude Opus 5.5 committed 2026-10-25 18:51:42 +01:00
1 parent 5729ed62f7
commit 840bc3572b
6 files changed
+361 -85

No files matched your search

+1 -17
View File
@@ -1,21 +1,5 @@
# TODO
## Server at pagequit.net
`backend/` holds both servers, tested locally: a real transfer Chromium to Firefox through only them,
and the tracker's limits one by one. Left to do on the server:
- Replace the running coturn with `backend/compose.yaml`. coturn 4.18 has the admin CLI, DTLS, the
RFC 3489 MAPPED-ADDRESS and the software attribute off by default, the `--no-` options for them are
gone. Set `ORIGINS` in `backend/.env`, and `CADDY_NETWORK` if Caddy's network isn't `caddy`.
- Add `tracker.pagequit.net` to Caddy and DNS (A record, like `stun.pagequit.net`).
- Check that the logs hold no client addresses: transfer once, then
`docker compose logs | grep <your IP>` should stay empty.
- Then put `wss://tracker.pagequit.net` first in `DEFAULT_TRACKERS` and keep the public trackers as
fallbacks.
- coturn doesn't rate limit STUN requests. A response is about as big as the request, so it's a weak
amplifier. If it gets abused, an nftables `limit` on the UDP port would help.
## Ideas
- Resume interrupted transfers: the receiver already reports how much the download manager has
@@ -40,6 +24,6 @@ and the tracker's limits one by one. Left to do on the server:
happens again.
- `boundary: chromium sends an empty file` timed out in the first two full runs after `backend/`'s
tests were added (2026-10-25), with empty logs on both sides. It passed alone 8 times, and in 5
tests were added (2026-10-25), with empty logs on both sides. It passed alone 8 times, and in 7
full runs since, one of them with a cold Vite cache. The suite without the new tests passed 4
times. Not reproduced, cause unknown.