Mahdi-zarei / nekoray

Qt based cross-platform GUI proxy configuration manager (backend: sing-box)
GNU General Public License v3.0
255 stars 17 forks source link

support sing-box new routing system #14

Closed AkramiPro closed 3 weeks ago

AkramiPro commented 1 month ago

I just want to be sure that your fork is support new sing-box routing rules? for example, the GeoIP and Geosite are deprecated and we need to use new rule_set option.

you can see sing-box doc migration section for full description about these changes. https://sing-box.sagernet.org/migration/#migrate-cache-file-from-clash-api-to-independent-options

Old Routing

{
  "route": {
    "rules": [
      {
        "geoip": "private",
        "outbound": "direct"
      },
      {
        "geoip": "cn",
        "outbound": "direct"
      },
      {
        "source_geoip": "cn",
        "outbound": "block"
      }
    ],
    "geoip": {
      "download_detour": "proxy"
    }
  }
}

New Rotuing (v1.8+)

{
  "route": {
    "rules": [
      {
        "ip_is_private": true,
        "outbound": "direct"
      },
      {
        "rule_set": "geoip-cn",
        "outbound": "direct"
      },
      {
        "rule_set": "geoip-us",
        "rule_set_ipcidr_match_source": true,
        "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": "proxy"
      },
      {
        "tag": "geoip-us",
        "type": "remote",
        "format": "binary",
        "url": "https://raw.githubusercontent.com/SagerNet/sing-geoip/rule-set/geoip-us.srs",
        "download_detour": "proxy"
      }
    ]
  },
  "experimental": {
    "cache_file": {
      "enabled": true // required to save Rule Set cache
    }
  }
}
AkramiPro commented 1 month ago

just for clarification i use Custom Config Settings for set routing settings and in my tests it is not support new sing-box routing syntax.

image

The old syntax still working

image

New syntax start without error but not applying

image

AkramiPro commented 1 month ago

you can test rules with tamin.ir domain, by default you must get 403 error so you can set rule to bypass IR sites but in new syntax it is not applied. for to be sure that my rules are correct i tested with sing-box cli version and its working.

Mahdi-zarei commented 1 month ago

The sections related to routing need to be fully rewritten, this might take some time.