Compare commits

...

24 Commits

Author SHA1 Message Date
Loyalsoldier
d54f2a5424 Update README.md 2021-01-16 00:25:28 +08:00
Loyalsoldier
ba6139b8fe Refine README 2020-12-28 18:58:01 +08:00
Loyalsoldier
9486e7b460 Refine geosite:gfw description 2020-12-27 17:14:27 +08:00
loyalsoldier
0fae67f885 Add Telegram CIDR to blacklist mode 2020-11-24 15:21:46 +08:00
loyalsoldier
ccc66630b4 Avoid license issue
due to 4beadd53d7

To achieve this goal, use geoip.dat from repo Loyalsoldier/geoip directly without modification (remix, transform and build).
2020-11-19 02:30:59 +08:00
dependabot[bot]
a14c3c75f7 Bump actions/checkout from v2.3.3 to v2.3.4 (#54) 2020-11-04 07:03:27 +08:00
loyalsoldier
755fb3a7dd Change to direct links 2020-10-30 09:56:03 +08:00
loyalsoldier
ef437ef849 README: add special lists 2020-10-30 09:53:49 +08:00
loyalsoldier
7518b62b89 Refine blacklist and whitelist modes 2020-10-30 08:44:59 +08:00
loyalsoldier
3b5d3a6e3c Refine geosite:gfw & geosite:greatfire list 2020-10-29 03:25:52 +08:00
Loyalsoldier
d8eb17e6af Run workflow on workflow_dispatch event 2020-10-27 10:00:37 +08:00
loyalsoldier
63e7a195b6 Update README 2020-10-27 09:42:39 +08:00
loyalsoldier
7b7796af37 Refine workflow 2020-10-27 09:42:38 +08:00
loyalsoldier
bca4f6aad8 Update set-env & add-path commands
due to https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/
2020-10-06 15:02:20 +08:00
Loyalsoldier
7d6e9bcafa README: detailed @pexcn/chnroute.txt info 2020-10-05 18:14:20 +08:00
Loyalsoldier
8b4b8a8480 README: add notice about setting MAXMIND LICENSE KEY 2020-10-03 11:19:17 +08:00
Loyalsoldier
bfd0a1bb8b Update and hide MaxMind GeoLite2 Database LICENSE KEY
Please apply your LICENSE KEY at https://dev.maxmind.com/geoip/geoip2/geolite2/
2020-10-03 10:35:34 +08:00
loyalsoldier
4f9d05fe91 Exclude rules with @cn attribute from geolocation-!cn category 2020-09-29 11:04:54 +08:00
dependabot[bot]
824225fdab Bump actions/checkout from v2.3.2 to v2.3.3 (#46) 2020-09-24 13:25:19 +08:00
loyalsoldier
ee3c14f985 Remove unnecessary lists 2020-09-15 13:00:53 +08:00
Loyalsoldier
51e9036dd0 README: add V2Ray repo link 2020-09-08 18:42:02 +08:00
Loyalsoldier
96c87a28e4 README: compatible with trojan-go 2020-09-08 07:16:28 +08:00
loyalsoldier
a53a0ae385 Change DNS settings
due to https://github.com/v2fly/v2ray-core/issues/92
2020-08-30 07:37:58 +08:00
loyalsoldier
0409cd0700 Add cdn.jsdelivr.net link as backup 2020-08-30 07:32:15 +08:00
2 changed files with 242 additions and 102 deletions

View File

@@ -1,75 +1,68 @@
name: Build V2Ray rules dat files
on:
workflow_dispatch:
schedule:
- cron: "0 22 * * *"
push:
branches:
- master
- hidden
paths-ignore:
- "**/README.md"
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Setup Go 1.x
- name: Setup Go 1.x.y
uses: actions/setup-go@v2
with:
go-version: "^1.14"
go-version: "^1.15"
- name: Set $GOPATH and more variables
- name: Set variables
run: |
echo "::set-env name=RELEASE_NAME::Released on $(date +%Y%m%d%H%M)"
echo "::set-env name=TAG_NAME::$(date +%Y%m%d%H%M)"
echo "::set-env name=GEOIP_REPO::github.com/Loyalsoldier/geoip"
echo "::set-env name=GEOSITE_REPO::github.com/v2fly/domain-list-community"
echo "::set-env name=CHINA_DOMAINS_URL::https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/accelerated-domains.china.conf"
echo "::set-env name=GOOGLE_DOMAINS_URL::https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/google.china.conf"
echo "::set-env name=APPLE_DOMAINS_URL::https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/apple.china.conf"
echo "::set-env name=GFWLIST_DOMAINS_URL::https://cokebar.github.io/gfwlist2dnsmasq/gfwlist_domain.txt"
echo "::set-env name=GFWLIST_EXTRAS_DOMAINS_URL::https://raw.githubusercontent.com/pexcn/gfwlist-extras/master/gfwlist-extras.txt"
echo "::set-env name=GREATFIRE_DOMAINS_URL::https://raw.githubusercontent.com/Loyalsoldier/cn-blocked-domain/release/domains.txt"
echo "::set-env name=GEQ1AN_RULES_APPLE_URL::https://raw.githubusercontent.com/GeQ1an/Rules/master/QuantumultX/Filter/Apple.list"
echo "::set-env name=GEQ1AN_RULES_MICROSOFT_URL::https://raw.githubusercontent.com/GeQ1an/Rules/master/QuantumultX/Filter/Optional/Microsoft.list"
echo "::set-env name=GEQ1AN_RULES_GLOBAL_MEDIA_URL::https://raw.githubusercontent.com/GeQ1an/Rules/master/QuantumultX/Filter/GMedia.list"
echo "::set-env name=GEQ1AN_RULES_OUTSIDE_URL::https://raw.githubusercontent.com/GeQ1an/Rules/master/QuantumultX/Filter/Outside.list"
echo "::set-env name=LHIE1_RULES_PROXY_URL::https://raw.githubusercontent.com/lhie1/Rules/master/Surge/Surge%203/Provider/Proxy.list"
echo "::set-env name=EASYLISTCHINA_EASYLIST_REJECT_URL::https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt"
echo "::set-env name=PETERLOWE_REJECT_URL::https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=1&mimetype=plaintext"
echo "::set-env name=ADGUARD_DNS_REJECT_URL::https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt"
echo "::set-env name=DANPOLLOCK_REJECT_URL::https://someonewhocares.org/hosts/hosts"
echo "::set-env name=V2FLY_DIRECT::https://raw.githubusercontent.com/v2fly/domain-list-community/release/cn.txt"
echo "::set-env name=V2FLY_PROXY::https://raw.githubusercontent.com/v2fly/domain-list-community/release/geolocation-!cn.txt"
echo "::set-env name=GOPATH::$(dirname $GITHUB_WORKSPACE)"
echo "::add-path::$(dirname $GITHUB_WORKSPACE)/bin"
echo "RELEASE_NAME=Released on $(date +%Y%m%d%H%M)" >> $GITHUB_ENV
echo "TAG_NAME=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV
echo "CHINA_DOMAINS_URL=https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/accelerated-domains.china.conf" >> $GITHUB_ENV
echo "GOOGLE_DOMAINS_URL=https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/google.china.conf" >> $GITHUB_ENV
echo "APPLE_DOMAINS_URL=https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/apple.china.conf" >> $GITHUB_ENV
echo "GFWLIST_DOMAINS_URL=https://cokebar.github.io/gfwlist2dnsmasq/gfwlist_domain.txt" >> $GITHUB_ENV
echo "GFWLIST_EXTRAS_DOMAINS_URL=https://raw.githubusercontent.com/pexcn/gfwlist-extras/master/gfwlist-extras.txt" >> $GITHUB_ENV
echo "GREATFIRE_DOMAINS_URL=https://raw.githubusercontent.com/Loyalsoldier/cn-blocked-domain/release/domains.txt" >> $GITHUB_ENV
echo "GEQ1AN_RULES_GLOBAL_MEDIA_URL=https://raw.githubusercontent.com/GeQ1an/Rules/master/QuantumultX/Filter/GMedia.list" >> $GITHUB_ENV
echo "LHIE1_RULES_PROXY_URL=https://raw.githubusercontent.com/lhie1/Rules/master/Surge/Surge%203/Provider/Proxy.list" >> $GITHUB_ENV
echo "EASYLISTCHINA_EASYLIST_REJECT_URL=https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt" >> $GITHUB_ENV
echo "PETERLOWE_REJECT_URL=https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=1&mimetype=plaintext" >> $GITHUB_ENV
echo "ADGUARD_DNS_REJECT_URL=https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt" >> $GITHUB_ENV
echo "DANPOLLOCK_REJECT_URL=https://someonewhocares.org/hosts/hosts" >> $GITHUB_ENV
echo "CUSTOM_DIRECT=https://raw.githubusercontent.com/Loyalsoldier/domain-list-custom/release/cn.txt" >> $GITHUB_ENV
echo "CUSTOM_PROXY=https://raw.githubusercontent.com/Loyalsoldier/domain-list-custom/release/geolocation-!cn.txt" >> $GITHUB_ENV
shell: bash
- name: Checkout the "hidden" branch
uses: actions/checkout@v2.3.2
- name: Checkout the "hidden" branch of this repo
uses: actions/checkout@v2.3.4
with:
ref: hidden
- name: Get GeoLite2 zip file
run: |
curl -L -o GeoLite2-Country-CSV.zip "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country-CSV&license_key=JvbzLLx7qBZT&suffix=zip"
unzip GeoLite2-Country-CSV.zip
rm -f GeoLite2-Country-CSV.zip
mv GeoLite2* geoip
- name: Checkout Loyalsoldier/domain-list-custom
uses: actions/checkout@v2.3.4
with:
repository: Loyalsoldier/domain-list-custom
path: custom
- name: Generate geoip.dat file
run: |
go get -v -insecure $GEOIP_REPO
geoip --country=./geoip/GeoLite2-Country-Locations-en.csv --ipv4=./geoip/GeoLite2-Country-Blocks-IPv4.csv --ipv6=./geoip/GeoLite2-Country-Blocks-IPv6.csv --ipv4CN=https://raw.githubusercontent.com/pexcn/daily/gh-pages/chnroute/chnroute.txt
- name: Checkout v2fly/domain-list-community
uses: actions/checkout@v2.3.4
with:
repository: v2fly/domain-list-community
path: community
- name: Download geosite project
- name: Get geoip.dat relative files
run: |
go get -v -insecure $GEOSITE_REPO
wget https://github.com/Loyalsoldier/geoip/raw/release/geoip.dat
wget https://github.com/Loyalsoldier/geoip/raw/release/geoip.dat.sha256sum
- name: Get and add direct domains into temp-direct.txt file
run: |
curl -sSL $CHINA_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' > temp-direct.txt
curl -sSL ${V2FLY_DIRECT} | perl -ne '/^(domain|full):([^:]+)(\n$|:@.+)/ && print "$2\n"' >> temp-direct.txt
curl -sSL ${CUSTOM_DIRECT} | perl -ne '/^(domain|full):([^:]+)(\n$|:@.+)/ && print "$2\n"' >> temp-direct.txt
- name: Get and add proxy domains into temp-proxy.txt file
run: |
@@ -78,12 +71,9 @@ jobs:
curl -sSL $GREATFIRE_DOMAINS_URL | perl -ne '/^((?=^.{3,255})[a-zA-Z0-9][-_a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-_a-zA-Z0-9]{0,62})+)/ && print "$1\n"' >> temp-proxy.txt
curl -sSL $GOOGLE_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' >> temp-proxy.txt
curl -sSL $APPLE_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' >> temp-proxy.txt
curl -sSL $GEQ1AN_RULES_APPLE_URL | awk -F ',' '/^(HOST|DOMAIN)(,|\-SUFFIX,).+Apple/ {print $2}' >> temp-proxy.txt
curl -sSL $GEQ1AN_RULES_MICROSOFT_URL | awk -F ',' '/^(HOST|DOMAIN)(,|\-SUFFIX,).+Microsoft/ {print $2}' >> temp-proxy.txt
curl -sSL $GEQ1AN_RULES_GLOBAL_MEDIA_URL | awk -F ',' '/^(HOST|DOMAIN)(,|\-SUFFIX,).+GMedia/ {print $2}' >> temp-proxy.txt
curl -sSL $GEQ1AN_RULES_OUTSIDE_URL | awk -F ',' '/^(HOST|DOMAIN)(,|\-SUFFIX,).+Outside/ {print $2}' >> temp-proxy.txt
curl -sSL $LHIE1_RULES_PROXY_URL | awk -F ',' '/^(HOST|DOMAIN)(,|\-SUFFIX,).+/ {print $2}' >> temp-proxy.txt
curl -sSL ${V2FLY_PROXY} | perl -ne '/^(domain|full):([^:]+)(\n$|:@.+)/ && print "$2\n"' >> temp-proxy.txt
curl -sSL ${CUSTOM_PROXY} | grep -Ev ":@cn" | perl -ne '/^(domain|full):([^:]+)(\n$|:@.+)/ && print "$2\n"' >> temp-proxy.txt
- name: Get and add reject domains into temp-reject.txt file
run: |
@@ -92,10 +82,10 @@ jobs:
curl -sSL $PETERLOWE_REJECT_URL | perl -ne '/^127\.0\.0\.1\s([-_0-9a-zA-Z]+(\.[-_0-9a-zA-Z]+){1,64})$/ && print "$1\n"' >> temp-reject.txt
curl -sSL $DANPOLLOCK_REJECT_URL | perl -ne '/^127\.0\.0\.1\s([-_0-9a-zA-Z]+(\.[-_0-9a-zA-Z]+){1,64})/ && print "$1\n"' | sed '1d' >> temp-reject.txt
- name: Reserve `regexp` and `keyword` type of rules from v2fly lists to "reserve" files
- name: Reserve `regexp` and `keyword` type of rules from custom lists to "reserve" files
run: |
curl -sSL ${V2FLY_DIRECT} | perl -ne '/^((regexp|keyword):[^:]+)(\n$|:@.+)/ && print "$1\n"' > direct-reserve.txt
curl -sSL ${V2FLY_PROXY} | perl -ne '/^((regexp|keyword):[^:]+)(\n$|:@.+)/ && print "$1\n"' > proxy-reserve.txt
curl -sSL ${CUSTOM_DIRECT} | perl -ne '/^((regexp|keyword):[^:]+)(\n$|:@.+)/ && print "$1\n"' > direct-reserve.txt
curl -sSL ${CUSTOM_PROXY} | grep -Ev ":@cn" | perl -ne '/^((regexp|keyword):[^:]+)(\n$|:@.+)/ && print "$1\n"' > proxy-reserve.txt
- name: Add proxy, direct and reject domains from "hidden" branch to appropriate temp files
run: |
@@ -133,43 +123,49 @@ jobs:
- name: Remove domains end with ".cn" in "temp-geolocation-!cn.txt" and write lists to data directory
run: |
cat temp-cn.txt | sort --ignore-case -u | perl -ne '/^((?=^.{1,255})[a-zA-Z0-9][-_a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-_a-zA-Z0-9]{0,62})*)/ && print "$1\n"' > $GOPATH/src/$GEOSITE_REPO/data/cn
cat temp-cn.txt | sort --ignore-case -u | perl -ne '/^((?=^.{1,255})[a-zA-Z0-9][-_a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-_a-zA-Z0-9]{0,62})*)/ && print "$1\n"' > ./community/data/cn
cat temp-cn.txt | sort --ignore-case -u | perl -ne 'print if not /^((?=^.{3,255})[a-zA-Z0-9][-_a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-_a-zA-Z0-9]{0,62})+)/' > direct-tld-list.txt
cat temp-geolocation-\!cn.txt | sort --ignore-case -u | perl -ne '/^((?=^.{1,255})[a-zA-Z0-9][-_a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-_a-zA-Z0-9]{0,62})*)/ && print "$1\n"' | perl -ne 'print if not /\.cn$/' > $GOPATH/src/$GEOSITE_REPO/data/geolocation-\!cn
cat temp-geolocation-\!cn.txt | sort --ignore-case -u | perl -ne '/^((?=^.{1,255})[a-zA-Z0-9][-_a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-_a-zA-Z0-9]{0,62})*)/ && print "$1\n"' | perl -ne 'print if not /\.cn$/' > ./community/data/geolocation-\!cn
cat temp-geolocation-\!cn.txt | sort --ignore-case -u | perl -ne 'print if not /^((?=^.{3,255})[a-zA-Z0-9][-_a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-_a-zA-Z0-9]{0,62})+)/' > proxy-tld-list.txt
cat temp-category-ads-all.txt | sort --ignore-case -u | perl -ne '/^((?=^.{1,255})[a-zA-Z0-9][-_a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-_a-zA-Z0-9]{0,62})*)/ && print "$1\n"' > $GOPATH/src/$GEOSITE_REPO/data/category-ads-all
cat temp-category-ads-all.txt | sort --ignore-case -u | perl -ne '/^((?=^.{1,255})[a-zA-Z0-9][-_a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-_a-zA-Z0-9]{0,62})*)/ && print "$1\n"' > ./community/data/category-ads-all
cat temp-category-ads-all.txt | sort --ignore-case -u | perl -ne 'print if not /^((?=^.{3,255})[a-zA-Z0-9][-_a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-_a-zA-Z0-9]{0,62})+)/' > reject-tld-list.txt
- name: Add `regexp` and `keyword` type of rules back into "cn", "geolocation-!cn" and "category-ads-all" list
run: |
[ -f "direct-reserve.txt" ] && cat direct-reserve.txt >> $GOPATH/src/$GEOSITE_REPO/data/cn
[ -f "proxy-reserve.txt" ] && cat proxy-reserve.txt >> $GOPATH/src/$GEOSITE_REPO/data/geolocation-\!cn
[ -f "reject-reserve.txt" ] && cat reject-reserve.txt >> $GOPATH/src/$GEOSITE_REPO/data/category-ads-all
cp $GOPATH/src/$GEOSITE_REPO/data/cn direct-list.txt
cp $GOPATH/src/$GEOSITE_REPO/data/geolocation-\!cn proxy-list.txt
cp $GOPATH/src/$GEOSITE_REPO/data/category-ads-all reject-list.txt
[ -f "direct-reserve.txt" ] && cat direct-reserve.txt >> ./community/data/cn
[ -f "proxy-reserve.txt" ] && cat proxy-reserve.txt >> ./community/data/geolocation-\!cn
[ -f "reject-reserve.txt" ] && cat reject-reserve.txt >> ./community/data/category-ads-all
cp ./community/data/cn direct-list.txt
cp ./community/data/geolocation-\!cn proxy-list.txt
cp ./community/data/category-ads-all reject-list.txt
- name: Add `google-cn` and `apple-cn` lists for custom routing settings due to accessibility in China Mainland
- name: Create `google-cn``apple-cn`、`gfw`、`greatfire` lists
run: |
curl -sSL $GOOGLE_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' > $GOPATH/src/$GEOSITE_REPO/data/google-cn
curl -sSL $GOOGLE_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' > ./community/data/google-cn
curl -sSL $GOOGLE_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' > google-cn.txt
curl -sSL $APPLE_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' > $GOPATH/src/$GEOSITE_REPO/data/apple-cn
curl -sSL $APPLE_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' > ./community/data/apple-cn
curl -sSL $APPLE_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' > apple-cn.txt
curl -sSL $GFWLIST_DOMAINS_URL | perl -ne '/^((?=^.{3,255})[a-zA-Z0-9][-_a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-_a-zA-Z0-9]{0,62})+)/ && print "$1\n"' >> ./community/data/gfw
curl -sSL $GFWLIST_EXTRAS_DOMAINS_URL | perl -ne 'print if not /^(#|\s)/' >> ./community/data/gfw
cat ./community/data/gfw | sort --ignore-case -u > gfw.txt
curl -sSL $GREATFIRE_DOMAINS_URL | perl -ne '/^((?=^.{3,255})[a-zA-Z0-9][-_a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-_a-zA-Z0-9]{0,62})+)/ && print "$1\n"' >> ./community/data/greatfire
cat ./community/data/greatfire | sort --ignore-case -u > greatfire.txt
- name: Build geosite.dat file
run: |
domain-list-community --datapath=${{ env.GOPATH }}/src/${{ env.GEOSITE_REPO }}/data
cd custom || exit 1
go run ./ --datapath=../community/data
- name: Move and zip files and generate sha256 hash
run: |
install -Dp geoip.dat ./publish/geoip.dat
install -Dp dlc.dat ./publish/geosite.dat
install -Dp ./geoip.dat ./publish/geoip.dat
install -Dp ./geoip.dat.sha256sum ./publish/geoip.dat.sha256sum
install -Dp ./custom/publish/dlc.dat ./publish/geosite.dat
install -p {proxy,direct,reject}-tld-list.txt ./publish/
install -p {proxy,direct,reject}-list.txt ./publish/
install -p {apple,google}-cn.txt ./publish/
cd ./publish
install -p {apple-cn,google-cn,gfw,greatfire}.txt ./publish/
cd ./publish || exit 1
zip rules.zip {proxy,direct,reject}-list.txt geoip.dat geosite.dat
sha256sum geoip.dat > geoip.dat.sha256sum
sha256sum geosite.dat > geosite.dat.sha256sum
sha256sum rules.zip > rules.zip.sha256sum

212
README.md
View File

@@ -1,28 +1,29 @@
# 简介
**V2Ray** 路由规则文件加强版,可代替 V2Ray 官方 `geoip.dat``geosite.dat` 规则文件。利用 GitHub Actions 北京时间每天早上 6 点自动构建,保证规则最新。
## 说明
本项目适用于命令行版本 V2Ray 客户端。第三方桌面图形界面版GUIV2Ray 客户端一般都有路由规则图形化配置界面,但一般也都支持使用自定义 V2Ray JSON 配置和 dat 规则文件,请自行研究并修改配置。第三方移动设备版 V2Ray 客户端情况比较复杂,大概率不支持使用自定义 V2Ray JSON 配置和 dat 规则文件,请知悉。
[**V2Ray**](https://github.com/v2fly/v2ray-core) 路由规则文件加强版,可代替 V2Ray 官方 `geoip.dat``geosite.dat` 规则文件,兼容 [Trojan-Go](https://github.com/p4gefau1t/trojan-go) 和 [Shadowsocks-windows](https://github.com/shadowsocks/shadowsocks-windows)。利用 GitHub Actions 北京时间每天早上 6 点自动构建,保证规则最新。
## 规则文件生成方式
### geoip.dat
- 通过仓库 [@Loyalsoldier/geoip](https://github.com/Loyalsoldier/geoip) 生成
- 其中全球 IP 地址IPv4 和 IPv6来源于 [MaxMind GeoLite2](https://dev.maxmind.com/geoip/geoip2/geolite2/)`CN`(中国大陆)类别下的 IPv4 地址来源于 [@pexcn/chnroute.txt](https://github.com/pexcn/daily/blob/gh-pages/chnroute/chnroute.txt)
- 其中全球 IP 地址IPv4 和 IPv6来源于 [MaxMind GeoLite2](https://dev.maxmind.com/geoip/geoip2/geolite2/)`CN`(中国大陆)类别下的 IPv4 地址来源于 [ipip.net](https://github.com/17mon/china_ip_list)
### geosite.dat
- 通过仓库 [@v2fly/domain-list-community](https://github.com/v2fly/domain-list-community) 生成
- 基于 [@v2fly/domain-list-community/data](https://github.com/v2fly/domain-list-community/tree/master/data) 数据,通过仓库 [@Loyalsoldier/domain-list-custom](https://github.com/Loyalsoldier/domain-list-custom) 生成
- **加入大量中国大陆域名、Apple 域名和 Google 域名**
- [@felixonmars/dnsmasq-china-list/accelerated-domains.china.conf](https://github.com/felixonmars/dnsmasq-china-list/blob/master/accelerated-domains.china.conf) 加入到 `geosite:cn` 类别中
- [@felixonmars/dnsmasq-china-list/apple.china.conf](https://github.com/felixonmars/dnsmasq-china-list/blob/master/apple.china.conf) 加入到 `geosite:geolocation-!cn` 类别中(如希望本文件中的 Apple 域名直连,请参考下面 [geosite 的 Routing 配置方式](https://github.com/Loyalsoldier/v2ray-rules-dat#geositedat-1)
- [@felixonmars/dnsmasq-china-list/google.china.conf](https://github.com/felixonmars/dnsmasq-china-list/blob/master/google.china.conf) 加入到 `geosite:geolocation-!cn` 类别中(如希望本文件中的 Google 域名直连,请参考下面 [geosite 的 Routing 配置方式](https://github.com/Loyalsoldier/v2ray-rules-dat#geositedat-1)
- **加入最新 GFWList 域名**通过仓库 [@cokebar/gfwlist2dnsmasq](https://github.com/cokebar/gfwlist2dnsmasq) 生成并加入到 `geosite:geolocation-!cn` 类别中
- **加入附加 GFWList 域名**:通过仓库 [@pexcn/gfwlist-extras](https://github.com/pexcn/gfwlist-extras) 获取并加入到 `geosite:geolocation-!cn` 类别中
- **加入 Greatfire Analyzer 检测到的屏蔽域名**:通过仓库 [@Loyalsoldier/cn-blocked-domain](https://github.com/Loyalsoldier/cn-blocked-domain) 获取 [Greatfire Analyzer](https://zh.greatfire.org/analyzer) 检测到的屏蔽域名,并加入到 `geosite:geolocation-!cn` 类别中
- **加入 GFWList 域名**
- 基于 [@gfwlist/gfwlist](https://github.com/gfwlist/gfwlist) 数据,通过仓库 [@cokebar/gfwlist2dnsmasq](https://github.com/cokebar/gfwlist2dnsmasq) 和 [@pexcn/gfwlist-extras](https://github.com/pexcn/gfwlist-extras) 生成
- 加入到 `geosite:gfw` 类别中,供习惯于 PAC 模式并希望使用 [GFWList](https://github.com/gfwlist/gfwlist) 的用户使用
- 同时加入到 `geosite:geolocation-!cn` 类别中
- **加入 Greatfire Analyzer 检测到的屏蔽域名**
- 通过仓库 [@Loyalsoldier/cn-blocked-domain](https://github.com/Loyalsoldier/cn-blocked-domain) 获取 [Greatfire Analyzer](https://zh.greatfire.org/analyzer) 检测到的在中国大陆被屏蔽的域名
- 加入到 `geosite:greatfire` 类别中,可与上面的 `geosite:gfw` 类别同时使用,以达到域名黑名单的效果
- 同时加入到 `geosite:geolocation-!cn` 类别中
- **加入 EasyList 和 EasyListChina 广告域名**:通过 [@AdblockPlus/EasylistChina+Easylist.txt](https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt) 获取并加入到 `geosite:category-ads-all` 类别中
- **加入 AdGuard DNS Filter 广告域名**:通过 [@AdGuard/DNS-filter](https://kb.adguard.com/en/general/adguard-ad-filters#dns-filter) 获取并加入到 `geosite:category-ads-all` 类别中
- **加入 Peter Lowe 广告和隐私跟踪域名**:通过 [@PeterLowe/adservers](https://pgl.yoyo.org/adservers) 获取并加入到 `geosite:category-ads-all` 类别中
@@ -35,11 +36,35 @@
**下载地址**
- **geoip.dat**[https://github.com/Loyalsoldier/v2ray-rules-dat/raw/release/geoip.dat](https://github.com/Loyalsoldier/v2ray-rules-dat/raw/release/geoip.dat)
- **geosite.dat**[https://github.com/Loyalsoldier/v2ray-rules-dat/raw/release/geosite.dat](https://github.com/Loyalsoldier/v2ray-rules-dat/raw/release/geosite.dat)
- **直连域名列表 direct-list.txt**[https://github.com/Loyalsoldier/v2ray-rules-dat/raw/release/direct-list.txt](https://github.com/Loyalsoldier/v2ray-rules-dat/raw/release/direct-list.txt)
- **代理域名列表 proxy-list.txt**[https://github.com/Loyalsoldier/v2ray-rules-dat/raw/release/proxy-list.txt](https://github.com/Loyalsoldier/v2ray-rules-dat/raw/release/proxy-list.txt)
- **广告域名列表 reject-list.txt**[https://github.com/Loyalsoldier/v2ray-rules-dat/raw/release/reject-list.txt](https://github.com/Loyalsoldier/v2ray-rules-dat/raw/release/reject-list.txt)
> 如果无法访问域名 `raw.githubusercontent.com`,可以使用第二个地址(`cdn.jsdelivr.net`),但是内容更新会有 12 小时的延迟。
- **geoip.dat**
- [https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/geoip.dat](https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/geoip.dat)
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geoip.dat](https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geoip.dat)
- **geosite.dat**
- [https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/geosite.dat](https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/geosite.dat)
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geosite.dat](https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geosite.dat)
- **直连域名列表 direct-list.txt**
- [https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/direct-list.txt](https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/direct-list.txt)
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/direct-list.txt](https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/direct-list.txt)
- **代理域名列表 proxy-list.txt**
- [https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/proxy-list.txt](https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/proxy-list.txt)
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/proxy-list.txt](https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/proxy-list.txt)
- **广告域名列表 reject-list.txt**
- [https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/reject-list.txt](https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/reject-list.txt)
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/reject-list.txt](https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/reject-list.txt)
- **Apple 在中国大陆可直连的域名列表 apple-cn.txt**
- [https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/apple-cn.txt](https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/apple-cn.txt)
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/apple-cn.txt](https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/apple-cn.txt)
- **Google 在中国大陆可直连的域名列表 google-cn.txt**
- [https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/google-cn.txt](https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/google-cn.txt)
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/google-cn.txt](https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/google-cn.txt)
- **GFWList 域名列表 gfw.txt**
- [https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/gfw.txt](https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/gfw.txt)
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/gfw.txt](https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/gfw.txt)
- **Greatfire 域名列表 greatfire.txt**
- [https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/greatfire.txt](https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/greatfire.txt)
- [https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/greatfire.txt](https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/greatfire.txt)
**使用方式**
@@ -99,7 +124,7 @@ scoop install v2ray-rules-dat
跟 V2Ray 官方 `geosite.dat` 配置方式相同。`geosite:apple-cn``geosite:google-cn` 为本项目特有的两个类别,分别包含 [@felixonmars/dnsmasq-china-list/apple.china.conf](https://github.com/felixonmars/dnsmasq-china-list/blob/master/apple.china.conf) 和 [@felixonmars/dnsmasq-china-list/google.china.conf](https://github.com/felixonmars/dnsmasq-china-list/blob/master/google.china.conf) 文件里的域名,供希望 Apple 和 Google 域名直连(不走代理)的用户使用。在 Routing 配置中,类别越靠前(上),优先级越高,所以 `geosite:apple-cn``geosite:google-cn` 要放置在 `geosite:geolocation-!cn` 前(上)面。配置参考下面 👇👇👇
**Routing 配置方式**
**白名单模式 Routing 配置方式**
```json
"routing": {
@@ -115,11 +140,10 @@ scoop install v2ray-rules-dat
"type": "field",
"outboundTag": "Direct",
"domain": [
"geosite:private",
"geosite:apple-cn",
"geosite:google-cn",
"geosite:tld-cn",
"domain:icloud.com",
"domain:icloud-content.com"
"geosite:tld-cn"
]
},
{
@@ -135,6 +159,132 @@ scoop install v2ray-rules-dat
"domain": [
"geosite:cn"
]
},
{
"type": "field",
"outboundTag": "Proxy",
"network": "tcp,udp"
}
]
}
```
**黑名单模式 Routing 配置方式:**
```json
"routing": {
"rules": [
{
"type": "field",
"outboundTag": "Reject",
"domain": [
"geosite:category-ads-all"
]
},
{
"type": "field",
"outboundTag": "Proxy",
"domain": [
"geosite:tld-!cn",
"geosite:gfw",
"geosite:greatfire"
]
},
{
"type": "field",
"outboundTag": "Proxy",
"ip": [
"149.154.167.99/32",
"149.154.175.10/32",
"149.154.167.40/32",
"149.154.167.42/32",
"149.154.175.117/32",
"149.154.175.50/32",
"149.154.167.50/32",
"149.154.167.51/32",
"149.154.175.100/32",
"149.154.167.91/32",
"149.154.167.90/32",
"149.154.165.120/32",
"149.154.166.120/32",
"149.154.164.250/32",
"149.154.167.117/32",
"149.154.167.118/32",
"149.154.167.192/27",
"149.154.164.8/29",
"91.108.8.0/27",
"91.108.12.0/27",
"91.108.16.0/27",
"91.108.56.0/24",
"91.108.4.0/24",
"149.154.160.0/22",
"149.154.164.0/22",
"149.154.168.0/22",
"149.154.172.0/22",
"91.108.56.0/22",
"91.108.4.0/22",
"91.108.8.0/22",
"91.108.16.0/22",
"91.108.12.0/22",
"149.154.160.0/20",
"2001:b28:f23d:f001::e/128",
"2001:67c:4e8:f002::e/128",
"2001:b28:f23d:f003::e/128",
"2001:b28:f23d:f001::a/128",
"2001:67c:4e8:f002::a/128",
"2001:b28:f23d:f003::a/128",
"2001:67c:4e8:f004::a/128",
"2001:b28:f23f:f005::a/128",
"2001:67c:4e8:fa60::/64",
"2001:b28:f23d::/48",
"2001:b28:f23f::/48",
"2001:67c:4e8::/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"
}
]
}
@@ -186,10 +336,12 @@ scoop install v2ray-rules-dat
"doh.pub": "119.29.29.29"
},
"servers": [
"https://dns.google/dns-query",
{
"address": "https+local://doh.pub/dns-query",
"address": "https+local://223.5.5.5/dns-query",
"domains": [
"geosite:cn"
"geosite:cn",
"geosite:icloud"
],
"expectIPs": [
"geoip:cn"
@@ -200,12 +352,6 @@ scoop install v2ray-rules-dat
"domains": [
"geosite:geolocation-!cn"
]
},
{
"address": "https+local://223.5.5.5/dns-query",
"domains": [
"geosite:tld-cn"
]
}
]
},
@@ -238,7 +384,7 @@ scoop install v2ray-rules-dat
],
"outbounds": [
{
//下面这行协议类别要改为socks、shadowsocksvmess等记得删除本行文字说明
//下面这行协议类别要改为socks、shadowsocksvmess或vless等(记得删除本行文字说明)
"protocol": "协议类别",
"settings": {},
//下面这行tag的值对应Routing里的outboundTag这里为Proxy记得删除本行文字说明
@@ -319,7 +465,8 @@ scoop install v2ray-rules-dat
"type": "field",
"outboundTag": "Direct",
"domain": [
"geosite:cn"
"geosite:cn",
"geosite:private"
]
},
{
@@ -347,12 +494,10 @@ scoop install v2ray-rules-dat
## 致谢
> This product includes GeoLite2 data created by MaxMind, available from [Maxmind](https://www.maxmind.com).
- [MaxMind GeoLite2 Free IP Database](https://dev.maxmind.com/geoip/geoip2/geolite2/)
- [@v2ray/geoip](https://github.com/v2ray/geoip)
- [@v2fly/geoip](https://github.com/v2fly/geoip)
- [@Loyalsoldier/geoip](https://github.com/Loyalsoldier/geoip)
- [@v2fly/domain-list-community](https://github.com/v2fly/domain-list-community)
- [@Loyalsoldier/domain-list-custom](https://github.com/Loyalsoldier/domain-list-custom)
- [@felixonmars/dnsmasq-china-list](https://github.com/felixonmars/dnsmasq-china-list)
- [@gfwlist/gfwlist](https://github.com/gfwlist/gfwlist)
- [@pexcn/gfwlist-extras](https://github.com/pexcn/gfwlist-extras)
@@ -360,7 +505,6 @@ scoop install v2ray-rules-dat
- [@Loyalsoldier/cn-blocked-domain](https://github.com/Loyalsoldier/cn-blocked-domain)
- [@GeQ1an/Rules](https://github.com/GeQ1an/Rules/tree/master/QuantumultX)
- [@lhie1/Rules](https://github.com/lhie1/Rules/tree/master)
- [@pexcn/daily/chnroute.txt](https://github.com/pexcn/daily/blob/gh-pages/chnroute/chnroute.txt)
- [@AdblockPlus/EasylistChina+Easylist.txt](https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt)
- [@AdGuard/DNS-filter](https://kb.adguard.com/en/general/adguard-ad-filters#dns-filter)
- [@PeterLowe/adservers](https://pgl.yoyo.org/adservers)