Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request]: 建议增加一个destOverride设置选项,允许开启Sniffing的同时关闭destOverride #5099

Closed
1 task done
CodingMoeButa opened this issue May 13, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@CodingMoeButa
Copy link

CodingMoeButa commented May 13, 2024

相关问题

默认设置开启流量探测(Sniffing),无法使用Tor,这是因为v2rayN开启Sniffing的同时开启了destOverride,并且destOverride不能被单独关闭。经测试是destOverride造成Tor无法使用,并非是Sniffing造成的。目前的解决办法是一刀切关闭Sniffing,这虽然能解决Tor的连接问题,但是会造成路由分流中的域名规则和协议规则(如Bittorrent)无法生效。另见: ##360 (comment)

描述你希望的解决方案

在设置选项中添加一个destOverride选项,这样不需要关闭Sniffing只需关闭destOverride就能使用Tor,减小了关闭Sniffing造成其它方面功能损失的代价。

不太明白destOverride这个东西在客户端很有必要吗?只是探测域名和协议的话单独开启sniffing就够了,有必要做destOverride吗?

描述你所考虑的替代方案

如果是xray-core和sing-box的话同时开启route_only也能解决tor无法使用的问题,但是v2ray-core不支持route_only,关闭destOverride的方法才比较通用。

或者要求v2ray-core新增对route-only的支持。

我确认已查询历史issues

@2dust
Copy link
Owner

2dust commented May 14, 2024

v2ray-core(v2fly-core)在没有大变化的情况下,v2rayN已经不再支持UI配置了;目前主支持xray和sing-box.

你说的关闭destOverride,能否发一个config出来?

@CodingMoeButa
Copy link
Author

CodingMoeButa commented May 14, 2024

这是v2rayN现在生成的配置:

{
  "log": {
    "access": "",
    "error": "",
    "loglevel": "warning"
  },
  "inbounds": [
    {
      "tag": "socks",
      "port": 10808,
      "listen": "0.0.0.0",
      "protocol": "socks",
      "sniffing": {
        "enabled": true,
        "destOverride": [
          "http",
          "tls"
        ],
        "routeOnly": false
      },
      "settings": {
        "auth": "noauth",
        "udp": true,
        "allowTransparent": false
      }
    },
    {
      "tag": "http",
      "port": 10809,
      "listen": "0.0.0.0",
      "protocol": "http",
      "sniffing": {
        "enabled": true,
        "destOverride": [
          "http",
          "tls"
        ],
        "routeOnly": false
      },
      "settings": {
        "auth": "noauth",
        "udp": true,
        "allowTransparent": false
      }
    },
    {
      "tag": "api",
      "port": 10813,
      "listen": "127.0.0.1",
      "protocol": "dokodemo-door",
      "settings": {
        "udp": false,
        "address": "127.0.0.1",
        "allowTransparent": false
      }
    }
  ],
  "outbounds": [
    {
      "tag": "proxy",
      "protocol": "shadowsocks",
      "settings": {
        "servers": [
          {
            "address": "example.com",
            "method": "chacha20-ietf-poly1305",
            "ota": false,
            "password": "anonymous",
            "port": 10800,
            "level": 1
          }
        ]
      },
      "streamSettings": {
        "network": "tcp"
      },
      "mux": {
        "enabled": false,
        "concurrency": -1
      }
    },
    {
      "tag": "direct",
      "protocol": "freedom",
      "settings": {}
    },
    {
      "tag": "block",
      "protocol": "blackhole",
      "settings": {
        "response": {
          "type": "http"
        }
      }
    }
  ],
  "stats": {},
  "api": {
    "tag": "api",
    "services": [
      "StatsService"
    ]
  },
  "policy": {
    "system": {
      "statsOutboundUplink": true,
      "statsOutboundDownlink": true
    }
  },
  "dns": {
    "hosts": {
      "dns.google": "8.8.8.8",
      "proxy.example.com": "127.0.0.1"
    },
    "servers": [
      {
        "address": "223.5.5.5",
        "domains": [
          "geosite:cn",
          "geosite:geolocation-cn"
        ],
        "expectIPs": [
          "geoip:cn"
        ]
      },
      "1.1.1.1",
      "8.8.8.8",
      "https://dns.google/dns-query"
    ]
  },
  "routing": {
    "domainStrategy": "IPIfNonMatch",
    "domainMatcher": "mph",
    "rules": [
      {
        "type": "field",
        "inboundTag": [
          "api"
        ],
        "outboundTag": "api"
      },
      {
        "type": "field",
        "port": "0-65535",
        "outboundTag": "proxy"
      }
    ]
  }
}

可以看到destOverride会在inbounds/.../sniffing/destOverride出现。

参见:
当流量为指定类型时,按其中包括的目标地址重置当前连接的目标。
当流量为指定类型时,按其中包括的目标地址重置当前连接的目标。

只要允许在软件设置中修改destOverride数组的取值就可以。可以参考X-UI面板对这块的设计,给每个选项(["http" | "tls" | "quic" | "fakedns" | "fakedns+others" ])做复选框。

@2dust
Copy link
Owner

2dust commented May 14, 2024

d748e6e

@2dust 2dust closed this as completed May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants