Last active
December 16, 2021 16:42
-
-
Save Acris/3b6645d10c6c975bab1b12dba95ed76e to your computer and use it in GitHub Desktop.
Update shadowsocks rules on OpenWrt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e -o pipefail | |
# Configure dnsmasq | |
mkdir -p /etc/dnsmasq.d | |
uci set dhcp.@dnsmasq[0].confdir=/etc/dnsmasq.d | |
uci set dhcp.@dnsmasq[0].cachesize=10000 | |
uci commit dhcp | |
# Download rules | |
wget -O - 'https://cdn.jsdelivr.net/gh/17mon/china_ip_list@master/china_ip_list.txt' | sed '/^#/d' > /tmp/china_ip_list.txt | |
wget -O - 'https://cdn.jsdelivr.net/gh/cokebar/gfwlist2dnsmasq@gh-pages/dnsmasq_gfwlist.conf' | sed '/^#/d' | sed "s/127.0.0.1#5353/127.0.0.1#25300/g" > /tmp/dnsmasq_gfwlist.conf | |
wget -O - 'https://cdn.jsdelivr.net/gh/felixonmars/dnsmasq-china-list@master/accelerated-domains.china.conf' | sed '/^#/d' | sed "s/114.114.114.114/119.29.29.29/g" > /tmp/accelerated-domains.china.conf | |
wget -O - 'https://cdn.jsdelivr.net/gh/felixonmars/dnsmasq-china-list@master/google.china.conf' | sed '/^#/d' | sed "s/114.114.114.114/119.29.29.29/g" > /tmp/google.china.conf | |
wget -O - 'https://cdn.jsdelivr.net/gh/felixonmars/dnsmasq-china-list@master/apple.china.conf' | sed '/^#/d' | sed "s/114.114.114.114/119.29.29.29/g" > /tmp/apple.china.conf | |
mv /tmp/china_ip_list.txt /etc/china_ip_list.txt | |
mv /tmp/dnsmasq_gfwlist.conf /etc/dnsmasq.d/dnsmasq_gfwlist.conf | |
mv /tmp/accelerated-domains.china.conf /etc/dnsmasq.d/accelerated-domains.china.conf | |
mv /tmp/google.china.conf /etc/dnsmasq.d/google.china.conf | |
mv /tmp/apple.china.conf /etc/dnsmasq.d/apple.china.conf | |
# Restart service | |
/etc/init.d/shadowsocks rules | |
/etc/init.d/dnsmasq restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment