Skip to content

Auto Update China IPs #424

Auto Update China IPs

Auto Update China IPs #424

name: Auto Update China IPs
on:
schedule:
- cron: '0 0 * * *'
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Update IPs
run: |
wget -c http://ftp.apnic.net/stats/apnic/delegated-apnic-latest
cat delegated-apnic-latest | awk -F '|' '/CN/&&/ipv4/ {print $4 "/" 32-log($5)/log(2)}' > raw_ips.txt
echo "# > Domestic IPs" > Surge/Surge 3/Provider/Domestic IPs.list
echo "payload:" > Clash/Provider/Domestic IPs.yaml
cat raw_ips.txt | awk '{print "IP-CIDR, "$1", no-resolve"}' >> Surge/Surge 3/Provider/Domestic IPs.list
cat raw_ips.txt | awk '{print " - "$1}' >> Clash/Provider/Domestic IPs.yaml
- name: Commit and push
run: |
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Action"
git add .
git commit -m "Update China IPs"
git push