CI & Docs: refine workflow & README (#530)

Co-authored-by: anthropic-code-agent[bot] <242468646+Claude@users.noreply.github.com>
Co-authored-by: Loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
Claude
2026-10-01 09:25:12 +08:00
committed by GitHub
parent 5c20d2eb5a
commit b8ee45341f
2 changed files with 42 additions and 34 deletions
+40 -32
View File
@@ -8,11 +8,19 @@ on:
- master
paths-ignore:
- "**/README.md"
pull_request:
branches:
- master
paths-ignore:
- "**/README.md"
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Set variables
run: |
@@ -74,27 +82,27 @@ jobs:
- 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 ${CUSTOM_DIRECT} | perl -ne '/^(domain):([^:]+)(\n$|:@.+)/ && print "$2\n"' >> temp-direct.txt
curl -L --retry 3 --fail-with-body "$CHINA_DOMAINS_URL" | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' > temp-direct.txt
curl -L --retry 3 --fail-with-body "$CUSTOM_DIRECT" | perl -ne '/^(domain):([^:]+)(\n$|:@.+)/ && print "$2\n"' >> temp-direct.txt
- name: Get and add proxy domains into temp-proxy.txt file
run: |
cat ./gfwlist2dnsmasq/temp-gfwlist.txt | 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 ${CUSTOM_PROXY} | grep -Ev ":@cn" | perl -ne '/^(domain):([^:]+)(\n$|:@.+)/ && print "$2\n"' >> temp-proxy.txt
curl -L --retry 3 --fail-with-body "$GOOGLE_DOMAINS_URL" | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' >> temp-proxy.txt
curl -L --retry 3 --fail-with-body "$APPLE_DOMAINS_URL" | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' >> temp-proxy.txt
curl -L --retry 3 --fail-with-body "$CUSTOM_PROXY" | perl -ne 'next if /:\@cn/; /^(domain):([^:]+)(\n$|:@.+)/ && print "$2\n"' >> temp-proxy.txt
- name: Get and add reject domains into temp-reject.txt file
run: |
curl -sSL $EASYLISTCHINA_EASYLIST_REJECT_URL | perl -ne '/^\|\|([-_0-9a-zA-Z]+(\.[-_0-9a-zA-Z]+){1,64})\^$/ && print "$1\n"' | perl -ne 'print if not /^[0-9]{1,3}(\.[0-9]{1,3}){3}$/' > temp-reject.txt
curl -sSL $ADGUARD_DNS_REJECT_URL | perl -ne '/^\|\|([-_0-9a-zA-Z]+(\.[-_0-9a-zA-Z]+){1,64})\^$/ && print "$1\n"' | perl -ne 'print if not /^[0-9]{1,3}(\.[0-9]{1,3}){3}$/' >> temp-reject.txt
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
curl -L --retry 3 --fail-with-body "$EASYLISTCHINA_EASYLIST_REJECT_URL" | perl -ne '/^\|\|([-_0-9a-zA-Z]+(\.[-_0-9a-zA-Z]+){1,64})\^$/ && print "$1\n"' | perl -ne 'print if not /^[0-9]{1,3}(\.[0-9]{1,3}){3}$/' > temp-reject.txt
curl -L --retry 3 --fail-with-body "$ADGUARD_DNS_REJECT_URL" | perl -ne '/^\|\|([-_0-9a-zA-Z]+(\.[-_0-9a-zA-Z]+){1,64})\^$/ && print "$1\n"' | perl -ne 'print if not /^[0-9]{1,3}(\.[0-9]{1,3}){3}$/' >> temp-reject.txt
curl -L --retry 3 --fail-with-body "$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 -L --retry 3 --fail-with-body "$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 `full`, `regexp` and `keyword` type of rules from custom lists to "reserve" files
run: |
curl -sSL ${CUSTOM_DIRECT} | perl -ne '/^((full|regexp|keyword):[^:]+)(\n$|:@.+)/ && print "$1\n"' | sort --ignore-case -u > direct-reserve.txt
curl -sSL ${CUSTOM_PROXY} | grep -Ev ":@cn" | perl -ne '/^((full|regexp|keyword):[^:]+)(\n$|:@.+)/ && print "$1\n"' | sort --ignore-case -u > proxy-reserve.txt
curl -L --retry 3 --fail-with-body "$CUSTOM_DIRECT" | perl -ne '/^((full|regexp|keyword):[^:]+)(\n$|:@.+)/ && print "$1\n"' | sort --ignore-case -u > direct-reserve.txt
curl -L --retry 3 --fail-with-body "$CUSTOM_PROXY" | perl -ne 'next if /:\@cn/; /^((full|regexp|keyword):[^:]+)(\n$|:@.+)/ && print "$1\n"' | sort --ignore-case -u > proxy-reserve.txt
- name: Add proxy, direct and reject domains from "hidden" branch to appropriate temp files
run: |
@@ -117,18 +125,15 @@ jobs:
[ ! -f "direct-list-deleted-unsort" ] && touch direct-list-deleted-unsort
[ ! -f "proxy-list-deleted-unsort" ] && touch proxy-list-deleted-unsort
[ ! -f "reject-list-deleted-unsort" ] && touch reject-list-deleted-unsort
sort ./direct-list-deleted-unsort > ./direct-list-deleted-sort
sort ./proxy-list-deleted-unsort > ./proxy-list-deleted-sort
sort ./reject-list-deleted-unsort > ./reject-list-deleted-sort
diff ./direct-list-deleted-sort ./direct-list-with-redundant | awk '/^>/{print $2}' > ./direct-list-without-redundant
diff ./proxy-list-deleted-sort ./proxy-list-with-redundant | awk '/^>/{print $2}' > ./proxy-list-without-redundant
diff ./reject-list-deleted-sort ./reject-list-with-redundant | awk '/^>/{print $2}' > ./reject-list-without-redundant
grep -Fvxif ./direct-list-deleted-unsort ./direct-list-with-redundant > ./direct-list-without-redundant || [ "$?" -eq 1 ]
grep -Fvxif ./proxy-list-deleted-unsort ./proxy-list-with-redundant > ./proxy-list-without-redundant || [ "$?" -eq 1 ]
grep -Fvxif ./reject-list-deleted-unsort ./reject-list-with-redundant > ./reject-list-without-redundant || [ "$?" -eq 1 ]
- name: Remove domains from "need-to-remove" lists in "hidden" branch
run: |
diff ./direct-need-to-remove.txt ./direct-list-without-redundant | awk '/^>/{print $2}' > temp-cn.txt
diff ./proxy-need-to-remove.txt ./proxy-list-without-redundant | awk '/^>/{print $2}' > temp-geolocation-\!cn.txt
diff ./reject-need-to-remove.txt ./reject-list-without-redundant | awk '/^>/{print $2}' > temp-category-ads-all.txt
grep -Fvxif ./direct-need-to-remove.txt ./direct-list-without-redundant > temp-cn.txt || [ "$?" -eq 1 ]
grep -Fvxif ./proxy-need-to-remove.txt ./proxy-list-without-redundant > temp-geolocation-\!cn.txt || [ "$?" -eq 1 ]
grep -Fvxif ./reject-need-to-remove.txt ./reject-list-without-redundant > temp-category-ads-all.txt || [ "$?" -eq 1 ]
- name: Write lists to data directory
run: |
@@ -150,21 +155,21 @@ jobs:
- name: Create `china-list`、`google-cn`、`apple-cn`、`gfw`、`greatfire` lists
run: |
curl -sSL $CHINA_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' > ./community/data/china-list
curl -sSL $CHINA_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' > china-list.txt
curl -sSL $GOOGLE_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "full:$1\n"' > ./community/data/google-cn
curl -sSL $GOOGLE_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "full:$1\n"' > google-cn.txt
curl -sSL $APPLE_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "full:$1\n"' > ./community/data/apple-cn
curl -sSL $APPLE_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "full:$1\n"' > apple-cn.txt
curl -L --retry 3 --fail-with-body "$CHINA_DOMAINS_URL" | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' > ./community/data/china-list
curl -L --retry 3 --fail-with-body "$CHINA_DOMAINS_URL" | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' > china-list.txt
curl -L --retry 3 --fail-with-body "$GOOGLE_DOMAINS_URL" | perl -ne '/^server=\/([^\/]+)\// && print "full:$1\n"' > ./community/data/google-cn
curl -L --retry 3 --fail-with-body "$GOOGLE_DOMAINS_URL" | perl -ne '/^server=\/([^\/]+)\// && print "full:$1\n"' > google-cn.txt
curl -L --retry 3 --fail-with-body "$APPLE_DOMAINS_URL" | perl -ne '/^server=\/([^\/]+)\// && print "full:$1\n"' > ./community/data/apple-cn
curl -L --retry 3 --fail-with-body "$APPLE_DOMAINS_URL" | perl -ne '/^server=\/([^\/]+)\// && print "full:$1\n"' > apple-cn.txt
cat ./gfwlist2dnsmasq/temp-gfwlist.txt | 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
cat ./community/data/gfw | sort --ignore-case -u > gfw.txt
cat ./community/data/greatfire | sort --ignore-case -u > greatfire.txt
curl -sSL $WIN_SPY | grep "0.0.0.0" | awk '{print $2}' > ./community/data/win-spy
curl -sSL $WIN_SPY | grep "0.0.0.0" | awk '{print $2}' > win-spy.txt
curl -sSL $WIN_UPDATE | grep "0.0.0.0" | awk '{print $2}' > ./community/data/win-update
curl -sSL $WIN_UPDATE | grep "0.0.0.0" | awk '{print $2}' > win-update.txt
curl -sSL $WIN_EXTRA | grep "0.0.0.0" | awk '{print $2}' > ./community/data/win-extra
curl -sSL $WIN_EXTRA | grep "0.0.0.0" | awk '{print $2}' > win-extra.txt
curl -L --retry 3 --fail-with-body "$WIN_SPY" | grep "0.0.0.0" | awk '{print $2}' > ./community/data/win-spy
curl -L --retry 3 --fail-with-body "$WIN_SPY" | grep "0.0.0.0" | awk '{print $2}' > win-spy.txt
curl -L --retry 3 --fail-with-body "$WIN_UPDATE" | grep "0.0.0.0" | awk '{print $2}' > ./community/data/win-update
curl -L --retry 3 --fail-with-body "$WIN_UPDATE" | grep "0.0.0.0" | awk '{print $2}' > win-update.txt
curl -L --retry 3 --fail-with-body "$WIN_EXTRA" | grep "0.0.0.0" | awk '{print $2}' > ./community/data/win-extra
curl -L --retry 3 --fail-with-body "$WIN_EXTRA" | grep "0.0.0.0" | awk '{print $2}' > win-extra.txt
- name: Build geosite.dat file
run: |
@@ -185,6 +190,7 @@ jobs:
sha256sum rules.zip > rules.zip.sha256sum
- name: Release and upload assets
if: github.event_name != 'pull_request'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
@@ -194,6 +200,7 @@ jobs:
file: ./publish/*
- name: Git push assets to "release" branch
if: github.event_name != 'pull_request'
run: |
cd publish || exit 1
git init
@@ -206,6 +213,7 @@ jobs:
git push -f -u origin release
- name: Purge jsdelivr CDN
if: github.event_name != 'pull_request'
run: |
cd publish || exit 1
for file in $(ls); do
+2 -2
View File
@@ -45,7 +45,7 @@
- [**慎用**] Windows 操作系统附加的隐私跟踪域名 [@crazy-max/WindowsSpyBlocker/hosts/extra.txt](https://github.com/crazy-max/WindowsSpyBlocker/blob/master/data/hosts/extra.txt) 加入到 `geosite:win-extra` 类别中
- 关于这三个类别的使用方式,请参考下面 [geosite 的 Routing 配置方式](https://github.com/Loyalsoldier/v2ray-rules-dat#geositedat-1)
- **可添加自定义直连、代理和广告域名**:由于上游域名列表更新缓慢或缺失某些域名,所以引入**需要添加的域名**列表。[`hidden 分支`](https://github.com/Loyalsoldier/v2ray-rules-dat/tree/hidden)里的三个文件 `direct.txt`、`proxy.txt` 和 `reject.txt`,分别存放自定义的需要添加的直连、代理、广告域名,最终分别加入到 `geosite:cn`、`geosite:geolocation-!cn` 和 `geosite:category-ads-all` 类别中
- **可移除自定义直连、代理和广告域名**:由于上游域名列表存在需要被移除的域名,所以引入**需要移除的域名**列表。[`hidden 分支`](https://github.com/Loyalsoldier/v2ray-rules-dat/tree/hidden)里的三个文件 `direct-need-to-remove.txt`、`proxy-need-to-remove.txt` 和 `reject-need-to-remove.txt`,分别存放自定义的需要从 `direct-list`(直连域名列表)、`proxy-list`(代理域名列表)和 `reject-list`(广告域名列表) 移除的域名
- **可移除自定义直连、代理和广告域名**:由于上游域名列表存在需要被移除的域名,所以引入**需要移除的域名**列表。[`hidden 分支`](https://github.com/Loyalsoldier/v2ray-rules-dat/tree/hidden)里的三个文件 `direct-need-to-remove.txt`、`proxy-need-to-remove.txt` 和 `reject-need-to-remove.txt`,分别存放自定义的需要从 `direct-list`(直连域名列表)、`proxy-list`(代理域名列表)和 `reject-list`(广告域名列表)移除的域名
## 规则文件下载地址
@@ -193,7 +193,7 @@ steampowered.com.8686c.com @cn
steamstatic.com.8686c.com @cn
```
对于玩 Steam 国区游戏,想要直连的用户,可以设置类别 `geosite:steam@cn` 为直连,意为将 [steam](https://github.com/v2fly/domain-list-community/blob/master/data/steam) 列表内所有被标记了 `@cn` attribute 的规则(域名)设置为直连。同理,由于 [category-games](https://github.com/v2fly/domain-list-community/blob/master/data/category-games) 列表包含了 `steam`、`ea`、`blizzard`、`epicgames` 和 `nintendo` 等常见的游戏厂商。设置类别 `geosite:category-games@cn` 为直连,即可节省大量服务器流量。
对于玩 Steam 国区游戏,想要直连的用户,可以设置类别 `geosite:steam@cn` 为直连,意为将 [steam](https://github.com/v2fly/domain-list-community/blob/master/data/steam) 列表内所有被标记了 `@cn` attribute 的规则(域名)设置为直连。同理,由于 [category-games](https://github.com/v2fly/domain-list-community/blob/master/data/category-games) 列表包含了 `steam`、`ea`、`blizzard`、`epicgames` 和 `nintendo` 等常见的游戏厂商,设置类别 `geosite:category-games@cn` 为直连,即可节省大量服务器流量。
> ⚠️ 注意:在 Routing 配置中,类别越靠前(上),优先级越高,所以 `geosite:category-games@cn` 等所有带有 `@cn` attribute 的规则都要放置在 `geosite:geolocation-!cn` 前(上)面才能生效。
>