v2 core配置路由规则

用v2主要是配置相对比较自由,一个增强版的v2路由规则,还算挺好用的。

https://github.com/Loyalsoldier/v2ray-rules-dat/

一般就是两种模式,黑名单模式和白名单模式。

自己写规则的注意一下,在 Routing 配置中,类别越靠前(上),优先级越高。

白名单模式:

"routing": {
  "rules": [
    {
      "type": "field",
      "outboundTag": "Reject",
      "domain": ["geosite:category-ads-all"]
    }, //屏蔽广告
    {
      "type": "field",
      "outboundTag": "Direct",
      "domain": [
        "geosite:private",
        "geosite:apple-cn",
        "geosite:google-cn",
        "geosite:tld-cn",
        "geosite:category-games@cn"
      ]
    }, //apple等直连
    {
      "type": "field",
      "outboundTag": "Proxy",
      "domain": ["geosite:geolocation-!cn"]
    }, //代理
    {
      "type": "field",
      "outboundTag": "Direct",
      "domain": ["geosite:cn"]
    }, //直链
    {
      "type": "field",
      "outboundTag": "Proxy",
      "network": "tcp,udp" //剩下的不在规则里的都走代理
    }
  ]
}

黑名单模式:

"routing": {
  "rules": [
    {
      "type": "field",
      "outboundTag": "Reject",
      "domain": ["geosite:category-ads-all"]
    }, //屏蔽广告
    {
      "type": "field",
      "outboundTag": "Proxy",
      "domain": ["geosite:gfw", "geosite:greatfire"]
    }, //gfw的域名代理
    {
      "type": "field",
      "outboundTag": "Proxy",
      "ip": ["geoip:telegram"]
    }, //代理
    {
      "type": "field",
      "outboundTag": "Direct",
      "network": "tcp,udp" //剩下不在规则里的都直连。
    }
  ]

留言

* - 必填