feat(privacy): route source searches through Tor via TORLINK_TOR#107
Draft
AdinathChaudhari wants to merge 1 commit into
Draft
feat(privacy): route source searches through Tor via TORLINK_TOR#107AdinathChaudhari wants to merge 1 commit into
AdinathChaudhari wants to merge 1 commit into
Conversation
Searching the indexers exposes your IP to each site. Set TORLINK_TOR=1 to send every source fetch through a local Tor SOCKS proxy (127.0.0.1:9050, or socks5h://host:port for another, e.g. Tor Browser's 9150). This hides your IP from the indexers and reaches their .onion mirrors. Scope is search only, and the README/CLI help say so plainly: downloads still connect to the swarm directly, because Tor cannot safely carry BitTorrent (UDP/DHT, no torrent peers of its own). Use a VPN or seedbox for the download side. Design notes, matching the repo's grain: - Single chokepoint: all sources already go through fetchResilient, so a swappable defaultFetch in net.ts routes them all with no per-source change. - Fail closed: once enabled, searches always go through Tor. A proxy that is down makes searches error; a misconfigured TORLINK_TOR exits at startup. Neither ever falls back to a direct, de-anonymising connection. - socks5h (remote DNS): Tor resolves the hostname at the exit, so .onion works and no lookup leaks to the local resolver. - undici + socks were already transitive deps (via webtorrent); this only promotes them to direct deps — no new packages in the tree. Tests cover proxy parsing, install, fail-closed, and the reachability probe. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add an opt-in
TORLINK_TORenv var that routes source searches (scouting) through a local Tor SOCKS proxy. Searching the indexers otherwise exposes your IP to every site; this hides it and reaches their.onionmirrors.Scope: search only (stated plainly in README +
--help)Downloads still connect to the swarm directly — Tor can't safely carry BitTorrent (UDP/DHT, no torrent peers of its own), so anonymising the download side would be a false promise. For that, use a VPN with a kill switch or a seedbox. This PR is deliberately honest about that boundary.
Design — matching the grain
fetchResilient(src/util/net.ts), so a swappabledefaultFetchroutes them all with zero per-source changes.TORLINK_TORexits at startup. Neither ever silently falls back to a direct, de-anonymising connection — that would defeat the entire point.socks5h(remote DNS). Tor resolves the hostname at the exit, so.onionworks and no lookup leaks to the local resolver.undiciandsockswere already transitive deps (via webtorrent); this only promotes them to direct deps (lockfile grows 12 lines).Tests
src/util/proxy.test.tscovers env parsing, proxy-URL parsing, install, the fail-closed misconfig path, and the reachability probe. Full suite green (277 tests),typecheckclean,buildclean.Not covered here
torbinary present). The SOCKS→undici path uses the standardsocks+buildConnectorpattern; I'd appreciate a maintainer smoke-test with a real Tor daemon.🤖 Generated with Claude Code