Skip to content

Conversation

@cloorc
Copy link

@cloorc cloorc commented Nov 9, 2025

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

Copilot AI review requested due to automatic review settings November 9, 2025 13:26
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds SOCKS5 proxy support for peer-to-peer connections in the Ethereum client. It introduces a new --use-proxy command-line flag that enables routing peer connections through a SOCKS5 proxy configured via the ALL_PROXY or all_proxy environment variables.

Key Changes:

  • Added UseProxy configuration field to enable proxy usage
  • Enhanced tcpDialer to support proxy connections with context cancellation
  • Integrated new CLI flag into the geth application

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
p2p/server.go Added UseProxy config field and updated tcpDialer initialization to pass the proxy flag
p2p/dial.go Modified tcpDialer struct to support proxy dialing with context cancellation handling
cmd/utils/flags.go Added UseProxyFlag CLI flag and integrated it into SetP2PConfig
cmd/geth/main.go Added UseProxyFlag to the application's networking flags

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cloorc cloorc force-pushed the feature/proxy branch 2 times, most recently from a428e99 to 9c9c6e0 Compare November 10, 2025 08:54
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.

Signed-off-by: Cloorc <[email protected]>
Signed-off-by: cloorc <[email protected]>
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.

Add proxy support for p2p connections

1 participant