# TODO ## Server at pagequit.net, to decide ### Review of the coturn setup (STUN only, host network) - Good as it is: `stun-only`, `no-tcp`, `no-tls`, `no-software-attribute`, CPU, memory and process limits with swap off, and log rotation. Host networking is right for STUN, so Docker's NAT can't change the source address the clients get back. Listening on IPv4 only matches DNS: `stun.pagequit.net` has an A record and no AAAA. - `coturn/coturn:latest` is the only unpinned version. Pin `coturn/coturn:4.18.0` (2026-09-08). - Add `no-cli`. On the host network, coturn's admin CLI would otherwise listen on the host's 127.0.0.1:5766 if it's enabled. - Add `no-stun-backward-compatibility`. Browsers only use the current STUN protocol, so the old RFC 3489 requests and their extra MAPPED-ADDRESS can go, which also makes responses smaller for reflection attacks. - Check that the logs hold no client addresses: send a STUN request, then `docker compose logs coturn | grep `. Logging each request is off by default and `log-binding` turns it on, so it should stay empty. Otherwise up to 20 MB of addresses stay around. - Missing compared to the tracker draft: `cap_drop: [ALL]` and `security_opt: [no-new-privileges:true]`. `read_only: true` is worth trying too, but coturn may need a writable `/var/run` or `/var/lib/coturn` (`tmpfs`). - 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. ### Compared to the plan so far - Caddy and coturn don't share a Docker network, coturn runs on the host network. The tracker joins Caddy's network (its name is in Caddy's compose file), coturn stays as it is. - Copy coturn's limits to the tracker, with smaller values: `cpus`, `mem_limit` equal to `memswap_limit`, `pids_limit`, and the same `json-file` log rotation. - Pin every version, coturn and the tracker alike. ### Decisions 1. **Which tracker.** Stock `bittorrent-tracker@11.2.3` behind Caddy works: tested locally with a real transfer from Chromium to Firefox, and it logs nothing with `--quiet`. A review found it too open to run unchanged: - it forwards any data and accepts messages up to 100 MiB - `scrape` lists all swarms even with `--no-stats` - it has no rate, byte or connection limits - it accepts any Origin The recommendation is an own tracker for the WebTorrent subset HellCon uses, so the client stays unchanged and the public trackers keep working as fallbacks. Node 26 and `ws`, one file of about 250 lines, enforcing: - an Origin allowlist and messages of at most 16 KiB - only `announce`, one offer per announce, and answers only to offers it delivered, once - per connection: a message rate, about 64 KiB of forwarded data, and at most 7 minutes - connections per IP (from `X-Forwarded-For`), total connections and peers per swarm capped - empty swarms removed, nothing logged Then decide where it lives: `tracker/` in this repo (new files, every fork gets it) or a separate repository. 2. **After deploying:** put `wss://tracker.pagequit.net` first in `DEFAULT_TRACKERS` and keep the public trackers as fallbacks. ## Ideas - Resume interrupted transfers: the receiver already reports how much the download manager has read (`{ read }`), which is where a new connection could continue. The browser can't append to a finished or failed download though, so a resume would have to start a new one. ## Open observations - Firefox ignores an errored service worker response stream: when the sender vanishes, the receiver logs "download failed: connection lost", but the download stays "in progress" until the user cancels it. Closing the stream instead is worse, Firefox then reports the truncated file as complete despite `Content-Length`. Chromium fails the download, but only once the connection counts as failed (~16 s), because its data channel never fires `close` for a vanished peer. - Firefox also saves a truncated file as complete when it stops the service worker in the middle of a download (after 30 s without events). The receiver's pings (`KEEPALIVE`) prevent that, covered by `large: firefox survives a 40 s stall`. A browser that stops it anyway would still never show "download complete" or "delivered", only its download manager would be wrong. - `large: firefox sends 2.5 GiB` hit the 5 minute timeout once (first run after the normal suite), not reproduced in 3 runs since. The report was lost; the attached logs will show the cause if it happens again.