v2fly / v2ray-core

A platform for building proxies to bypass network restrictions.
https://v2fly.org
MIT License
29.59k stars 4.66k forks source link

参照文档中 fakedns 的例子,DNS 策略似乎不工作。 #1317

Closed zw963 closed 3 years ago

zw963 commented 3 years ago

下面是我的 tproxy + fakedns 方案, DNS 部分的代码。

"servers": [
            "8.8.4.4",
            {
                "address": "fakedns",
                "domains": [
                    "geosite:geolocation-!cn"
                ]
            },
            {
                // localhost 代表使用运营商的 DNS.
                "address": "localhost",
                "port": 53,
                "domains": [
                    "geosite:cn"
                ],
                "expectIPs": [
                    "ext:geoip-only-cn-private.dat:cn"
                ]
            },
            {
                // fakeDNS 必须,否则会被解析为 fake IP.
                "address": "localhost",
                "port": 53,
                "domains": [
                    "router.asus.com"
                ]
            }
        ]

我的理解,当我访问一个外国域名的时候 (dig www.marketbet.com),这个域名应该会匹配 geosite:geolocation-!cn, 因此应该使用 fakedns 方案,但是结果是使用了默认的 DNS,8.8.4.4

2021/10/03 17:16:38 [Debug] transport/internet/udp: UDP original destination: udp:192.168.50.1:53
2021/10/03 17:16:38 [Debug] [2179945130] proxy/dokodemo: processing connection from: 192.168.50.87:37367
2021/10/03 17:16:38 [Info] [2179945130] proxy/dokodemo: received request for 192.168.50.87:37367
2021/10/03 17:16:38 [Info] [2179945130] app/dispatcher: taking detour [dns-outbound] for [udp:192.168.50.1:53]
2021/10/03 17:16:38 [Info] [2179945130] proxy/dns: handling DNS traffic to udp:192.168.50.1:53
2021/10/03 17:16:38 192.168.50.87:37367 accepted udp:192.168.50.1:53 [dns-outbound]
2021/10/03 17:16:38 [Debug] app/dns: domain www.marketbet.com will use the first DNS: [UDP:8.8.4.4:53]
2021/10/03 17:16:38 [Debug] app/dns: UDP:8.8.4.4:53 cache HIT www.marketbet.com -> [194.9.94.86 194.9.94.85]

这没有按照我期望的方式工作,如果无法这样工作,那么,我在默认 inbound 当中,设定 "destOverride": ["fakedns+others"], 这其中的 others 的意义又是什么呢?

多谢。

Loyalsoldier commented 3 years ago

geosite:geolocation-!cn 里都没有这个域名。

zw963 commented 3 years ago

奇怪了,geosite:geolocation-!cn, 这难道不是包含所有 “非中国境内注册的域名” 吗?