v2fly / v2ray-core

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

V5.4.1: 内置DNS查询失败(empty response)。 #2517

Closed mega-optimus closed 1 year ago

mega-optimus commented 1 year ago

你正在使用哪个版本的 V2Ray?

V5.4.1

你的使用场景是什么?

"domainStrategy": "IpOnDemand"

Chrome -> [socks5] -> V2Ray -> [VMess/QUIC]

embedded DNS pointing to localhost or [8.8.8.8], both result in "empty response"

你看到的异常现象是什么?

[Info] features/routing/dns: resolve ip for raw.githubusercontent.com > empty response

你期待看到的正常表现是怎样的?

DNS resolves correctly.

请附上你的配置

服务端配置:

// 在这里附上服务器端配置文件

客户端配置:

// 在这里附上客户端配置
{
  "log": {
    "access": {
        "type": "Console",
        "level": "Debug",
        "path": ""
    },
    "error": {
        "type": "Console",
        "level": "Debug",
        "path": ""
    }
  },

  "inbounds": [
    {
        "domainStrategy": "IpOnDemand",
        "tag": "socks",
        "port": 20808,
        "listen": "127.0.0.1",
        "protocol": "socks",
        "settings": {
            "address": "",
            "udpEnabled": true,
            "packetEncoding": "None"
        }
    },{
        "domainStrategy": "IpOnDemand",
        "tag": "http",
        "port": 20809,
        "listen": "127.0.0.1",
        "protocol": "http"
    }
  ],

  "outbounds": [
      {
        "protocol": "vmess",
        "settings": {
            "address": "example.com",
            "port": 443,
            "uuid": "abcd"
        },
        "streamSettings": {
            "transport": "quic",
            "transportSettings": {
               "key": "efgh",
               "security": {
                   "type": "CHACHA20_POLY1305"
               }
            },
            "security": "tls",
            "securitySettings": {
                "allowInsecure": false,
                "serverName": "example.com",
                "nextProtocol": ["h3"],
                "enableSessionResumption": true,
                "disableSystemRoot": false,
                "verifyClientCertificate": false
            },
            "socketSettings": {
               "mark": 0,
               "tcpFastOpen": false,
               "tproxy": "off",
               "acceptProxyProtocol": false,
               "tcpKeepAliveInterval": 0,
               "tcpKeepAliveIdle": 0,
               "tcpFastOpenQueueLength": 4096,
               "bindToDevice": "",
               "rxBufSize": 0,
               "txBufSize": 0,
               "forceBufSize": false
            }
        },
        "domainStrategy": "IpOnDemand",
        "tag": "proxy"
      },{
        "protocol": "freedom",
        "settings": {},
        "tag": "direct"
      },{
        "protocol": "blackhole",
        "settings": {},
        "tag": "blocked"
      }
  ],

  "dns": {
    "nameServer": [
      {
        "address": {
            "network": "UDP",
            "address": "localhost",
            "port": 53
        },
        "queryStrategy": "USE_IP4",
        "cacheStrategy": "CacheDisabled",
        "fallbackStrategy": "Disabled"
      }
    ],
    "queryStrategy": "USE_IP4",
    "cacheStrategy": "CacheDisabled",
    "fallbackStrategy": "Disabled"
  },

  "router": {
        "domainStrategy": "IpOnDemand",
        "rule": [
            {
                "tag": "direct",
                "geoip": [
                  {
                    "code": "cn",
                    "inverseMatch": false,
                    "filePath": "geoip.dat"
                  }
                ]
            },{
                "tag": "proxy",
                "portList": "0-65535"
            }
        ]
  }
}

请附上出错时软件输出的错误日志

服务器端错误日志:

// 在这里附上服务器端日志

客户端错误日志:

// 在这里附上客户端日志
2023/05/17 02:35:32 [Debug] app/log: Logger started
2023/05/17 02:35:32 [Info] app/dns: DNS: created localhost client
2023/05/17 02:35:32 [Debug] app/dns: using default domain matcher
2023/05/17 02:35:32 [Debug] app/proxyman/inbound: creating stream worker on 127.0.0.1:20808
2023/05/17 02:35:32 [Debug] app/proxyman/inbound: creating stream worker on 127.0.0.1:20809
2023/05/17 02:35:32 [Info] transport/internet/tcp: listening TCP on 127.0.0.1:20808
2023/05/17 02:35:32 [Info] transport/internet/udp: listening UDP on 127.0.0.1:20808
2023/05/17 02:35:32 [Info] transport/internet/tcp: listening TCP on 127.0.0.1:20809
2023/05/17 02:35:32 [Warning] V2Ray 5.4.1 started
2023/05/17 02:35:43 [Info] [3700207552] proxy/socks: TCP Connect request to tcp:raw.githubusercontent.com:443
2023/05/17 02:35:43 tcp:127.0.0.1:16161 accepted tcp:raw.githubusercontent.com:443 [proxy]
2023/05/17 02:35:43 [Info] features/routing/dns: resolve ip for raw.githubusercontent.com > empty response
2023/05/17 02:35:43 [Info] [3700207552] app/dispatcher: taking detour [proxy] for [tcp:raw.githubusercontent.com:443]

请附上访问日志

// 在这里附上服务器端日志

其它相关的配置文件(如 Nginx)和相关日志

如果 V2Ray 无法启动,请附上 --test 命令的输出

如果 V2Ray 服务运行异常,请附上 journal 日志

mega-optimus commented 1 year ago

========== Update: Removing this line in "dns" section solves the problem, anybody knows why? "fallbackStrategy": "Disabled"

========== Update: changing "router" rule like this, moves baidu.com from [direct] to [proxy], which is unexpected. "code": "cn" => "countryCode": "cn",

========== Problem fixed. Keep the issue open for a while, in case someone wants to investigate, thank you !

AkinoKaede commented 1 year ago

Documentation is still incomplete and may contain some errors.

mega-optimus commented 1 year ago

Documentation is still incomplete and may contain some errors.

Not about documentation. I'm following the generated schema https://github.com/EHfive/v2ray-jsonschema and v2ray source code. Note that the above mentioned fields are actually valid fields. However their roles are confusing.

Eternamaze commented 4 months ago

I had the same problem and confirmed that this is a bug with the documentation. I saw entries like this in error.log: 2024/06/03 13:00:34 [Info] features: You are using a deprecated feature: DNS disableCache settings. Please update your config file with latest configuration format, or update your client software. 2024/06/03 13:00:34 [Info] features: You are using a deprecated feature: DNS disableFallback settings. Please update your config file with latest configuration format, or update your client software. 2024/06/03 13:00:34 [Info] features: You are using a deprecated feature: DNS server skipFallback settings. Please update your config file with latest configuration format, or update your client software. It is accompanied by records like: 2024/06/03 13:00:34 [Info] app/dns: DNS: created UDP client initialized for 8.8.8.8:53 2024/06/03 13:00:34 [Debug] app/dns: using default domain matcher 2024/06/03 13:00:39 [Info] features/routing/dns: resolve ip for *****.org > empty response It should be the deprecated settings that have not been marked in the document that caused the DNS function module to malfunction