Skip to content

fix: support socks5h addon proxy urls#786

Open
knylbyte wants to merge 1 commit intoViren070:mainfrom
knylbyte:codex/socks5h-addon-proxy
Open

fix: support socks5h addon proxy urls#786
knylbyte wants to merge 1 commit intoViren070:mainfrom
knylbyte:codex/socks5h-addon-proxy

Conversation

@knylbyte
Copy link

@knylbyte knylbyte commented Mar 5, 2026

Summary

  • route socks5h:// addon proxy URLs through the SOCKS dispatcher path
  • keep existing socks5:// behavior unchanged
  • document socks5h:// usage in .env.sample

Problem

ADDON_PROXY=socks5h://... was not recognized as SOCKS in getProxyAgent().
It fell back to Undici ProxyAgent, which only accepts HTTP(S) proxy URLs, causing runtime errors like:
Invalid URL protocol: the URL must start with http: or https:.

Fix

Treat both socks5: and socks5h: as SOCKS5 protocols and use socksDispatcher for both.

Notes

  • no functional changes to stream proxy services (builtin, stremthru, mediaflow)
  • this change only affects outgoing addon request proxying via ADDON_PROXY

Summary by CodeRabbit

Release Notes

  • New Features

    • Extended proxy protocol support to include SOCKS5h proxies, which now function equivalently to standard SOCKS5.
  • Documentation

    • Added sample configuration demonstrating SOCKS5 proxy setup with remote DNS resolution.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 5, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: a6241469-69b4-4113-adf1-756045f02265

📥 Commits

Reviewing files that changed from the base of the PR and between acbf274 and 3ae6498.

📒 Files selected for processing (2)
  • .env.sample
  • packages/core/src/utils/http.ts

Walkthrough

Two files were modified to extend proxy protocol support. A sample configuration file now includes a SOCKS5 with remote DNS proxy example, and the HTTP utility module was updated to recognise socks5h protocol URLs alongside existing socks5 handling, directing both to the same dispatcher mechanism.

Changes

Cohort / File(s) Summary
Documentation
.env.sample
Added example configuration demonstrating SOCKS5 with remote DNS proxy setup.
Proxy Protocol Handling
packages/core/src/utils/http.ts
Extended protocol detection to treat socks5h: URLs identically to socks5: by including both in the protocol check, enabling socksDispatcher routing for socks5h proxies.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A whisker-twitch, a hop, hooray!
New proxy paths now find their way,
socks5h joins the trusted fold,
Where DNS secrets still stay bold,
Through tunnels deep and nets so wide! 🌐

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarises the main change: adding support for socks5h addon proxy URLs, which is the primary fix across the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant