Skip to content

feat(network): 网络加速可选 DNS 服务器(国内 / Cloudflare / Google) - #150

Open
alexz006 wants to merge 1 commit into
RoutineMiku:mainfrom
alexz006:feat/dns-servers
Open

alexz006 wants to merge 1 commit into
RoutineMiku:mainfrom
alexz006:feat/dns-servers

Conversation

@alexz006

@alexz006 alexz006 commented Nov 25, 2026 •

Copy link
Copy Markdown

背景

「网络加速」目前固定给安卓指定阿里 / 腾讯 DNS(223.5.5.5,119.29.29.29)。在国外使用,或主机挂着海外 VPN 时,这两个国内 DNS 反而更慢,只能关掉网络加速、退回主机 DNS。

改动

  • 新增设置 engine.dnsServers:cn(默认,阿里 / 腾讯)| cloudflare(1.1.1.1 / 1.0.0.1)| google(8.8.8.8 / 8.8.4.4)。
  • 设置 → 网络加速开关下方加一个「DNS 服务器」下拉框,下次启动安卓运行时后生效。
  • emulator.js 抽出 DNS_PRESETS 和 dnsServersFor();关闭网络加速时仍然不传 -dns-server,未知取值回落到 cn。
  • test/engine-test.js 增加对应用例。

默认值不变,老用户行为完全一致;没有改动任何已有界面文案,正在进行的 i18n PR(#43、#134)的词典不受影响。

测试

  • node test/engine-test.js:26 通过,0 失败。
  • npm test 其余套件全部通过;test/auto-test.js 的「打包必须带上生产依赖」一项在未修改的 main 上同样失败(本地环境原因),与本改动无关。

English

Background

"Network acceleration" currently always gives Android the Alibaba / Tencent DNS servers (223.5.5.5,119.29.29.29). Outside China, or when the host is on a foreign VPN, these servers are slower, and the only option is to turn network acceleration off and fall back to the host's DNS.

Changes

  • New setting engine.dnsServers: cn (default, Alibaba / Tencent) | cloudflare (1.1.1.1 / 1.0.0.1) | google (8.8.8.8 / 8.8.4.4).
  • Settings → a "DNS servers" dropdown below the network acceleration switch; it takes effect the next time the Android runtime starts.
  • emulator.js: DNS_PRESETS and dnsServersFor() are split out; with network acceleration off, -dns-server is still not passed; unknown values fall back to cn.
  • test/engine-test.js: new test cases.

The default is unchanged, so existing users see no difference. No existing UI text was changed, so the dictionaries of the open i18n PRs (#43, #134) are not affected.

Tests

  • node test/engine-test.js: 26 passed, 0 failed.
  • All other npm test suites pass; the "package must include production dependencies" check in test/auto-test.js fails on unmodified main as well (local environment), unrelated to this change.

Network acceleration always pointed Android at Alibaba/Tencent DNS, which is
slow outside China or behind an overseas VPN. Add engine.dnsServers
(cn | cloudflare | google, default cn = unchanged behaviour) with a selector
under the existing switch. Existing UI strings are unchanged, so current
translation dictionaries keep matching.
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