Skip to content

feat: add SOCKS5/Tor proxy support via PROXY_URL#130

Draft
deymosh wants to merge 4 commits into
barrydeen:masterfrom
deymosh:tor-proxy
Draft

feat: add SOCKS5/Tor proxy support via PROXY_URL#130
deymosh wants to merge 4 commits into
barrydeen:masterfrom
deymosh:tor-proxy

Conversation

@deymosh

@deymosh deymosh commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Description

Adds support for routing all outgoing HTTP and relay connections through a SOCKS5/Tor proxy using a new configuration variable.

Changes

  • config.go: Added PROXY_URL configuration parameter, mapped to the PROXY_URL environment variable. Fixes .onion string prefixing logic for relays.
  • main.go: Added createPoolWithProxy to initialize a custom http.DefaultTransport using a SOCKS5 dialer when PROXY_URL is provided.
  • .env.example: Documented the new PROXY_URL variable in the configuration template.
  • Connectivity Check: Added a startup debug helper (testTorConnectivity) that queries the official Tor Project API to verify if traffic is successfully routing through the Tor network.

How to test

  1. Set the environment variable in your .env file: PROXY_URL="127.0.0.1:9050" (or your local Tor socks port).
  2. Start the application.
  3. Check the startup logs to verify the ✅ Successfully verified - traffic is routing through Tor network! message and the exit node IP.

@deymosh deymosh marked this pull request as draft July 10, 2026 22:11
@deymosh deymosh closed this Jul 10, 2026
@deymosh deymosh deleted the tor-proxy branch July 10, 2026 22:22
@deymosh deymosh restored the tor-proxy branch July 10, 2026 23:12
@deymosh deymosh reopened this Jul 11, 2026
@deymosh

deymosh commented Jul 11, 2026

Copy link
Copy Markdown
Contributor Author

The proxy setup only works with the new library fiatjaf.com/nostr@master. The necessary changes have been made, but this would drop support for BadgerDB. If this is still acceptable, the README and the .env.example will need to be updated as well.

Tested connections to import onion relays and blasting to onion relays.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant