2021-01-24 21:33:01 +08:00
2021-01-21 17:38:16 +08:00
2019-12-15 12:44:25 +08:00
2021-01-24 21:33:01 +08:00

简介

V2Ray 路由规则文件加强版,可代替 V2Ray 官方 geoip.datgeosite.dat 规则文件,兼容 Trojan-GoShadowsocks-windows。利用 GitHub Actions 北京时间每天早上 6 点自动构建,保证规则最新。

规则文件生成方式

geoip.dat

geosite.dat

规则文件下载及使用方式

下载地址

如果无法访问域名 raw.githubusercontent.com,可以使用第二个地址(cdn.jsdelivr.net),但是内容更新会有 12 小时的延迟。

使用方式

Windows 用户可通过 Scoop 来安装:

scoop bucket add sushi https://github.com/kidonng/sushi
scoop install v2ray-rules-dat

非 Windows 用户:

  1. 点击上面下载地址,下载 geoip.datgeosite.dat
  2. 把下载下来的 geoip.datgeosite.dat 文件放入到 V2Ray 的规则文件目录,替换掉原来的 geoip.datgeosite.dat
  3. 修改 V2Ray 配置文件,配置参考下面 👇👇👇

参考配置

geoip.dat

跟 V2Ray 官方 geoip.dat 配置方式相同。

Routing 配置方式

"routing": {
  "rules": [
    {
      "type": "field",
      "outboundTag": "Direct",
      "ip": [
        "223.5.5.5/32",
        "119.29.29.29/32",
        "180.76.76.76/32",
        "114.114.114.114/32",
        "geoip:cn",
        "geoip:private"
      ]
    },
    {
      "type": "field",
      "outboundTag": "Proxy",
      "ip": [
        "1.1.1.1/32",
        "1.0.0.1/32",
        "8.8.8.8/32",
        "8.8.4.4/32",
        "geoip:us",
        "geoip:ca"
      ]
    }
  ]
}

geosite.dat

跟 V2Ray 官方 geosite.dat 配置方式相同。相比官方 geosite.dat 文件,本项目特有的类别:

⚠️注意:在 Routing 配置中,类别越靠前(上),优先级越高,所以 geosite:apple-cngeosite:google-cn 要放置在 geosite:geolocation-!cn 前(上)面。

配置参考下面 👇👇👇

白名单模式 Routing 配置方式

"routing": {
  "rules": [
    {
      "type": "field",
      "outboundTag": "Reject",
      "domain": [
        "geosite:category-ads-all",
        "geosite:win-spy"
      ]
    },
    {
      "type": "field",
      "outboundTag": "Direct",
      "domain": [
        "geosite:private",
        "geosite:apple-cn",
        "geosite:google-cn",
        "geosite:tld-cn"
      ]
    },
    {
      "type": "field",
      "outboundTag": "Proxy",
      "domain": [
        "geosite:geolocation-!cn"
      ]
    },
    {
      "type": "field",
      "outboundTag": "Direct",
      "domain": [
        "geosite:cn"
      ]
    },
    {
     "type": "field",
     "outboundTag": "Proxy",
     "network": "tcp,udp"
    }
  ]
}

黑名单模式 Routing 配置方式:

"routing": {
  "rules": [
    {
      "type": "field",
      "outboundTag": "Reject",
      "domain": [
        "geosite:category-ads-all",
        "geosite:win-spy"
      ]
    },
    {
      "type": "field",
      "outboundTag": "Proxy",
      "domain": [
        "geosite:tld-!cn",
        "geosite:gfw",
        "geosite:greatfire"
      ]
    },
    {
      "type": "field",
      "outboundTag": "Proxy",
      "ip": [
        "109.239.140.0/24",
        "149.154.160.0/22",
        "149.154.164.0/22",
        "149.154.168.0/22",
        "149.154.172.0/22",
        "67.198.55.0/24",
        "91.108.12.0/22",
        "91.108.16.0/22",
        "91.108.20.0/22",
        "91.108.20.0/23",
        "91.108.4.0/22",
        "91.108.56.0/22",
        "91.108.56.0/23",
        "91.108.8.0/22",
        "95.161.64.0/20",
        "95.161.84.0/23",
        "2001:67c:4e8::/48",
        "2001:b28:f23c::/48",
        "2001:b28:f23d::/48",
        "2001:b28:f23f::/48",
        "2001:b28:f242::/48"
      ]
    },
    {
      "type": "field",
      "outboundTag": "Proxy",
      "ip": [
        "geoip:ae",
        "geoip:au",
        "geoip:br",
        "geoip:ca",
        "geoip:de",
        "geoip:dk",
        "geoip:es",
        "geoip:fi",
        "geoip:fr",
        "geoip:gb",
        "geoip:gr",
        "geoip:hk",
        "geoip:id",
        "geoip:il",
        "geoip:in",
        "geoip:iq",
        "geoip:ir",
        "geoip:it",
        "geoip:jp",
        "geoip:kr",
        "geoip:mo",
        "geoip:my",
        "geoip:nl",
        "geoip:no",
        "geoip:nz",
        "geoip:ph",
        "geoip:ru",
        "geoip:sa",
        "geoip:sg",
        "geoip:th",
        "geoip:tr",
        "geoip:tw",
        "geoip:us",
        "geoip:vn"
      ]
    },
    {
     "type": "field",
     "outboundTag": "Direct",
     "network": "tcp,udp"
    }
  ]
}

DNS 配置方式

"dns": {
  "servers": [
    {
      "address": "114.114.114.114",
      "port": 53,
      "domains": [
        "geosite:cn"
      ]
    },
    {
      "address": "1.1.1.1",
      "port": 53,
      "domains": [
        "geosite:geolocation-!cn"
      ]
    },
    "223.5.5.5",
    "8.8.8.8"
  ]
}

自用 V2Ray 客户端配置(仅供参考,请根据自身需求酌情修改)

注意事项:

  • 由于下面客户端配置使用了 DoH (DNS over HTTPS) 功能,所以必须使用 v4.22.0 或更新版本的 V2Ray
  • 下面客户端配置使 V2Ray 在本机开启 SOCKS 代理(监听 1080 端口)和 HTTP 代理(监听 2080 端口),允许局域网内其他设备连接并使用代理
  • BT 流量统统直连(实测依然会有部分 BT 流量走代理,尚不清楚是不是 V2Ray 的 bug。如果服务商禁止 BT 下载的话,请不要为下载软件设置代理)
  • 最后,不命中任何路由规则的请求和流量,统统走代理
  • outbounds 里的第一个大括号内的配置,即为 V2Ray 代理服务的配置。请根据自身需求进行修改,并参照 V2Ray 官网配置说明中的 配置 > Outbounds > OutboundObject 部分进行补全
{
  "log": {
    "loglevel": "warning"
  },
  "dns": {
    "hosts": {
      "dns.google": "8.8.8.8",
      "doh.pub": "119.29.29.29"
    },
    "servers": [
      "https://dns.google/dns-query",
      {
        "address": "https+local://223.5.5.5/dns-query",
        "domains": [
          "geosite:cn",
          "geosite:icloud"
        ],
        "expectIPs": [
          "geoip:cn"
        ]
      },
      {
        "address": "https://1.1.1.1/dns-query",
        "domains": [
          "geosite:geolocation-!cn"
        ]
      }
    ]
  },
  "inbounds": [
    {
      "protocol": "socks",
      "listen": "0.0.0.0",
      "port": 1080,
      "tag": "Socks-In",
      "settings": {
        "ip": "127.0.0.1",
        "udp": true,
        "auth": "noauth"
      },
      "sniffing": {
        "enabled": true,
        "destOverride": ["http", "tls"]
      }
    },
    {
      "protocol": "http",
      "listen": "0.0.0.0",
      "port": 2080,
      "tag": "Http-In",
      "sniffing": {
        "enabled": true,
        "destOverride": ["http", "tls"]
      }
    }
  ],
  "outbounds": [
    {
      //下面这行协议类别要改为socks、shadowsocks、vmess或vless等记得删除本行文字说明
      "protocol": "协议类别",
      "settings": {},
      //下面这行tag的值对应Routing里的outboundTag这里为Proxy记得删除本行文字说明
      "tag": "Proxy",
      "streamSettings": {},
      "mux": {}
    },
    {
      "protocol": "dns",
      "tag": "Dns-Out"
    },
    {
      "protocol": "freedom",
      "tag": "Direct",
      "settings": {
        "domainStrategy": "UseIPv4"
      }
    },
    {
      "protocol": "blackhole",
      "tag": "Reject",
      "settings": {
        "response": {
          "type": "http"
        }
      }
    }
  ],
  "routing": {
    "domainStrategy": "IPIfNonMatch",
    "rules": [
      {
        "type": "field",
        "outboundTag": "Direct",
        "protocol": ["bittorrent"]
      },
      {
        "type": "field",
        "outboundTag": "Dns-Out",
        "inboundTag": [
          "Socks-In",
          "Http-In"
        ],
        "network": "udp",
        "port": 53
      },
      {
        "type": "field",
        "outboundTag": "Reject",
        "domain": [
          "geosite:category-ads-all",
          "geosite:win-spy"
        ]
      },
      {
        "type": "field",
        "outboundTag": "Proxy",
        "domain": [
          "full:www.icloud.com",
          "domain:icloud-content.com"
        ]
      },
      {
        "type": "field",
        "outboundTag": "Direct",
        "domain": [
          "geosite:tld-cn",
          "geosite:icloud"
        ]
      },
      {
        "type": "field",
        "outboundTag": "Proxy",
        "domain": [
          "geosite:geolocation-!cn"
        ]
      },
      {
        "type": "field",
        "outboundTag": "Direct",
        "domain": [
          "geosite:cn",
          "geosite:private"
        ]
      },
      {
        "type": "field",
        "outboundTag": "Direct",
        "ip": [
          "geoip:cn",
          "geoip:private"
        ]
      },
      {
        "type": "field",
        "outboundTag": "Proxy",
        "network": "tcp,udp"
      }
    ]
  }
}

使用本项目的项目

致谢

项目 Star 数增长趋势

Stargazers over time