Skip to content

Update gfwlist

Update gfwlist #7297

Workflow file for this run

name: Update gfwlist
on:
schedule:
- cron: '*/5 * * * *'
push:
branches:
- main
jobs:
update-gfwlist:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Download gfwlist.txt
run: curl -O https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt
- name: Decode base64
run: base64 -d gfwlist.txt > decoded_gfwlist.txt
- name: Process decoded file
run: |
grep -v '^!' decoded_gfwlist.txt | grep -v '^@' | grep -v '^\[' > processed_gfwlist.txt
- name: Replace '||' with empty value
run: sed -i 's/||//g' processed_gfwlist.txt
- name: Remove lines containing '|' or '/'
run: grep -v '[|/]' processed_gfwlist.txt > cleaned_gfwlist.txt
- name: Remove leading '.' from lines
run: sed -i 's/^\.//' cleaned_gfwlist.txt
- name: Remove lines without '.'
run: grep '\.' cleaned_gfwlist.txt > filtered_gfwlist.txt
- name: Remove specific lines
run: |
grep -v -e '14.102.250.18' \
-e '14.102.250.19' \
-e '50.7.31.230:8898' \
-e '174.142.105.153' \
-e '69.65.19.160' \
filtered_gfwlist.txt > final_gfwlist.txt
- name: Remove duplicate lines
run: sort -u final_gfwlist.txt > unique_gfwlist.txt
- name: Create zone file
run: |
while read -r line; do
echo " - zone: $line" >> fen.txt
echo " recurse: true" >> fen.txt
echo " forwarders:" >> fen.txt
echo " - 149.112.112.11:9953" >> fen.txt
echo " - 149.112.112.10:9953" >> fen.txt
echo " - 9.9.9.11:9953" >> fen.txt
echo " - 9.9.9.10:9953" >> fen.txt
done < unique_gfwlist.txt
- name: Create data directory
run: mkdir -p data
- name: Move final files
run: |
mv unique_gfwlist.txt data/
mv fen.txt data/
- name: Commit changes
run: |
git config --local user.name "GitHub Actions"
git config --local user.email "[email protected]"
git add data/unique_gfwlist.txt
git add data/fen.txt
git commit -m "Update processed gfwlist and generate fen.txt" || echo "No changes to commit"
git push