Skip to content

feat: built-in DoH resolver to replace external SSRF monkey-patch #5

Description

@cncoder

背景

Clash / Stash fake-ip 模式下,某些直连请求(Discord 媒体、local-roots、Cloudflare API)会被解析到 198.18.x.x 然后 reset。目前的绕过方案是外挂 monkey-patch:

`~/.openclaw/dns-override.mjs` + `NODE_OPTIONS=--import ./dns-override.mjs` 写到两处 plist 里(gateway + node),OpenClaw 升级还可能覆盖 plist。

提案

内置 DoH 解析策略到核心:

```json
{
"network": {
"resolveStrategy": "doh-fallback",
"dohProviders": ["https://cloudflare-dns.com/dns-query", "https://dns.google/dns-query"],
"fakeIpRanges": ["198.18.0.0/15"]
}
}
```

实现:

  • 在 `src/infra/net/` 加统一 resolver
  • `dns.lookup` 返回 fake-ip 段时自动走 DoH 重解
  • 对所有 undici / axios / ws 调用透明

收益

  • 消除外挂 patch,消除 plist 覆盖风险
  • 开箱即用

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions