luci-app-ssr-plus:Adjust uci-defaults (#4010)

This commit is contained in:
Mattraks 2020-03-26 19:14:15 +08:00 committed by CN_SZTL
parent 8e79b57e36
commit 53693fbedb
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
2 changed files with 24 additions and 21 deletions

View File

@ -373,7 +373,7 @@ start_redir() {
else else
threads=$(uci_get_by_type global threads) threads=$(uci_get_by_type global threads)
fi fi
if [ "$stype" == "ss" -o "$stype" == "ssr" ]; then if [ "$stype" == "ss" -o "$stype" == "ssr" ]; then
local last_config_file=$CONFIG_FILE local last_config_file=$CONFIG_FILE
local pid_file="/var/run/ssr-retcp.pid" local pid_file="/var/run/ssr-retcp.pid"
@ -606,7 +606,7 @@ start_local() {
rules() { rules() {
if [ "$GLOBAL_SERVER" == "nil" ]; then if [ "$GLOBAL_SERVER" == "nil" ]; then
return 1 return 1
else else
redir_tcp=1 redir_tcp=1
fi fi
mkdir -p /var/run /var/etc mkdir -p /var/run /var/etc
@ -627,12 +627,12 @@ start() {
GLOBAL_SERVER=$switch_server GLOBAL_SERVER=$switch_server
switch_enable=1 switch_enable=1
fi fi
NETFLIX_SERVER=$(uci_get_by_type global netflix_server nil) NETFLIX_SERVER=$(uci_get_by_type global netflix_server nil)
if [ "$NETFLIX_SERVER" == "same" ]; then if [ "$NETFLIX_SERVER" == "same" ]; then
NETFLIX_SERVER=$GLOBAL_SERVER NETFLIX_SERVER=$GLOBAL_SERVER
fi fi
if rules; then if rules; then
start_redir start_redir
mkdir -p /tmp/dnsmasq.d && cp -a /etc/dnsmasq.ssr /tmp/ && cp -a /etc/dnsmasq.oversea /tmp/ mkdir -p /tmp/dnsmasq.d && cp -a /etc/dnsmasq.ssr /tmp/ && cp -a /etc/dnsmasq.oversea /tmp/
@ -652,35 +652,31 @@ start() {
if [ "$NETFLIX_SERVER" != "nil" ]; then if [ "$NETFLIX_SERVER" != "nil" ]; then
if [ "$NETFLIX_SERVER" != "$GLOBAL_SERVER" ]; then if [ "$NETFLIX_SERVER" != "$GLOBAL_SERVER" ]; then
cat /etc/config/netflix.list | while read line || [ -n "$line" ]; cat /etc/config/netflix.list | while read line || [ -n "$line" ]; do
do
sed -i "/$line/d" /tmp/dnsmasq.ssr/gfw_list.conf sed -i "/$line/d" /tmp/dnsmasq.ssr/gfw_list.conf
done done
awk '!/^$/&&!/^#/{printf("ipset=/.%s/'"netflix"'\n",$0)}' /etc/config/netflix.list > /tmp/dnsmasq.ssr/netflix_forward.conf awk '!/^$/&&!/^#/{printf("ipset=/.%s/'"netflix"'\n",$0)}' /etc/config/netflix.list >/tmp/dnsmasq.ssr/netflix_forward.conf
awk '!/^$/&&!/^#/{printf("server=/.%s/'"127.0.0.1#5555"'\n",$0)}' /etc/config/netflix.list >> /tmp/dnsmasq.ssr/netflix_forward.conf awk '!/^$/&&!/^#/{printf("server=/.%s/'"127.0.0.1#5555"'\n",$0)}' /etc/config/netflix.list >>/tmp/dnsmasq.ssr/netflix_forward.conf
ipset -N netflix hash:net 2>/dev/null ipset -N netflix hash:net 2>/dev/null
cat /etc/config/netflixip.list | while read nip || [ -n "$nip" ]; cat /etc/config/netflixip.list | while read nip || [ -n "$nip" ]; do
do
ipset add netflix $nip 2>/dev/null ipset add netflix $nip 2>/dev/null
done done
else else
cat /etc/config/netflix.list | while read line || [ -n "$line" ]; cat /etc/config/netflix.list | while read line || [ -n "$line" ]; do
do
sed -i "/$line/d" /tmp/dnsmasq.ssr/gfw_list.conf sed -i "/$line/d" /tmp/dnsmasq.ssr/gfw_list.conf
done done
awk '!/^$/&&!/^#/{printf("ipset=/.%s/'"netflix"'\n",$0)}' /etc/config/netflix.list > /tmp/dnsmasq.ssr/netflix_forward.conf awk '!/^$/&&!/^#/{printf("ipset=/.%s/'"netflix"'\n",$0)}' /etc/config/netflix.list >/tmp/dnsmasq.ssr/netflix_forward.conf
awk '!/^$/&&!/^#/{printf("server=/.%s/'"127.0.0.1#5335"'\n",$0)}' /etc/config/netflix.list >> /tmp/dnsmasq.ssr/netflix_forward.conf awk '!/^$/&&!/^#/{printf("server=/.%s/'"127.0.0.1#5335"'\n",$0)}' /etc/config/netflix.list >>/tmp/dnsmasq.ssr/netflix_forward.conf
ipset -N netflix hash:net 2>/dev/null ipset -N netflix hash:net 2>/dev/null
cat /etc/config/netflixip.list | while read nip || [ -n "$nip" ]; cat /etc/config/netflixip.list | while read nip || [ -n "$nip" ]; do
do
ipset add netflix $nip 2>/dev/null ipset add netflix $nip 2>/dev/null
done done
fi fi
else else
rm -f /tmp/dnsmasq.ssr/netflix_forward.conf rm -f /tmp/dnsmasq.ssr/netflix_forward.conf
fi fi
/etc/init.d/dnsmasq restart >/dev/null 2>&1 /etc/init.d/dnsmasq restart >/dev/null 2>&1
fi fi
start_server start_server
@ -752,5 +748,3 @@ stop() {
fi fi
del_cron del_cron
} }

View File

@ -13,8 +13,17 @@ uci -q batch <<-EOF >/dev/null
commit firewall commit firewall
EOF EOF
killall -q -9 ssr-monitor ss-redir ssr-redir ss-local ssr-local obfs-local v2ray-plugin v2ray trojan ipt2socks ssr-server kcptun-client dns2socks microsocks redsocks2 touch /etc/china_ssr.txt
/usr/share/shadowsocksr/gfw2ipset.sh touch /etc/config/white.list
touch /etc/config/black.list
touch /etc/config/netflix.list
touch /etc/config/netflixip.list
touch /etc/dnsmasq.ssr/ad.conf
touch /etc/dnsmasq.ssr/gfw_list.conf
/etc/init.d/shadowsocksr enable
/etc/init.d/shadowsocksr stop
rm -rf /tmp/luci-modulecache/* rm -rf /tmp/luci-modulecache/*
rm -f /tmp/luci-indexcache rm -f /tmp/luci-indexcache
exit 0 exit 0