Coder Social home page Coder Social logo

mark1916 / v2ray-rules-dat Goto Github PK

View Code? Open in Web Editor NEW

This project forked from loyalsoldier/v2ray-rules-dat

0.0 0.0 0.0 3.44 MB

V2Ray 规则文件加强版,可代替官方规则文件。Enhanced edition of V2Ray rules dat files.

License: GNU General Public License v3.0

v2ray-rules-dat's Introduction

简介

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

说明

本项目适用于命令行版本 V2Ray 客户端。第三方桌面图形界面版(GUI)V2Ray 客户端一般都有路由规则图形化配置界面,但一般也都支持使用自定义 V2Ray JSON 配置和 dat 规则文件,请自行研究并修改配置。第三方移动设备版 V2Ray 客户端情况比较复杂,大概率不支持使用自定义 V2Ray JSON 配置和 dat 规则文件,请知悉。

规则文件生成方式

geoip.dat

geosite.dat

  • 通过仓库 @v2ray/domain-list-community 生成
  • 加入大量**大陆域名、Apple 域名和 Google 域名
  • 加入最新 GFWList 域名:通过仓库 @cokebar/gfwlist2dnsmasq 生成并加入到 geosite:geolocation-!cn 类别中
  • 加入 Greatfire Analyzer 检测到的屏蔽域名:通过仓库 @wongsyrone/domain-block-list 获取 Greatfire Analyzer 检测到的屏蔽域名,并加入到 geosite:geolocation-!cn 类别中
  • 加入更多代理域名和广告域名:通过仓库 @ConnersHua/Profiles@GeQ1an/Rules@lhie1/Rules 获取更多代理域名、广告域名,并分别加入到 geosite:geolocation-!cngeosite:category-ads-all 类别中
  • 可添加自定义直连、代理和广告域名:由于上游域名列表更新缓慢或缺失某些域名,所以引入需要添加的域名列表。hidden 分支里的三个文件 direct.txtproxy.txtreject.txt,分别存放自定义的需要添加的直连、代理、广告域名,最终分别加入到 geosite:cngeosite:geolocation-!cngeosite:category-ads-all 类别中
  • 可移除自定义直连、代理和广告域名:由于上游域名列表存在需要被移除的域名,所以引入需要移除的域名列表。hidden 分支里的三个文件 direct-need-to-remove.txtproxy-need-to-remove.txtreject-need-to-remove.txt,分别存放自定义的需要从 direct-list(直连域名列表)、proxy-list(代理域名列表)和 reject-list(广告域名列表) 移除的域名

规则文件下载及使用方式

下载地址

使用方式

  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": [
        "geoip:cn",
        "geoip:private"
      ]
    }
  ]
}

geosite.dat

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

Routing 配置方式

"routing": {
  "rules": [
    {
      "type": "field",
      "outboundTag": "Reject",
      "domain": [
        "geosite:category-ads-all"
      ]
    },
    {
      "type": "field",
      "outboundTag": "Proxy",
      "domain": [
        "geosite:geolocation-!cn"
      ]
    },
    {
      "type": "field",
      "outboundTag": "Direct",
      "domain": [
        "geosite:cn"
      ]
    }
  ]
}

DNS 配置方式

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

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

下面为自用 V2Ray 客户端完整配置,注意事项:

  • 由于下面客户端配置使用了 DoH DNS 功能,所以必须使用 v4.22.0 或更新版本的 V2Ray
  • 下面客户端配置使 V2Ray 在本机开启 SOCKS 代理(监听 1080 端口)和 HTTP 代理(监听 2080 端口)
  • BT 流量统统直连(实测依然会有部分 BT 流量走代理,尚不清楚是不是 V2Ray 的 bug。如果服务商禁止 BT 下载的话,请不要为下载软件设置代理)
  • 最后,不命中任何路由规则的请求和流量,统统走代理
  • outbounds 里的第一个大括号内的配置,即为 V2Ray 代理服务的配置。请根据自身需求进行修改,并参照 V2Ray 官网配置说明中的 配置文件 > 文件格式 > OutboundObject 部分进行补全
{
  "log": {
    "loglevel": "warning"
  },
  "dns": {
    "hosts": {
      "dns.google": "8.8.8.8"
    },
    "servers": [
      {
        "address": "https://1.1.1.1/dns-query",
        "domains": [
          "geosite:geolocation-!cn"
        ]
      },
      "https://1.1.1.1/dns-query",
      "https://dns.google/dns-query",
      {
        "address": "114.114.114.114",
        "port": 53,
        "domains": [
          "geosite:cn"
        ],
        "expectIPs": [
          "geoip:cn"
        ]
      }
    ]
  },
  "inbounds": [
    {
      "protocol": "socks",
      "listen": "127.0.0.1",
      "port": 1080,
      "tag": "Socks-In",
      "settings": {
        "ip": "127.0.0.1",
        "udp": true,
        "auth": "noauth"
      },
      "sniffing": {
        "enabled": true,
        "destOverride": ["http", "tls"]
      }
    },
    {
      "protocol": "http",
      "listen": "127.0.0.1",
      "port": 2080,
      "tag": "Http-In",
      "sniffing": {
        "enabled": true,
        "destOverride": ["http", "tls"]
      }
    }
  ],
  "outbounds": [
    {
      //下面这行,协议名称为socks、shadowsocks或vmess等(记得删除这行文字说明)
      "protocol": "协议名称",
      "settings": {},
      //下面这行,必须为Proxy,对应Routing里的outboundTag(记得删除这行文字说明)
      "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"
        ]
      },
      {
        "type": "field",
        "outboundTag": "Proxy",
        "domain": [
          "geosite:geolocation-!cn"
        ]
      },
      {
        "type": "field",
        "outboundTag": "Direct",
        "domain": [
          "geosite:cn"
        ]
      },
      {
        "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"
        ]
      },
      {
        "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"
        ]
      },
      {
        "type": "field",
        "outboundTag": "Direct",
        "ip": [
          "geoip:cn",
          "geoip:private"
        ]
      },
      {
        "type": "field",
        "outboundTag": "Proxy",
        "network": "tcp,udp"
      }
    ]
  }
}

致谢

v2ray-rules-dat's People

Contributors

loyalsoldier avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.