Add JVM SOCKS5 proxy support to NettyConnectionClient#16285
Open
zrlw wants to merge 1 commit into
Open
Conversation
4 tasks
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 3.3 #16285 +/- ##
============================================
- Coverage 60.85% 60.77% -0.09%
+ Complexity 11779 11769 -10
============================================
Files 1953 1953
Lines 89186 89194 +8
Branches 13454 13455 +1
============================================
- Hits 54277 54206 -71
- Misses 29353 29414 +61
- Partials 5556 5574 +18
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds SOCKS5 proxy support to the tri/HTTP2 Netty client path by wiring Netty’s Socks5ProxyHandler into NettyConnectionClient when JVM-style proxy properties are present, addressing #16276.
Changes:
- Read
socksProxyHost/socksProxyPortfrom Dubbo’s global configuration (incl. system properties) and conditionally addSocks5ProxyHandlerto the Netty pipeline. - Skip proxying for local/loopback targets via a new
isFilteredAddress(...)helper. - Add supporting imports/constants for the new behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+141
to
+143
| if (socksProxyHost != null && !isFilteredAddress(getUrl().getHost())) { | ||
| int socksProxyPort = Integer.parseInt(ConfigurationUtils.getProperty( | ||
| getUrl().getOrDefaultApplicationModel(), SOCKS_PROXY_PORT, DEFAULT_SOCKS_PROXY_PORT)); |
Comment on lines
+144
to
+145
| Socks5ProxyHandler socks5ProxyHandler = | ||
| new Socks5ProxyHandler(new InetSocketAddress(socksProxyHost, socksProxyPort)); |
Comment on lines
+138
to
+147
| // support Socks5 | ||
| String socksProxyHost = | ||
| ConfigurationUtils.getProperty(getUrl().getOrDefaultApplicationModel(), SOCKS_PROXY_HOST); | ||
| if (socksProxyHost != null && !isFilteredAddress(getUrl().getHost())) { | ||
| int socksProxyPort = Integer.parseInt(ConfigurationUtils.getProperty( | ||
| getUrl().getOrDefaultApplicationModel(), SOCKS_PROXY_PORT, DEFAULT_SOCKS_PROXY_PORT)); | ||
| Socks5ProxyHandler socks5ProxyHandler = | ||
| new Socks5ProxyHandler(new InetSocketAddress(socksProxyHost, socksProxyPort)); | ||
| pipeline.addFirst(socks5ProxyHandler); | ||
| } |
Comment on lines
+59
to
+63
| private static final String SOCKS_PROXY_HOST = "socksProxyHost"; | ||
|
|
||
| private static final String SOCKS_PROXY_PORT = "socksProxyPort"; | ||
|
|
||
| private static final String DEFAULT_SOCKS_PROXY_PORT = "1080"; |
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 is the purpose of the change?
try to fix #16276
Checklist