Repository navigation
[Withdrawn] fix(proxy): add opt-in local DNS for SOCKS5 targets - #4987
Closed
MarcusHO929 wants to merge 1 commit into
Closed
MarcusHO929 wants to merge 1 commit into
MarcusHO929 wants to merge 1 commit into
Conversation
yorihaput
added a commit
to yorihaput/9router
that referenced
this pull request
Oct 17, 2026
Merging decolua#4987 + decolua#4988 + decolua#4984 + decolua#4991 for opencode free tier error fix
andyvandaric
added a commit
to andyvandaric/9router
that referenced
this pull request
Oct 17, 2026
… strategy in full Problem: the fork ran an older fingerprint contract than upstream frontier on the keyed lane and lacked both proxy escape hatches from issue decolua#4983. opencode-zen still sent the v1 UA plus a stub bash/glob/grep/read quartet with empty schemas and the v1-only x-opencode-request header, the fingerprint helper could not satisfy the gate when a caller tool reuses read/shell with platform-specific wording, and proxyAwareFetch had no way out of an egress the gate had flagged. Changes: port upstream PR decolua#4972 (in-place fingerprint normalization with alias fallback), decolua#4883 (UA opencode/latest/2.0.29/cli across both executors, registry and dashboard test; strict v2 channel matcher kept), decolua#4860 fingerprint/strategy for opencode-zen (verbatim read/shell via applyFingerprintTools, cli client, four session mirrors, drop x-opencode-request and x-api-key for free tier; /zen/v1 to /inference/v1 switch NOT taken), decolua#4987 (open-sse/utils/proxyDispatcher.js with opt-in socks5 dns=local, shared by proxyFetch and the dashboard proxy test, fail-closed ERR_PROXY_DNS_MODE) and decolua#4988 (replay a proxied 403 FreeTierError once on the direct egress, strictProxy contract preserved). undici ^7.19.2 to ^7.30.1. Version 0.5.108. Verification: full suite re-derived on this machine from a git stash -u baseline - failure sets byte-identical (95 = 95, 0 new), passes 3592 to 3617. Targeted opencode/proxy/session groups 214 pass. undici 7.30.1 exposes Socks5ProxyAgent and createSocks5Connection; the local-DNS dispatcher is exercised end to end against a local SOCKS5 plus TLS fixture (11 cases). Root cause of the free-tier 403 is egress-IP load-shedding (decolua#4983), so these ports restore request truth and add escape hatches but cannot make a flagged egress succeed.
mulqizamzam
added a commit
to mulqizamzam/9router
that referenced
this pull request
Oct 18, 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.
Withdrawn — correction after follow-up measurements (2026-10-20)
I am withdrawing this proposal and the recommendation to use local DNS as an OpenCode 403 fix. Please do not merge this PR on the basis of my earlier diagnosis.
Later controlled checks in the same AdGuard SOCKS setup showed that local resolution / a numeric SOCKS target could lead multiple configured pools to the same service-visible US egress. With proxy-side DNS / a domain SOCKS target, the checked pools exposed their respective distinct VPN egresses. This was also reproduced by explicitly comparing socks5:// and socks5h:// with fresh trace URLs. No IP addresses, account details or credentials are included here.
We have removed the locally installed, hardcoded OpenCode DNS override and restored the byte-identical original 9router 0.5.104 transport. A local SOCKS/HTTPS regression check confirms domain addressing, original Host/SNI, and certificate verification. Follow-up checks with the restored installed transport showed the expected distinct pool egresses.
Important qualifications:
I am closing my PR without merging. Other authors' fallback proposals are independent and are not being withdrawn by this correction. Sorry for the overstatement in the earlier diagnosis.
Superseded original proposal — retained as history, not a current recommendation
Summary
Add an opt-in local DNS mode for SOCKS5 proxy URLs:
Unparameterized URLs and
?dns=remoteretain the existing remote/proxy-DNS behavior. This is a transport option, not a provider identity/header change or a hardcoded OpenCode exception.Related: #4983, especially the controlled observations in #4983 (comment) .
Why
In an existing AdGuard SOCKS setup, the same OpenCode request returned 403 with the hostname sent as a SOCKS domain target, but 200 when the destination was resolved locally and its numeric address sent through the same SOCKS proxy. HTTP request data, Host/SNI and verified TLS identity were held constant. Numeric IPv4 and IPv6 both worked; the exact gateway-internal routing rule remains unknown.
The locally scoped workaround restored all 16 existing pools with
strictProxy:true. This PR generalizes the DNS choice as an explicit per-proxy URL option rather than silently changing DNS for all users or special-casing OpenCode.The actual PR source was also smoke-tested against the affected existing SOCKS proxy with identical synthetic request data: remote mode -> 403, local mode -> 200 /
OK/ completed stream. This does not claim to fix every OpenCode 403 or the separate GLM429 Endpoint is unavailable.Changes
socks5: ... ?dns=local, resolve with the system resolver and pass the IPv4/IPv6 result to the existing SOCKS tunnel implementation; retain the original HTTP origin, TLS SNI and certificate hostname.Security / compatibility notes
Tests
npm run build: pass (optional better-sqlite3 binding unavailable with lifecycle scripts disabled; supported node:sqlite fallback used).masterat87a74e1, using the same installed dependencies and conditions: 3589 passed / 90 failed / 93 pending. Exact failed-case and failed-file sets match; no new failures. That full current run preceded the last two IPv6/IP-literal additions; the final 26-test targeted run includes them.The full suite is not green on the unmodified baseline either; I am not presenting this as a clean full-suite pass.