Skip to content

Rules

Rules #1090

Workflow file for this run

name: Rules
on:
schedule:
- cron: 0 16 * * *
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Run BanAD rules
run: |
curl -s https://ruleset.skk.moe/List/domainset/reject.conf | sed -e '/#/d' -e 's/^\.//' -e '/\.$/d' > sukka-reject.txt
curl -s https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/reject-list.txt > loyal-reject.txt
curl -s https://raw.githubusercontent.com/privacy-protection-tools/anti-AD/master/anti-ad-domains.txt | sed -e '/#/d' > anti-reject.txt
cat *-reject.txt custom/reject.txt | sort -u | sed -e '/^$/d' -e 's/^/+./' > reject.txt
sed -i "1i # $(echo Total: $(wc -l <reject.txt) lines\; Last Updated: $(date) )" reject.txt
rm -rf *-reject.txt
- name: Run cnip rules
run: |
curl -s https://raw.githubusercontent.com/tmplink/IPDB/main/ipv4/cidr/CN.txt > cnip.txt
curl -s https://raw.githubusercontent.com/misakaio/chnroutes2/master/chnroutes.txt | sed "/#/d" >> cnip.txt
curl -s https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/lancidr.txt | sed -e '/payload/d' -e "s/^ - '//" -e "s/'//" >> cnip.txt
# text format: cnip.txt
# yaml format
sed -e "s/^/ - \'/" -e "s/$/\'/" -e "1i payload:" cnip.txt > CNIP.yaml
# GoogleIP
echo "payload:" > ./GoogleIP.yaml
curl -s https://www.gstatic.com/ipranges/goog.json | jq --raw-output '.prefixes[] | select(.ipv4Prefix != null ) | .ipv4Prefix' | while read line; do echo " - '$line'" >> ./GoogleIP.yaml; done
curl -s https://www.gstatic.com/ipranges/cloud.json | jq --raw-output '.prefixes[] | select(.ipv4Prefix != null ) | .ipv4Prefix' | while read line; do echo " - '$line'" >> ./GoogleIP.yaml; done
curl -s https://www.gstatic.com/ipranges/goog.json | jq --raw-output '.prefixes[] | select(.ipv6Prefix != null ) | .ipv6Prefix' | while read line; do echo " - '$line'" >> ./GoogleIP.yaml; done
curl -s https://www.gstatic.com/ipranges/cloud.json | jq --raw-output '.prefixes[] | select(.ipv6Prefix != null ) | .ipv6Prefix' | while read line; do echo " - '$line'" >> ./GoogleIP.yaml; done
- name: Run proxy rules
run: |
curl -s https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/proxy.txt | sed -e '/payload/d' -e "s/^ - '//" -e "s/'//" > proxy.txt
# curl -s https://raw.githubusercontent.com/Kr328/V2rayDomains2Clash/generated/category-porn.yaml | sed -e "/#/d" -e "/payload:/d" -e '/^$/d' -e 's/- "//' -e 's/"//' >> proxy.txt
# curl -s https://raw.githubusercontent.com/Kr328/V2rayDomains2Clash/generated/lark.yaml | sed -e "/#/d" -e "/payload:/d" -e '/^$/d' -e 's/- "//' -e 's/"//' >> proxy.txt
sort -u proxy.txt -o proxy.txt
- name: Run CN domain rules
run: |
curl -s https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/accelerated-domains.china.conf | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' > accelerated-domains.china.conf
curl -s https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/apple.china.conf | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' > apple.china.conf
curl -s https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/google.china.conf | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' > google.china.conf
sed -i '/apps.apple.com/d' apple.china.conf
# Adguard rule
cat accelerated-domains.china.conf apple.china.conf google.china.conf | tr "\n" "/" | sed -e 's|^|/|' -e 's|\(.*\)|[\1]h3://223.5.5.5/dns-query|' > accelerated-domains.china.adguardhome.conf
echo "" >> accelerated-domains.china.adguardhome.conf
echo "h3://1.1.1.1/dns-query" >> accelerated-domains.china.adguardhome.conf
#echo "https://8.8.8.8/dns-query" >> accelerated-domains.china.adguardhome.conf
echo "https://208.67.222.222/dns-query" >> accelerated-domains.china.adguardhome.conf
# Clash rule text format
# cat accelerated-domains.china.conf apple.china.conf google.china.conf | sed -e "s/^/+./" -e /^\+\.top$/d > direct.txt
#(include microsoft@cn apple@cn google@cn and etc)
# curl -s https://raw.githubusercontent.com/Kr328/V2rayDomains2Clash/generated/geolocation-%[email protected] | sed -e "/#/d" -e "/payload:/d" -e '/^$/d' -e 's/- "//' -e 's/"//' > direct.txt
# curl -s https://raw.githubusercontent.com/Kr328/V2rayDomains2Clash/generated/geolocation-cn.yaml | sed -e "/#/d" -e "/payload:/d" -e '/^$/d' -e 's/- "//' -e 's/"//' >> direct.txt
curl -s https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/google.txt | sed -e '/payload:/d' -e "s/^ - '//" -e "s/'$//" > direct.txt
curl -s https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/private.txt| sed -e '/payload:/d' -e "s/^ - '//" -e "s/'$//" >> direct.txt
sort -u direct.txt -o direct.txt
rm -rf google.china.conf
rm -rf apple.china.conf
rm -rf accelerated-domains.china.conf
- name: Run Push
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git add .
git commit -m "Update Rule"
git push -f