Skip to content

Commit

Permalink
feat: add extra cn_domain_list from ClashChinaMax (#9)
Browse files Browse the repository at this point in the history
* feat: add extra cn_domain_list

* patch: sync upstream

* fix: fix syntax error

* docs: update README

* fix: fix syntax error

* fix: fix syntax error

* fix: fix syntax error

* fix: fix conflicts

* fix: fix conflicts

* chore(deps): bump up go version to v.1.21.x
  • Loading branch information
piyoki authored Dec 28, 2023
1 parent 1e2246f commit 15881d4
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 26 deletions.
32 changes: 19 additions & 13 deletions .github/workflows/cron-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Setup Go 1.x.y
uses: actions/setup-go@v3
with:
go-version: ^1.19
go-version: ^1.21

- name: Set variables
shell: bash
Expand All @@ -25,7 +25,10 @@ jobs:
echo "WIN_SPY=https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/spy.txt" >> $GITHUB_ENV
echo "WIN_UPDATE=https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/update.txt" >> $GITHUB_ENV
echo "WIN_EXTRA=https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/extra.txt" >> $GITHUB_ENV
# ads list
echo "CHINA_MAX_DOMAINS_EXTRA_URL=https://github.com/blackmatrix7/ios_rule_script/raw/master/rule/Clash/ChinaMax/ChinaMax_Domain.txt" >> $GITHUB_ENV
# extra ip list
echo "CHINA_MAX_IP_EXTRA_URL=https://github.com/blackmatrix7/ios_rule_script/raw/master/rule/Clash/ChinaMax/ChinaMax_IP.txt" >> $GITHUB_ENV
# extra ads list
echo "PETERLOWE_REJECT_URL=https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=1&mimetype=plaintext" >> $GITHUB_ENV
echo "DANPOLLOCK_REJECT_URL=https://someonewhocares.org/hosts/hosts" >> $GITHUB_ENV
echo "ANTI_AD_REJECT_URL=https://raw.githubusercontent.com/privacy-protection-tools/anti-AD/master/anti-ad-domains.txt" >> $GITHUB_ENV
Expand All @@ -40,24 +43,24 @@ jobs:
echo "NEODEVPRO_ADS_REJECT_URL=https://raw.githubusercontent.com/neodevpro/neodevhost/master/adblocker" >> $GITHUB_ENV
- name: Checkout the "hidden" branch of this repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: hidden

- name: Checkout Loyalsoldier/domain-list-custom
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: Loyalsoldier/domain-list-custom
path: custom

- name: Checkout v2fly/domain-list-community
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: v2fly/domain-list-community
path: community

- name: Checkout cokebar/gfwlist2dnsmasq
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: cokebar/gfwlist2dnsmasq
path: gfwlist2dnsmasq
Expand All @@ -80,7 +83,6 @@ jobs:
- 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
Expand Down Expand Up @@ -116,6 +118,8 @@ jobs:
cat temp-proxy.txt | sort --ignore-case -u > proxy-list-with-redundant
cat temp-direct.txt | sort --ignore-case -u > direct-list-with-redundant
cat temp-reject.txt | sort --ignore-case -u > reject-list-with-redundant
# extras
cat $CHINA_MAX_DOMAINS_EXTRA_URL | sort --ignore-case -u > direct-list-with-redundant
- name: Remove redundant domains
run: |
Expand Down Expand Up @@ -154,8 +158,10 @@ jobs:
cp ./community/data/geolocation-\!cn proxy-list.txt
cp ./community/data/category-ads-all reject-list.txt
- name: Create google-cn, apple-cn, gfw, greatfire lists
- 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 $APPLE_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "full:$1\n"' > ./community/data/apple-cn
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
Expand All @@ -173,7 +179,7 @@ jobs:
install -Dp ./geoip.dat ./publish/geoip.dat
install -Dp ./geoip.dat.sha256sum ./publish/geoip.dat.sha256sum
install -Dp ./custom/publish/geosite.dat ./publish/geosite.dat
install -p {proxy,direct,reject}-list.txt ./publish/
install -p {china,proxy,direct,reject}-list.txt ./publish/
cd ./publish || exit 1
zip rules.zip {proxy,direct,reject}-list.txt geoip.dat geosite.dat
sha256sum geosite.dat > geosite.dat.sha256sum
Expand All @@ -192,10 +198,10 @@ jobs:
- name: Setup Go 1.x.y
uses: actions/setup-go@v3
with:
go-version: ^1.19
go-version: ^1.21

- name: Checkout techprober/v2dat
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: techprober/v2dat

Expand Down Expand Up @@ -260,7 +266,7 @@ jobs:
echo "RELEASE_DATE=$(date +%Y-%m-%d-%H-%M)" >> $GITHUB_ENV
- name: Checkout the master branch of this repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Copy artifacts from build job to local path
uses: actions/download-artifact@v3
Expand All @@ -282,7 +288,7 @@ jobs:
mv geosite.zip geosite/ publish/
- name: Release and upload assets
uses: softprops/action-gh-release@v0.1.15
uses: softprops/action-gh-release@master
with:
name: ${{ env.RELEASE_DATE }}
tag_name: ${{ env.RELEASE_DATE }}
Expand Down
31 changes: 18 additions & 13 deletions .github/workflows/staging-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Setup Go 1.x.y
uses: actions/setup-go@v3
with:
go-version: ^1.19
go-version: ^1.21

- name: Set variables
shell: bash
Expand All @@ -28,7 +28,9 @@ jobs:
echo "WIN_SPY=https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/spy.txt" >> $GITHUB_ENV
echo "WIN_UPDATE=https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/update.txt" >> $GITHUB_ENV
echo "WIN_EXTRA=https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/extra.txt" >> $GITHUB_ENV
# ads list
# extra ip list
echo "CHINA_MAX_IP_EXTRA_URL=https://github.com/blackmatrix7/ios_rule_script/raw/master/rule/Clash/ChinaMax/ChinaMax_IP.txt" >> $GITHUB_ENV
# extra ads list
echo "PETERLOWE_REJECT_URL=https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=1&mimetype=plaintext" >> $GITHUB_ENV
echo "DANPOLLOCK_REJECT_URL=https://someonewhocares.org/hosts/hosts" >> $GITHUB_ENV
echo "ANTI_AD_REJECT_URL=https://raw.githubusercontent.com/privacy-protection-tools/anti-AD/master/anti-ad-domains.txt" >> $GITHUB_ENV
Expand All @@ -43,24 +45,24 @@ jobs:
echo "NEODEVPRO_ADS_REJECT_URL=https://raw.githubusercontent.com/neodevpro/neodevhost/master/adblocker" >> $GITHUB_ENV
- name: Checkout the "hidden" branch of this repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: hidden

- name: Checkout Loyalsoldier/domain-list-custom
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: Loyalsoldier/domain-list-custom
path: custom

- name: Checkout v2fly/domain-list-community
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: v2fly/domain-list-community
path: community

- name: Checkout cokebar/gfwlist2dnsmasq
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: cokebar/gfwlist2dnsmasq
path: gfwlist2dnsmasq
Expand All @@ -83,7 +85,6 @@ jobs:
- 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
Expand Down Expand Up @@ -119,6 +120,8 @@ jobs:
cat temp-proxy.txt | sort --ignore-case -u > proxy-list-with-redundant
cat temp-direct.txt | sort --ignore-case -u > direct-list-with-redundant
cat temp-reject.txt | sort --ignore-case -u > reject-list-with-redundant
# extras
cat $CHINA_MAX_DOMAINS_EXTRA_URL | sort --ignore-case -u > direct-list-with-redundant
- name: Remove redundant domains
run: |
Expand Down Expand Up @@ -157,8 +160,10 @@ jobs:
cp ./community/data/geolocation-\!cn proxy-list.txt
cp ./community/data/category-ads-all reject-list.txt
- name: Create google-cn, apple-cn, gfw, greatfire lists
- 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 $APPLE_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "full:$1\n"' > ./community/data/apple-cn
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
Expand All @@ -176,7 +181,7 @@ jobs:
install -Dp ./geoip.dat ./publish/geoip.dat
install -Dp ./geoip.dat.sha256sum ./publish/geoip.dat.sha256sum
install -Dp ./custom/publish/geosite.dat ./publish/geosite.dat
install -p {proxy,direct,reject}-list.txt ./publish/
install -p {china,proxy,direct,reject}-list.txt ./publish/
cd ./publish || exit 1
zip rules.zip {proxy,direct,reject}-list.txt geoip.dat geosite.dat
sha256sum geosite.dat > geosite.dat.sha256sum
Expand All @@ -195,10 +200,10 @@ jobs:
- name: Setup Go 1.x.y
uses: actions/setup-go@v3
with:
go-version: ^1.19
go-version: ^1.21

- name: Checkout techprober/v2dat
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: techprober/v2dat

Expand Down Expand Up @@ -263,7 +268,7 @@ jobs:
echo "RELEASE_DATE=$(date +%Y-%m-%d-%H-%M)" >> $GITHUB_ENV
- name: Checkout the master branch of this repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Copy artifacts from build job to local path
uses: actions/download-artifact@v3
Expand All @@ -285,7 +290,7 @@ jobs:
mv geosite.zip geosite/ publish/
- name: Release and upload assets
uses: softprops/action-gh-release@v0.1.15
uses: softprops/action-gh-release@master
with:
name: ${{ env.RELEASE_DATE }}
tag_name: ${{ env.RELEASE_DATE }}
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- **加入 uBlock Origin 隱私域名**:通过 [@uBlockOrigin/uAssets](https://github.com/uBlockOrigin/uAssets/raw/master/filters/privacy.txt) 获取并加入到 `geosite:category-ads-all` 类别中
- **加入 uBlock Origin 广告域名**:通过 [@uBlockOrigin/uAssets](https://github.com/uBlockOrigin/uAssets/raw/master/filters/filter.txt) 获取并加入到 `geosite:category-ads-all` 类别中
- **加入 NeoDev Host 广告域名**:通过 [@neodevpro/neodevhost](https://raw.githubusercontent.com/neodevpro/neodevhost/master/adblocker) 获取并加入到 `geosite:category-ads-all` 类别中
- **加入 ClashChinaMax 域名**:通过 [@blackmatrix7/ios_rule_script](https://github.com/blackmatrix7/ios_rule_script/raw/master/rule/Clash/ChinaMax/ChinaMax_Domain.txt) 获取并加入到 `geosite:cn` 类别中

## 规则文件生成方式

Expand Down

0 comments on commit 15881d4

Please # to comment.