SagerNet / sing-box

The universal proxy platform
https://sing-box.sagernet.org/
Other
19.9k stars 2.36k forks source link

Fail to redirect customized url site by "domain_suffix" #2015

Closed dbsxdbsx closed 2 months ago

dbsxdbsx commented 3 months ago

On win10 with sing-box v1.9.3, with such config.json:

{
  "dns": {
    "servers": [
      {
        "tag": "alidns",
        "address": "https://223.5.5.5/dns-query",
        "strategy": "ipv4_only",
        "detour": "direct"
      },
      {
        "tag": "cloudflare",
        "address": "https://1.1.1.1/dns-query",
        "strategy": "ipv4_only",
        "detour": "default_node: L1|俄罗斯|流媒体|1x"
      },
      {
        "tag": "block",
        "address": "rcode://success"
      }
    ],
    "rules": [
      {
        "server": "alidns",
        "outbound": [
          "any"
        ]
      },
      {
        "server": "alidns",
        "domain_suffix": [
          ".cn"
        ]
      },
      {
        "server": "alidns",
        "rule_set": [
          "geosite-cn"
        ]
      },
      {
        "server": "block",
        "rule_set": [
          "geosite-category-ads-all"
        ]
      }
    ],
    "final": "cloudflare",
    "strategy": "",
    "disable_cache": false,
    "disable_expire": false,
    "independent_cache": true,
    "fakeip": {
      "enabled": true,
      "inet4_range": "198.18.0.0/15",
      "inet6_range": "fc00::/18"
    }
  },
  "inbounds": [
    {
      "interface_name": "my_proxy_app_tun",
      "type": "tun",
      "tag": "tun-in",
      "auto_route": true,
      "inet4_address": "172.19.0.1/30",
      "strict_route": true,
      "sniff": true,
      "stack": "system"
    }
  ],
  "outbounds": [
    {
      "type": "vless",
      "tag": "default_node: L1|俄罗斯|流媒体|1x",
      ...
    },
    {
      "type": "vmess",
      "tag": "special_node",
      ...
    },
    {
      "type": "direct",
      "tag": "direct"
    },
    {
      "type": "block",
      "tag": "block"
    },
    {
      "type": "dns",
      "tag": "dns-out"
    }
  ],
  "route": {
    "rules": [
      {
        "domain_suffix": [
          "google.com"
        ],
        "outbound": "direct"
      },
      {
        "domain_suffix": [
          "youtube.com"
        ],
        "outbound": "special_node"
      },
      {
        "process_name": [
          "Code.exe"
        ],
        "outbound": "direct"
      },
      {
        "protocol": "dns",
        "outbound": "dns-out"
      },
      {
        "ip_is_private": true,
        "outbound": "direct"
      },
      {
        "domain_suffix": [
          ".cn"
        ],
        "outbound": "direct"
      },
      {
        "rule_set": [
          "geoip-cn",
          "geosite-cn",
          "geosite-private"
        ],
        "outbound": "direct"
      },
      {
        "rule_set": [
          "geosite-category-ads-all"
        ],
        "outbound": "block"
      }
    ],
    "rule_set": [
      {
        "tag": "geoip-cn",
        "type": "remote",
        "format": "binary",
        "url": "https://raw.githubusercontent.com/SagerNet/sing-geoip/rule-set/geoip-cn.srs",
        "download_detour": "default_node: L1|俄罗斯|流媒体|1x"
      },
      {
        "tag": "geosite-cn",
        "type": "remote",
        "format": "binary",
        "url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-cn.srs",
        "download_detour": "default_node: L1|俄罗斯|流媒体|1x"
      },
      {
        "tag": "geosite-private",
        "type": "remote",
        "format": "binary",
        "url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-private.srs",
        "download_detour": "default_node: L1|俄罗斯|流媒体|1x"
      },
      {
        "tag": "geosite-category-ads-all",
        "type": "remote",
        "format": "binary",
        "url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-category-ads-all.srs",
        "download_detour": "default_node: L1|俄罗斯|流媒体|1x"
      }
    ],
    "auto_detect_interface": true,
    "final": "default_node: L1|俄罗斯|流媒体|1x"
  },
  "experimental": {
    "clash_api": {
      "external_controller": "127.0.0.1:9090",
      "external_ui_download_url": "",
      "secret": "22e694e4-093d-44bb-8ed2-b0e548c87a2e",
      "default_mode": "",
      "external_ui_download_detour": "",
      "external_ui": "ui"
    },
    "cache_file": {
      "enabled": true,
      "path": "cache.db",
      "cache_id": "mycacheid",
      "store_fakeip": true
    }
  }
}

The rule

  {
        "domain_suffix": [
          "google.com"
        ],
        "outbound": "direct"
      },

doesn't take effect, which should be failed to get access but turns out to be ok to get access. I wonder if there is some setting makes this google setting not triggered?

swysgh commented 2 months ago

你在测试前有没有打断连接?我测试是正常无法访问的,安卓singbox客户端最新测试版1.10.0-alpha.29,如果使用的是hk的节点可能访问的是google.com.hk,还有关掉代理看看能不能访问,虽然不太可能,会不会是软路由透明代理?

dbsxdbsx commented 2 months ago

你在测试前有没有打断连接

有, 基本都是直接调试中断,并保证sing-box的服务及启动的adaptor(win10页面“更改适配器”页面中启动的tun网卡)消失后再测试的;

安卓singbox客户端最新测试版1.10.0-alpha.29,如果使用的是hk的节点可能访问的是google.com.hk, 因为测试的是"outbound": "direct",所以应该不会受到具体节点的归属影响才对; 具体地,一开始我用1.10.0-alpha.29发现其实是有效果的,然后用1.9.3发现也有效; 但过了一会儿发现不无论用哪个版本都没效果了。总感觉像是缓存了什么没有彻底把之前的 sing-box打断一样。

关掉代理看看能不能访问,虽然不太可能,会不会是软路由透明代理 关掉后不能访问,不会是软路由的问题。

我先关掉吧,若试验了有啥新发现再开。