之前指定了 Host 使用 script 根据规则应用内网的 DNS 服务器查询记录,一直正常工作。
升级 Surge for macOS 5.4.1 后无法触发。
[Host]
*.xxx.cn = script:AUTO_DNS
[Script]
AUTO_DNS = type=dns,debug=1,script-path=/Users/xxx/surge/auto-dns.js
if ($network.wifi.ssid === 'XXX') {
$done({ servers: ['内网IP1', '内网IP2'] })
} else {
$done({})
}
dashboard 中可见查询不到 dns 的报错,并没有根据匹配规则使用 script 查询。
14:48:14.014324 [Connection] Disconnect with reason: Failed to establish connection (DNS lookup failed: Empty DNS response for aaa.xxx.cn from all DNS servers: 119.29.29.29, 182.254.116.116, 8.8.8.8, 2402:4e00::, 2402:4e00:1::)
14:48:14.014653 [Connector] Connection setup failed: Error Domain=SGErrorDomain Code=1 "DNS lookup failed: Empty DNS response for aaa.xxx.cn from all DNS servers: 119.29.29.29, 182.254.116.116, 8.8.8.8, 2402:4e00::, 2402:4e00:1::" UserInfo={NSLocalizedDescription=DNS lookup failed: Empty DNS response for aaa.xxx.cn from all DNS servers: 119.29.29.29, 182.254.116.116, 8.8.8.8, 2402:4e00::, 2402:4e00:1::}, abort
之前一直开着 DoH,关掉无解,尝试把 servers 换成单个 server 也无效。
打开 DoH 时则是:
15:00:55.720215 [Connection] Disconnect with reason: Failed to establish connection (DNS lookup failed: Empty DNS response for newjw.cau.edu.cn from all DNS servers: )
域名的匹配规则和 script 内的判断,都是没问题的,之前一直正常用,修改为直接返回 server 也无效。
一直使用增强模式。