Awesome Open Source
Awesome Open Source

简介

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

规则文件生成方式

geoip.dat

  • 通过仓库 @Loyalsoldier/geoip 生成
  • 其中全球 IP 地址(IPv4 和 IPv6)来源于 MaxMind GeoLite2CN(中国大陆)类别下的 IPv4 地址来源于 ipip.net
  • 新增类别(方便有特殊需求的用户使用):
    • geoip:cloudflare
    • geoip:cloudfront
    • geoip:facebook
    • geoip:fastly
    • geoip:google
    • geoip:netflix
    • geoip:telegram
    • geoip:twitter

希望定制 geoip.dat 文件?查看仓库 @Loyalsoldier/geoip

geosite.dat

规则文件下载及使用方式

下载地址

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

使用方式

  1. 安装适用于自己操作系统的客户端(推荐 V2Ray 客户端
  2. 下载本项目的 geoip.datgeosite.dat
  3. 把下载下来的 geoip.datgeosite.dat 放入到客户端的规则文件目录,替换掉原来的 geoip.datgeosite.dat
  4. 如果使用的是 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",
        "geoip:telegram"
      ]
    }
  ]
}

geosite.dat

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

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

高级用法

v2fly/domain-list-community 项目 data 目录中某些列表里的规则会被标记诸如 @cn 的 attribute(如下所示),意为该域名在中国大陆有接入点,可直连。

steampowered.com.8686c.com @cn
steamstatic.com.8686c.com @cn

对于玩 Steam 国区游戏,想要直连的用户,可以设置类别 geosite:[email protected] 为直连,意为将 steam 列表内所有被标记了 @cn attribute 的规则(域名)设置为直连。同理,由于 category-games 列表包含了 steameablizzardepicgamesnintendo 等常见的游戏厂商。设置类别 geosite:[email protected] 为直连,即可节省大量服务器流量。

⚠️ 注意:在 Routing 配置中,类别越靠前(上),优先级越高,所以 geosite:[email protected] 等所有带有 @cn attribute 的规则都要放置在 geosite:geolocation-!cn 前(上)面才能生效。

category-games 列表内的规则(域名)可能会有疏漏,请留意规则命中情况。如发现遗漏,欢迎到项目 v2fly/domain-list-community 提 issue 反馈。

配置参考下面 👇👇👇

白名单模式 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:[email protected]"
      ]
    },
    {
      "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"]
    },
    {
      "type": "field",
      "outboundTag": "Proxy",
      "domain": ["geosite:gfw", "geosite:greatfire"]
    },
    {
      "type": "field",
      "outboundTag": "Proxy",
      "ip": ["geoip:telegram"]
    },
    {
      "type": "field",
      "outboundTag": "Direct",
      "network": "tcp,udp"
    }
  ]
}

DNS 配置方式

"dns": {
  "hosts": {
    "dns.google": "8.8.8.8",
    "dns.pub": "119.29.29.29",
    "dns.alidns.com": "223.5.5.5",
    "geosite:category-ads-all": "127.0.0.1"
  },
  "servers": [
    {
      "address": "https://1.1.1.1/dns-query",
      "domains": ["geosite:geolocation-!cn"],
      "expectIPs": ["geoip:!cn"]
    },
    "8.8.8.8",
    {
      "address": "114.114.114.114",
      "port": 53,
      "domains": ["geosite:cn", "geosite:[email protected]"],
      "expectIPs": ["geoip:cn"],
      "skipFallback": true
    },
    {
      "address": "localhost",
      "skipFallback": true
    }
  ]
}

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

注意事项:

  • 由于下面客户端配置的 DNS 使用了 skipFallback 选项,所以必须使用 v4.37.2 或更新版本的 V2Ray
  • 下面客户端配置使 V2Ray 在本机开启 SOCKS 代理(监听 1080 端口)和 HTTP 代理(监听 2080 端口),允许局域网内其他设备连接并使用代理
  • BT 流量统统直连(实测依然会有部分 BT 流量走代理,如果服务商禁止 BT 下载,请不要为下载软件设置代理)
  • 最后,不命中任何路由规则的请求和流量,统统走代理
  • outbounds 里的第一个大括号内的配置,即为 V2Ray 代理服务的配置。请根据自身需求进行修改,并参照 V2Ray 官网配置文档中的 配置 > Outbounds > OutboundObject 部分进行补全
{
  "log": {
    "loglevel": "warning"
  },
  "dns": {
    "hosts": {
      "dns.google": "8.8.8.8",
      "dns.pub": "119.29.29.29",
      "dns.alidns.com": "223.5.5.5",
      "geosite:category-ads-all": "127.0.0.1"
    },
    "servers": [
      {
        "address": "https://1.1.1.1/dns-query",
        "domains": ["geosite:geolocation-!cn", "geosite:[email protected]"],
        "expectIPs": ["geoip:!cn"]
      },
      "8.8.8.8",
      {
        "address": "114.114.114.114",
        "port": 53,
        "domains": [
          "geosite:cn",
          "geosite:icloud",
          "geosite:[email protected]"
        ],
        "expectIPs": ["geoip:cn"],
        "skipFallback": true
      },
      {
        "address": "localhost",
        "skipFallback": true
      }
    ]
  },
  "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",
    "domainMatcher": "mph",
    "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"]
      },
      {
        "type": "field",
        "outboundTag": "Proxy",
        "domain": [
          "full:www.icloud.com",
          "domain:icloud-content.com",
          "geosite:google"
        ]
      },
      {
        "type": "field",
        "outboundTag": "Direct",
        "domain": [
          "geosite:tld-cn",
          "geosite:icloud",
          "geosite:[email protected]"
        ]
      },
      {
        "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"
      }
    ]
  }
}

激赏 | Donation

  • 比特币(BTC)bech32 地址:bc1qfe4nxcanet4w4ph8pf6qqyf263y68vw26nv9j9
  • 比特币(BTC)地址:3PRyneb1D7jFFBakAaJiCRSsxsXAtMr7LN

使用本项目的项目

致谢

项目 Star 数增长趋势

Stargazers over time


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Proxy (3,444
Ssr (1,658
Routing (1,048
Shadowsocks (563
Adblock (441
V2ray (329
Trojan (281
Xray (272
Geoip (229
Ss (196
Gfw (188
Dnsmasq (180
Related Projects