Skip to main content

transmission-announce-relay

A small local relay that makes Transmission's tracker announces survive a hostile network path. It runs on the same host as Transmission, listens on loopback, and forwards each announce to the real tracker over a fresh, certificate-verified HTTPS connection, hedging stalled connections and retrying once — all inside the 45 seconds Transmission gives an announce.

Peer traffic is not touched. Nothing is tunnelled. Your public IP does not change. The relay only makes the tiny HTTP requests that tell a tracker "I am still seeding" reliable again.

Two pieces, deliberately separate:

  • transmission-announce-relay — the daemon (a loopback HTTP server).
  • tar-ctl — a control CLI that lists your torrents, points the matching tracker URLs at the relay (by tracker host, regex, name, status, ids — or all), and puts the originals back.

Standard library only, Python 3.8+. No dependencies.

Why this exists: Russian throttling of Cloudflare-fronted sites

In June 2025 Cloudflare published Russian internet users are unable to access the open internet. According to that report, since 9 June 2025 Russian ISPs — which Cloudflare attributes to direction from the regulator, Roskomnadzor (RKN) — have been throttling and partially blocking traffic to websites served through Cloudflare: connections that are cut off after the first ~16 KB, packets that are silently dropped, and connections that simply time out. Cloudflare's description is of interference on the Russian side of the path, not a Cloudflare ban on Russian users. This project takes that report as context; it has not independently verified the mechanism.

Many private BitTorrent trackers sit behind Cloudflare. For a BitTorrent client the effect looks like this:

  • Announces (GET https://tracker.example.org/.../announce?...) sometimes get no reply at all: the TCP connection is up, the request is sent, and nothing comes back. Other announces on a fresh connection succeed immediately.
  • Transmission talks to trackers through libcurl with connection reuse and HTTP/2. A connection that has gone silent stays in the pool, so a whole batch of announces can fail on it before it is discarded.
  • Every failed announce makes Transmission back off: 20 s, then roughly 5, 15 and 30 minutes. Hours of seeding go unreported. Private trackers then see you as not seeding and hand out hit-and-run warnings, even though the data was available the whole time.

The relay attacks exactly that failure mode. It does not know or care what the filtering mechanism is; it just refuses to wait on a connection that has gone quiet.

If you are not on a throttled path, you do not need this. It is not a way to hide traffic, evade a ban, or reach a tracker your account cannot reach.

How it works

Transmission ──HTTP──▶ 127.0.0.1:19053/r/<route>/announce?…
                            │  paced scheduler (one announce start per 3 s per route)
                            │  fresh TLS connection, HTTP/1.1, Connection: close
                            │  no headers after 3 s?  → open a second socket, first to answer wins
                            │  5xx / stall on both?   → one requeue after 10 s (Retry-After honoured ≤10 s)
                            ▼
                    https://tracker.example.org:8443/<passkey>/announce?…   (bytes forwarded unchanged)
  • Named routes. The relay config maps a route name to the real announce URL, passkey included. Transmission's tracker list only ever contains http://127.0.0.1:19053/r/example/announce. Your passkey never appears in Transmission's settings, logs or UI again.
  • Byte-for-byte forwarding. The query string is passed through untouched (binary info_hash and peer_id are not re-encoded), the response body and Retry-After headers come back unchanged. The tracker sees a normal Transmission announce with Transmission's User-Agent.
  • Hard deadline. Every announce is finished or failed about 40 s after arrival at the latest (queue wait, hedge, requeue delay and second attempt included; the scheduler polls every 250 ms and the caller is released within one further second), so Transmission never waits past its own 45 s timeout for us.
  • Never retries a verdict. Tracker rejections (failure reason), 4xx responses (except a 429 carrying a short Retry-After), redirects and malformed bodies are returned as-is; redirects are not followed. Transport failures — timeouts, resets, TLS/certificate errors — become a relay 502 after the (single) requeue policy above has run out; certificate errors are never retried. Ambient http_proxy/https_proxy are ignored. TLS is always verified against the system trust store.
  • Exact duplicates share one upstream request while it is in flight; nothing is cached afterwards.
  • Backpressure, not buffering. Per route: at most 64 announces waiting or in flight (then an immediate 503), and an announce that could not even start within about 20 s is dropped with 503. So: 503 means the relay did not try, 502 means the relay tried and the upstream failed. Transmission retries both on its own schedule.
  • Nothing sensitive is logged. Request logs contain the route name, event type (started/stopped/completed/update), outcome, timings and counters — never URLs, query strings, hashes or peer ids.

Install

pipx install transmission-announce-relay      # or: pip install --user .

Quick start

  1. Write the relay config, keep it private (it holds your passkey):

    mkdir -p ~/.config/transmission-announce-relay
    cat > ~/.config/transmission-announce-relay/relay.json <<'EOF'
    {
      "listen": {"host": "127.0.0.1", "port": 19053},
      "routes": {
        "example": {"upstream": "https://tracker.example.org:8443/YOUR_PASSKEY/announce"}
      }
    }
    EOF
    chmod 600 ~/.config/transmission-announce-relay/relay.json
    transmission-announce-relay --config ~/.config/transmission-announce-relay/relay.json --check
    
  2. Run the relay (see examples/systemd/ for a user unit with Restart=always; examples/docker-compose.yml for containers):

    transmission-announce-relay --config ~/.config/transmission-announce-relay/relay.json --json
    
  3. Look at what would change, then apply:

    tar-ctl list --tracker-host tracker.example.org
    tar-ctl route --route example --tracker-host tracker.example.org            # dry run
    tar-ctl route --route example --tracker-host tracker.example.org --apply    # 5 s between torrents
    tar-ctl status
    
  4. To undo, at any time, relay running or not:

    tar-ctl restore --all          # dry run
    tar-ctl restore --all --apply
    

tar-ctl talks to Transmission's RPC (--rpc-url, --rpc-user, --rpc-password, or TR_RPC_URL / TR_RPC_USER / TR_RPC_PASSWORD). Default: http://127.0.0.1:9091/transmission/rpc.

tar-ctl reference

Selectors, usable on list, route and restore (combine freely):

flag meaning
--tracker-host HOST torrents with a tracker on this host (and, for route, the lines to replace)
--tracker-regex RE regular expression over tracker URLs
--name-regex RE regular expression over torrent names
--status paused|seeding|downloading|active|queued Transmission state
--ids 1,2,3 Transmission ids
--all everything (with the other filters)

route and restore are dry runs unless --apply is given, and require a selector. route replaces only the tracker lines that match; other trackers and tiers in a multi-tracker torrent are preserved byte-for-byte. Originals are written to a private state file (~/.local/state/transmission-announce-relay/routes.json, mode 600) before Transmission is changed, so restore can put back exactly what was there. restore refuses a torrent whose tracker list changed since routing unless --force.

prune forgets state entries whose torrent is no longer in Transmission (deleted or trumped by the tracker, manual cleanup). Like route and restore it is a dry run unless --apply is given; it never touches Transmission. status reports such entries as missing_from_transmission, so routed_in_state > present is never ambiguous: a torrent that is present but failing shows up in present and not in latest_announce_ok.

tar-ctl prune            # dry run: lists what would be forgotten
tar-ctl prune --apply

--pace SECONDS (default 5) spaces out changes. --reannounce asks Transmission for an announce after each change; without it Transmission re-announces on its own schedule, which usually is what you want.

Output modes: human (default), --agent (deterministic tab-separated), --json. AGENT_SESSION=1 in the environment selects agent mode.

Relay config reference

{
  "listen": {"host": "127.0.0.1", "port": 19053},
  "routes": {
    "name": {
      "upstream": "https://host[:port]/path/announce",
      "info_hashes": ["<40 hex chars>", "..."]
    }
  }
}
  • listen.host must be 127.0.0.1 (or localhost); the relay carries passkeys on behalf of a local client and is not a general proxy. Default 127.0.0.1:19053. IPv6 loopback is not supported.
  • routes.<name>.upstream must be a clean https:// URL (no query, fragment or credentials). One route per tracker; each route has its own scheduler.
  • routes.<name>.info_hashes (optional) restricts the route to listed torrents.
  • Scrape: /r/<name>/scrape is mapped when the upstream path contains announce (the usual .../announce → .../scrape convention). Set "scrape": false on a route to answer scrapes with 404 locally — useful when the tracker does not implement scrape, since Transmission scrapes every routed torrent and each scrape would otherwise take an announce slot. Announces are always started before waiting scrapes.
  • GET /healthz returns status and counters per route (queue depth, in-flight, hedges, hedge wins, requeues, transport and HTTP errors, expired announces) plus each route's upstream hostname — but no paths, passkeys, query strings or hashes. It is reachable by any local process, like the relay itself.

Upstream TLS compatibility

By default the daemon leaves TLS version negotiation to Python/OpenSSL and the system policy. Some network paths allow TCP connections but stall TLS 1.3 handshakes consistently; opening fresh or hedged connections cannot fix a protocol-specific stall. If verified TLS 1.2 connections succeed on the same path, opt into an upstream ceiling:

transmission-announce-relay --config ~/.config/transmission-announce-relay/relay.json \
  --tls-max-version 1.2 --check --json
transmission-announce-relay --config ~/.config/transmission-announce-relay/relay.json \
  --tls-max-version 1.2 --json

--tls-max-version accepts 1.2 or 1.3 and applies to all routes in that relay process, not Transmission's peer connections or other applications. It is a maximum, not a request to force an exact version: the system minimum and any stricter system maximum remain in effect. A ceiling below the system minimum is rejected. Certificate and hostname verification stay enabled; there is no insecure fallback or automatic downgrade on failure.

--check validates the configuration and TLS policy without binding a port or contacting a tracker. The machine-readable config_ok/ready output and /healthz field upstream_tls_max_version report the requested ceiling (null when omitted), not a measured negotiated version.

Diagnose before changing the ceiling

A relay 502 with logged network_error / TimeoutError means the upstream request failed; it is not itself a tracker rejection or proof of an account problem. Compare both TLS versions from the machine running the relay, using your tracker hostname in place of tracker.example.org:

curl -vI --connect-timeout 8 --max-time 12 --tlsv1.3 --tls-max 1.3 \
  https://tracker.example.org/
curl -vI --connect-timeout 8 --max-time 12 --tlsv1.2 --tls-max 1.2 \
  https://tracker.example.org/

Use a curl build that supports both protocols. --tlsv1.2 alone sets a minimum and can still negotiate TLS 1.3; the matching --tls-max matters. Do not add -k or disable verification. These probes check TLS connectivity, not a real announce: tracker roots can return errors even when the real announce endpoint works. Do not put passkey-containing URLs in shared logs. A successful --check is likewise not proof of upstream reachability.

Apply to a systemd user service

For the bundled example unit, use systemctl --user edit transmission-announce-relay and add:

[Service]
ExecStart=
ExecStart=%h/.local/bin/transmission-announce-relay --config %h/.config/transmission-announce-relay/relay.json --json --tls-max-version 1.2

If your installation uses a different launcher, config path or extra flags, retain those values; inspect systemctl --user cat transmission-announce-relay first. Then reload and restart only the relay, not Transmission:

systemctl --user daemon-reload
systemctl --user restart transmission-announce-relay
curl -fsS http://127.0.0.1:19053/healthz

Adjust the health port if configured differently. Confirm the requested ceiling in health output, then watch normal announces recover in Transmission or with tar-ctl status. A relay restart does not clear Transmission's existing retry backoff, so recovery may take hours after a prolonged outage. Avoid forcing a burst of announces just to clear the display.

To undo, remove only --tls-max-version 1.2 from your service command, preserving other overrides, then reload and restart the relay again. Prefer the default unless you have verified a protocol-specific connectivity problem.

Operational notes

  • Which torrents to route. Any torrent whose tracker is on the affected path. tar-ctl route --tracker-host … handles hundreds of torrents in one paced run; a relay restart while torrents are routed only fails the announces in flight. Transmission retries on its own schedule; existing failure backoff is not reset by restarting the relay.
  • Capacity. One announce start per 3 s per route is ~1,200/hour, plenty for several hundred torrents at a typical 30–45 minute interval. Bursts (starting many torrents at once, or many torrents retrying rejections every 20 s) can exceed it; the relay then answers 503 early rather than queueing for minutes, and Transmission's own backoff spreads the load.
  • Retired torrents. Trackers answer deleted/trumped torrents with a failure reason; the relay passes that through unchanged and never retries it. Such torrents keep re-announcing on Transmission's failure backoff; pause or remove them. After removing routed torrents, tar-ctl prune --apply drops their leftover state entries.
  • Restart safety. tar-ctl restore needs only Transmission, not the relay. If the relay is unreachable, routed torrents simply fail their announces until it is back or they are restored.
  • Containers. Transmission announces to 127.0.0.1, so the relay must share its network namespace (network_mode: host for both, or network_mode: "service:transmission" for the relay).

What it does not do

  • It is not a VPN or SOCKS/HTTP proxy and does not carry peer connections.
  • It does not spoof, rewrite or add anything to the announce; the tracker sees your client, your IP and your stats.
  • It does not bypass tracker-side restrictions (revoked download rights, hit-and-run limits, unregistered torrents). It only makes sure your announces arrive.
  • It does not prove what the network is doing; it just stops waiting on connections that have gone quiet.

Development

python -m unittest discover -s tests -v

Tests use fake upstream sockets, a fake Transmission, and loopback HTTP servers; no external network is contacted. TLS policy tests also perform real in-memory handshakes using ssl.MemoryBIO; they generate a temporary certificate with the openssl executable and are skipped if it is unavailable. The dispatcher's timing constants are patched down so the suite runs in seconds.

License

MIT.

Metadata

Release files for transmission-announce-relay 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for transmission-announce-relay 0.1.4
File Size Uploaded Provenance Actions
transmission_announce_relay-0.1.4.tar.gz 45.4 kB With provenance Details for transmission_announce_relay-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for transmission-announce-relay 0.1.4
File Interpreter ABI Platform Actions
transmission_announce_relay-0.1.4-py3-none-any.whl Python 3 none any Details for transmission_announce_relay-0.1.4-py3-none-any.whl

Total release size: 76.1 kB

Release files / transmission_announce_relay-0.1.4.tar.gz

Download URL transmission_announce_relay-0.1.4.tar.gz
Size 45.4 kB
Tags Source
SHA-256 checksum
How to use checksums
92c24cb82f12f18512ec7e493a8d64d349f1db4a5b218a4da5191ba5eb10e885
BLAKE2b-256 checksum
How to use checksums
9114627b63bcab7e188d635e378ab3cedbd50e05c718f79a157830ade76819b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

Release files / transmission_announce_relay-0.1.4-py3-none-any.whl

Download URL transmission_announce_relay-0.1.4-py3-none-any.whl
Size 30.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b010e484fbf1f939ef658250b2a10b209f18e5a83540a99479a683a6cec0327e
BLAKE2b-256 checksum
How to use checksums
da34376ee47baf29e12b2a286d76c15d18bc54a584fa9249772053d575c8158d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

Security for transmission-announce-relay 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for transmission_announce_relay-0.1.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page