Skip to content

Add JVM SOCKS5 proxy support to NettyConnectionClient#16285

Open
zrlw wants to merge 1 commit into
apache:3.3from
zrlw:3.3-socks5-proxy
Open

Add JVM SOCKS5 proxy support to NettyConnectionClient#16285
zrlw wants to merge 1 commit into
apache:3.3from
zrlw:3.3-socks5-proxy

Conversation

@zrlw
Copy link
Copy Markdown
Contributor

@zrlw zrlw commented May 19, 2026

What is the purpose of the change?

try to fix #16276

Checklist

  • Make sure there is a GitHub_issue field for the change.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test to verify your logic correction. If the new feature or significant change is committed, please remember to add sample in dubbo samples project.
  • Make sure gitHub actions can pass. Why the workflow is failing and how to fix it?

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 19, 2026

Codecov Report

❌ Patch coverage is 25.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.77%. Comparing base (3dbba26) to head (afb5d5b).

Files with missing lines Patch % Lines
...moting/transport/netty4/NettyConnectionClient.java 25.00% 5 Missing and 1 partial ⚠️
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     
Flag Coverage Δ
integration-tests-java21 32.12% <25.00%> (-0.05%) ⬇️
integration-tests-java8 32.33% <25.00%> (+0.08%) ⬆️
samples-tests-java21 32.19% <25.00%> (-0.04%) ⬇️
samples-tests-java8 29.86% <25.00%> (-0.03%) ⬇️
unit-tests-java11 58.99% <25.00%> (-0.09%) ⬇️
unit-tests-java17 58.47% <25.00%> (-0.12%) ⬇️
unit-tests-java21 58.49% <25.00%> (-0.10%) ⬇️
unit-tests-java25 58.43% <25.00%> (-0.10%) ⬇️
unit-tests-java8 59.03% <25.00%> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

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 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 / socksProxyPort from Dubbo’s global configuration (incl. system properties) and conditionally add Socks5ProxyHandler to 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";
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.

Support SOCKS5 proxy for tri protocol in NettyConnectionClient

3 participants