Draft
Add HTTP/SOCKS5 proxy support for Cloudflare edge connections#1
Conversation
Co-authored-by: yzs981130 <15307797+yzs981130@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add support for HTTP and SOCKS5 proxy
Add HTTP/SOCKS5 proxy support for Cloudflare edge connections
Feb 26, 2026
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.
cloudflared ignored proxy environment variables when establishing TCP connections to the Cloudflare edge, making it impossible to route tunnel traffic through a local proxy (e.g., mitmproxy, SOCKS5 proxy).
Changes
edgediscovery/dial.go: Replace directnet.Dialer.DialContextwithproxy.FromEnvironmentUsing(&dialer)fromgolang.org/x/net/proxy, which readsALL_PROXY/all_proxyandNO_PROXY/no_proxyenvironment variablesproxy.ContextDialerpath (used by bothnet.Dialerand the SOCKS5 dialer) to preserve context timeout semanticsContextDialersupport, ensuring the timeout is still honouredUsage
When
ALL_PROXYis unset, behaviour is identical to before.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
protocol-v2.argotunnel.com/tmp/go-build2994755737/b001/edgediscovery.test /tmp/go-build2994755737/b001/edgediscovery.test -test.testlogfile=/tmp/go-build2994755737/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s memm�� /client.go /socks.go(dns block)/tmp/go-build2992108656/b622/edgediscovery.test /tmp/go-build2992108656/b622/edgediscovery.test -test.testlogfile=/tmp/go-build2992108656/b622/testlog.txt -test.paniconexit0 -test.v=test2json -test.timeout=10m0s -test.v=true -trimpath(dns block)update.argotunnel.com/tmp/go-build2992108656/b597/updater.test /tmp/go-build2992108656/b597/updater.test -test.testlogfile=/tmp/go-build2992108656/b597/testlog.txt -test.paniconexit0 -test.v=test2json -test.timeout=10m0s -test.v=true -trimpath(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.