[Duplicate of #5202] fake-IP 代理(Surge 增强模式 / Clash、Mihomo)下 web_fetch 恒报 "resolves to a non-public IP address" #6112
axinhouzilaoyue
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Summary
macOS 上开着增强模式(TUN + fake-IP)的代理时,内置
web_fetch(@deepseek-ai/dsh-web-fetch-http)会把代理分配的 fake-IP 当成真实目的地地址,在发起连接前直接拒绝:结果是这类环境下
web_fetch对任何站点都不可用,而同一台机器上的浏览器 / curl 访问同一 URL 完全正常。Reproduction
scutil --dns中可见nameserver[0] : 198.18.0.2、if_index : utun);Clash / Mihomo 的enhanced-mode: fake-ip(默认fake-ip-range: 198.18.0.1/16)同理。dsh web(v0.1.5-rc.1,next通道,也是当前最新)。web_fetch,目标为任意公网站点,例如https://www.themoviedb.org/。注意:不需要配置
http_proxy/https_proxy。dsh 不读取 macOS 系统代理(见 network-proxy 文档),所以默认就走"自己解析地址"的分支。Current behavior
系统层面(同机、同一时刻):
dsh 里:
定位在
dsh-web-fetch-http的resolvePublicAddresses():它用ipaddr.js要求每个解析结果range() === 'unicast',而198.18.0.0/15在ipaddr.js中是reserved(RFC 2544 benchmark 段),所以任何 fake-IP 都会命中:核心是语义错位:fake-IP 不是真正的目的地地址,而是代理工具用来把连接映射回域名的令牌——本机 TUN 收到发往该地址的连接后,会还原成真实域名再转发。dsh 把它当字面目的地做公网校验,就必然误判。
补充:若配置了
http_proxy/https_proxy,requestOnce()会走route.proxied分支、完全不做本地解析,因此不会报错——但代价是整个 harness 的出站(含 LLM 请求)都改走代理。Expected behavior
希望为"非公网地址校验"提供显式、可配置的例外,例如:
安全边界可以保持不变:只放行配置中列出的网段,loopback / RFC1918 / link-local 等仍拒绝,DNS 全答案校验与连接 pin 逻辑照旧。当前
web-fetch-http只有maxResponseBytes / maxBodyChars / timeoutMs / maxRedirects / userAgent五个配置项,没有任何方式解除WEB_BLOCKED_URL。Environment
next,当前最新)@deepseek-ai/dsh-web-fetch-http@0.1.5-rc.1http_proxy/https_proxy附:现有变通手段的代价
always-real-ip:需要逐个域名维护,且会让 Surge 丢掉该域名的 fake-IP→域名映射(always-real-ip = *会破坏 DOMAIN 规则匹配,官方文档亦不推荐)。https_proxy:全部出站改走代理端口,SSRF 校验在代理分支被整体跳过,代理一关 dsh 即断网。dsh-web-fetch-enhanced),说明需求真实存在;不过由上游提供配置项,或至少在文档中标注"与 fake-IP 模式代理不兼容",会更合适。All reactions