core-geth icon indicating copy to clipboard operation
core-geth copied to clipboard

p2p: add --use-proxy flag for SOCKS5 proxy support

Open cloorc opened this issue 1 month ago • 0 comments

Add support for routing P2P connections through a SOCKS5 proxy specified via ALL_PROXY or all_proxy environment variables. This enables nodes to connect to peers through proxy servers when needed.

Key changes:

  • Add --use-proxy CLI flag to enable proxy detection
  • Implement proxy dialing with context cancellation support
  • Add debug logging to track proxy usage
  • Prevent goroutine leaks on context cancellation

The implementation uses golang.org/x/net/proxy.FromEnvironment() which detects SOCKS5 proxies from ALL_PROXY/all_proxy environment variables.

This PR will fix #686

cloorc avatar Nov 09 '25 13:11 cloorc