update
10009
rules/Routing.txt
Normal file
53068
rules/WhiteList.txt
Normal file
53194
rules/WhiteList_new.txt
Normal file
22955
rules/adblock.conf
Normal file
14
rules/auto_update/.gitignore
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
accelerated-domains.china.conf
|
||||
apnic.txt
|
||||
apple.china.conf
|
||||
cdn1.txt
|
||||
cdn_download.txt
|
||||
chnroute1.txt
|
||||
gfwlist1.conf
|
||||
gfwlist_download.conf
|
||||
gfwlist_download_tmp.conf
|
||||
google.china.conf
|
||||
Routing.txt
|
||||
WhiteList.txt
|
||||
WhiteList_new.txt
|
||||
WhiteList_tmp.txt
|
6183
rules/auto_update/cdn_koolshare.txt
Executable file
88
rules/auto_update/fwlist.py
Executable file
@ -0,0 +1,88 @@
|
||||
#!/usr/bin/env python
|
||||
#coding=utf-8
|
||||
#
|
||||
# Generate a list of dnsmasq rules with ipset for gfwlist
|
||||
#
|
||||
# Copyright (C) 2014 http://www.shuyz.com
|
||||
# Ref https://code.google.com/p/autoproxy-gfwlist/wiki/Rules
|
||||
|
||||
import sys
|
||||
import urllib2
|
||||
import re
|
||||
import os
|
||||
import datetime
|
||||
import base64
|
||||
#import shutil
|
||||
|
||||
#mydnsip = '127.0.0.1'
|
||||
#mydnsport = '1053'
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
print("fwlist.py outfile.txt")
|
||||
sys.exit(-1)
|
||||
|
||||
outfile = sys.argv[1]
|
||||
|
||||
# the url of gfwlist
|
||||
baseurl = 'https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt'
|
||||
# baseurl = 'https://autoproxy-gfwlist.googlecode.com/svn/trunk/gfwlist.txt'
|
||||
# match comments/title/whitelist/ip address
|
||||
comment_pattern = '^\!|\[|^@@|^\d+\.\d+\.\d+\.\d+'
|
||||
domain_pattern = '([\w\-\_]+\.[\w\.\-\_]+)[\/\*]*'
|
||||
tmpfile = '/tmp/gfwlisttmp'
|
||||
# do not write to router internal flash directly
|
||||
#outfile = '/tmp/gfwlist.conf'
|
||||
#rulesfile = '/etc/dnsmasq.d/gfwlist.conf'
|
||||
|
||||
fs = file(outfile, 'w')
|
||||
#fs.write('# gfw list ipset rules for dnsmasq\n')
|
||||
#fs.write('# updated on ' + datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") + '\n')
|
||||
#fs.write('#\n')
|
||||
|
||||
print 'fetching list...'
|
||||
content = urllib2.urlopen(baseurl, timeout=15).read().decode('base64')
|
||||
|
||||
# write the decoded content to file then read line by line
|
||||
tfs = open(tmpfile, 'w')
|
||||
tfs.write(content)
|
||||
tfs.close()
|
||||
tfs = open(tmpfile, 'r')
|
||||
|
||||
print 'page content fetched, analysis...'
|
||||
|
||||
# remember all blocked domains, in case of duplicate records
|
||||
domainlist = []
|
||||
|
||||
for line in tfs.readlines():
|
||||
if re.findall(comment_pattern, line):
|
||||
#print 'this is a comment line: ' + line
|
||||
#fs.write('#' + line)
|
||||
pass
|
||||
else:
|
||||
domain = re.findall(domain_pattern, line)
|
||||
if domain:
|
||||
try:
|
||||
found = domainlist.index(domain[0])
|
||||
#print domain[0] + ' exists.'
|
||||
except ValueError:
|
||||
#print 'saving ' + domain[0]
|
||||
domainlist.append(domain[0])
|
||||
#fs.write('server=/.%s/%s#%s\n'%(domain[0],mydnsip,mydnsport))
|
||||
#fs.write('ipset=/.%s/gfwlist\n'%domain[0])
|
||||
fs.write('%s\n'%domain[0])
|
||||
else:
|
||||
#print 'no valid domain in this line: ' + line
|
||||
pass
|
||||
|
||||
tfs.close()
|
||||
fs.close();
|
||||
|
||||
#print 'moving generated file to dnsmasg directory'
|
||||
#print outfile
|
||||
#shutil.move(outfile, rulesfile)
|
||||
|
||||
#print 'restart dnsmasq...'
|
||||
#print os.popen('/etc/init.d/dnsmasq restart').read()
|
||||
|
||||
print 'saving to file: ', outfile
|
||||
print 'done!'
|
83
rules/auto_update/gfwlist_koolshare.conf
Normal file
@ -0,0 +1,83 @@
|
||||
services.googleapis.cn
|
||||
google.com.ao
|
||||
google.com.bw
|
||||
google.com.ck
|
||||
google.com.cr
|
||||
google.com.id
|
||||
google.com.il
|
||||
google.com.in
|
||||
google.com.jp
|
||||
google.com.ke
|
||||
google.com.kr
|
||||
google.com.ls
|
||||
google.com.ma
|
||||
google.com.mz
|
||||
google.com.nz
|
||||
google.com.th
|
||||
google.com.tz
|
||||
google.com.ug
|
||||
google.com.uk
|
||||
google.com.uz
|
||||
google.com.ve
|
||||
google.com.vi
|
||||
google.com.za
|
||||
google.com.zm
|
||||
google.com.zw
|
||||
google.com.af
|
||||
google.com.ag
|
||||
google.com.ai
|
||||
google.com.ar
|
||||
google.com.au
|
||||
google.com.bd
|
||||
google.com.bh
|
||||
google.com.bn
|
||||
google.com.bo
|
||||
google.com.br
|
||||
google.com.bz
|
||||
google.com.cu
|
||||
google.com.cy
|
||||
google.com.do
|
||||
google.com.ec
|
||||
google.com.eg
|
||||
google.com.et
|
||||
google.com.fj
|
||||
google.com.gh
|
||||
google.com.gi
|
||||
google.com.gt
|
||||
google.com.hk
|
||||
google.com.jm
|
||||
google.com.kh
|
||||
google.com.kw
|
||||
google.com.lb
|
||||
google.com.ly
|
||||
google.com.mm
|
||||
google.com.mt
|
||||
google.com.mx
|
||||
google.com.my
|
||||
google.com.na
|
||||
google.com.nf
|
||||
google.com.ng
|
||||
google.com.ni
|
||||
google.com.np
|
||||
google.com.om
|
||||
google.com.pa
|
||||
google.com.pe
|
||||
google.com.pg
|
||||
google.com.ph
|
||||
google.com.pk
|
||||
google.com.pr
|
||||
google.com.py
|
||||
google.com.qa
|
||||
google.com.sa
|
||||
google.com.sb
|
||||
google.com.sg
|
||||
google.com.sl
|
||||
google.com.sv
|
||||
google.com.tj
|
||||
google.com.tr
|
||||
google.com.ua
|
||||
google.com.uy
|
||||
google.com.vc
|
||||
google.com.vn
|
||||
google.com.it
|
||||
google.co.th
|
162
rules/auto_update/update_rules.sh
Executable file
@ -0,0 +1,162 @@
|
||||
#!/bin/sh
|
||||
CurrentDate=`date +%Y-%m-%d`
|
||||
# ======================================
|
||||
# get gfwlist for shadowsocks ipset mode
|
||||
./fwlist.py gfwlist_download.conf
|
||||
|
||||
grep -Ev "([0-9]{1,3}[\.]){3}[0-9]{1,3}" gfwlist_download.conf > gfwlist_download_tmp.conf
|
||||
|
||||
if [ -f "gfwlist_download.conf" ];then
|
||||
cat gfwlist_download_tmp.conf gfwlist_koolshare.conf | grep -Ev "([0-9]{1,3}[\.]){3}[0-9]{1,3}" | sed "s/^/server=&\/./g" | sed "s/$/\/127.0.0.1#7913/g" > gfwlist_merge.conf
|
||||
cat gfwlist_download_tmp.conf gfwlist_koolshare.conf | sed "s/^/ipset=&\/./g" | sed "s/$/\/gfwlist/g" >> gfwlist_merge.conf
|
||||
fi
|
||||
|
||||
sort -k 2 -t. -u gfwlist_merge.conf > gfwlist1.conf
|
||||
rm gfwlist_merge.conf
|
||||
|
||||
# delete site below
|
||||
sed -i '/m-team/d' "gfwlist1.conf"
|
||||
sed -i '/windowsupdate/d' "gfwlist1.conf"
|
||||
sed -i '/v2ex/d' "gfwlist1.conf"
|
||||
|
||||
md5sum1=$(md5sum gfwlist1.conf | sed 's/ /\n/g'| sed -n 1p)
|
||||
md5sum2=$(md5sum ../gfwlist.conf | sed 's/ /\n/g'| sed -n 1p)
|
||||
|
||||
echo =================
|
||||
if [ "$md5sum1"x = "$md5sum2"x ];then
|
||||
echo gfwlist same md5!
|
||||
else
|
||||
echo update gfwlist!
|
||||
cp -f gfwlist1.conf ../gfwlist.conf
|
||||
sed -i "1c `date +%Y-%m-%d` # $md5sum1 gfwlist" ../version1
|
||||
fi
|
||||
echo =================
|
||||
# ======================================
|
||||
# get chnroute for shadowsocks chn and game mode
|
||||
wget -4 -O- http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest > apnic.txt
|
||||
cat apnic.txt| awk -F\| '/CN\|ipv4/ { printf("%s/%d\n", $4, 32-log($5)/log(2)) }' > chnroute1.txt
|
||||
|
||||
md5sum3=$(md5sum chnroute1.txt | sed 's/ /\n/g'| sed -n 1p)
|
||||
md5sum4=$(md5sum ../chnroute.txt | sed 's/ /\n/g'| sed -n 1p)
|
||||
|
||||
echo =================
|
||||
if [ "$md5sum3"x = "$md5sum4"x ];then
|
||||
echo chnroute same md5!
|
||||
else
|
||||
echo update chnroute!
|
||||
cp -f chnroute1.txt ../chnroute.txt
|
||||
sed -i "2c `date +%Y-%m-%d` # $md5sum3 chnroute" ../version1
|
||||
fi
|
||||
echo =================
|
||||
# ======================================
|
||||
# get cdn list for shadowsocks chn and game mode
|
||||
|
||||
wget -4 https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/accelerated-domains.china.conf
|
||||
|
||||
cat accelerated-domains.china.conf | sed '/^#/d' |sed "s/server=\/\.//g" | sed "s/server=\///g" | sed -r "s/\/\S{1,30}//g" | sed -r "s/\/\S{1,30}//g" > cdn_download.txt
|
||||
cat cdn_koolshare.txt cdn_download.txt | sort -u > cdn1.txt
|
||||
|
||||
md5sum5=$(md5sum cdn1.txt | sed 's/ /\n/g'| sed -n 1p)
|
||||
md5sum6=$(md5sum ../cdn.txt | sed 's/ /\n/g'| sed -n 1p)
|
||||
|
||||
echo =================
|
||||
if [ "$md5sum5"x = "$md5sum6"x ];then
|
||||
echo cdn list same md5!
|
||||
else
|
||||
echo update cdn!
|
||||
cp -f cdn1.txt ../cdn.txt
|
||||
sed -i "4c `date +%Y-%m-%d` # $md5sum5 cdn" ../version1
|
||||
fi
|
||||
echo =================
|
||||
# ======================================
|
||||
|
||||
echo -e "[Local Routing]\n## China mainland routing blocks\n## Sources: https://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest" > Routing.txt
|
||||
echo -n "## Last update: " >> Routing.txt
|
||||
echo $CurrentDate >> Routing.txt
|
||||
echo -e "\n" >> Routing.txt
|
||||
|
||||
# IPv4
|
||||
echo "## IPv4" >> Routing.txt
|
||||
cat apnic.txt | grep ipv4 | grep CN | awk -F\| '{printf("%s/%d\n", $4, 32-log($5)/log(2))}' >> Routing.txt
|
||||
echo "\n" >> Routing.txt
|
||||
|
||||
# IPv6
|
||||
echo "## IPv6" >> Routing.txt
|
||||
cat apnic.txt | grep ipv6 | grep CN | awk -F\| '{printf("%s/%d\n", $4, $5)}' >> Routing.txt
|
||||
|
||||
[ ! -f "../Routing.txt" ] && cp Routing.txt ..
|
||||
|
||||
md5sum9=$(md5sum Routing.txt | sed 's/ /\n/g'| sed -n 1p)
|
||||
md5sum10=$(md5sum ../Routing.txt | sed 's/ /\n/g'| sed -n 1p)
|
||||
echo =================
|
||||
if [ "$md5sum9"x = "$md5sum10"x ];then
|
||||
echo Routing same md5!
|
||||
else
|
||||
echo update Routing!
|
||||
cp Routing.txt ..
|
||||
sed -i "5c `date +%Y-%m-%d` # $md5sum9 Routing" ../version1
|
||||
fi
|
||||
echo =================
|
||||
# ======================================
|
||||
sed 's|/114.114.114.114$||' accelerated-domains.china.conf > WhiteList_tmp.txt
|
||||
sed -i 's|\(\.\)|\\\1|g' WhiteList_tmp.txt
|
||||
sed -i 's|server=/|.*\\\b|' WhiteList_tmp.txt
|
||||
sed -i 's|b\(cn\)$|\.\1|' WhiteList_tmp.txt
|
||||
|
||||
echo '[Local Hosts]' >> WhiteList.txt
|
||||
echo '## China mainland domains' >> WhiteList.txt
|
||||
echo '## Get the latest database: https://github.com/xinhugo/Free-List/blob/master/WhiteList.txt' >> WhiteList.txt
|
||||
echo '## Report an issue: https://github.com/xinhugo/Free-List/issues' >> WhiteList.txt
|
||||
echo "## Last update: $DATE\n" >> WhiteList.txt
|
||||
cat WhiteList_tmp.txt >> WhiteList.txt
|
||||
|
||||
[ ! -f "../WhiteList.txt" ] && mv WhiteList_tmp.txt >> WhiteList.txt
|
||||
|
||||
md5sum7=$(md5sum WhiteList.txt | sed 's/ /\n/g'| sed -n 1p)
|
||||
md5sum8=$(md5sum ../WhiteList.txt | sed 's/ /\n/g'| sed -n 1p)
|
||||
echo =================
|
||||
if [ "$md5sum7"x = "$md5sum8"x ];then
|
||||
echo WhiteList same md5!
|
||||
else
|
||||
echo update WhiteList!
|
||||
cp -f WhiteList.txt ../WhiteList.txt
|
||||
sed -i "6c `date +%Y-%m-%d` # $md5sum7 WhiteList" ../version1
|
||||
fi
|
||||
echo =================
|
||||
|
||||
# ======================================
|
||||
echo -e "[Local Hosts]\n## China mainland domains\n## Source: https://github.com/felixonmars/dnsmasq-china-list" > WhiteList_new.txt
|
||||
echo -n "## Last update: " >> WhiteList_new.txt
|
||||
echo $CurrentDate >> WhiteList_new.txt
|
||||
echo -e "\n" >> WhiteList_new.txt
|
||||
sed -e "s|114.114.114.114$||" -e "s|^s|S|" accelerated-domains.china.conf >> WhiteList_new.txt
|
||||
|
||||
# Download domain data of Google in Mainland China part.
|
||||
curl -O https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/google.china.conf
|
||||
sed -e "s|114.114.114.114$||" -e "s|^s|S|" google.china.conf >> WhiteList_new.txt
|
||||
|
||||
# Download domain data of Apple in Mainland China part.
|
||||
curl -O https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/apple.china.conf
|
||||
sed -e "s|114.114.114.114$||" -e "s|^s|S|" apple.china.conf >> WhiteList_new.txt
|
||||
|
||||
# ok
|
||||
[ ! -f "../WhiteList_new.txt" ] && cp WhiteList_new.txt ..
|
||||
|
||||
md5sum11=$(md5sum WhiteList_new.txt | sed 's/ /\n/g'| sed -n 1p)
|
||||
md5sum12=$(md5sum ../WhiteList_new.txt | sed 's/ /\n/g'| sed -n 1p)
|
||||
echo =================
|
||||
if [ "$md5sum11"x = "$md5sum12"x ];then
|
||||
echo WhiteList_new same md5!
|
||||
else
|
||||
echo update WhiteList_new!
|
||||
cp WhiteList_new.txt ..
|
||||
sed -i "7c `date +%Y-%m-%d` # $md5sum11 WhiteList_new" ../version1
|
||||
fi
|
||||
echo =================
|
||||
|
||||
# ======================================
|
||||
rm google.china.conf
|
||||
rm apple.china.conf
|
||||
rm gfwlist1.conf gfwlist_download.conf gfwlist_download_tmp.conf chnroute1.txt
|
||||
rm cdn1.txt accelerated-domains.china.conf cdn_download.txt
|
||||
rm WhiteList.txt WhiteList_tmp.txt apnic.txt WhiteList_new.txt Routing.txt
|
2
rules/auto_update/useage.txt
Normal file
@ -0,0 +1,2 @@
|
||||
# recommend using corntab running update_rules.sh regularly
|
||||
cru a rule_update "0 2 * * * /bin/sh update_rules.sh"
|
53527
rules/cdn.txt
Normal file
8328
rules/chnroute.txt
Normal file
11090
rules/gfwlist.conf
Normal file
7
rules/version1
Normal file
@ -0,0 +1,7 @@
|
||||
2019-01-24 # 98a81fbd36f946a414b988e2bb0ad49e gfwlist
|
||||
2019-01-24 # a24b9b039cdc6019c8d83cab509e44d8 chnroute
|
||||
2016-02-26 # 7c8569e96bc6893a146d5e093a3b0434 adblock
|
||||
2019-01-24 # d6987bb4b420af51bfe18df9fe04b2d5 cdn
|
||||
2019-01-24 # 4bd07c5b723e1c67d296b78b08ebe134 Routing
|
||||
2019-01-24 # 567387b6a8b850dc71b6880c22b30235 WhiteList
|
||||
2019-01-24 # e559c6e415c59209612e0e3625d4d05a WhiteList_new
|
@ -2,9 +2,9 @@
|
||||
|
||||
|
||||
MODULE=shadowsocks
|
||||
VERSION=3.0.6
|
||||
TITLE=shadowsocks
|
||||
DESCRIPTION=shadowsocks
|
||||
VERSION=4.1.7
|
||||
TITLE=科学上网
|
||||
DESCRIPTION=科学上网
|
||||
HOME_URL=Main_Ss_Content.asp
|
||||
|
||||
# Check and include base
|
||||
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"version":"3.0.5",
|
||||
"md5":"becf4b1e5191c63c7958c115e521b197",
|
||||
"version":"4.1.7",
|
||||
"md5":"f8b25718146bccb438bd70d111f222fa",
|
||||
"home_url":"Main_Ss_Content.asp",
|
||||
"title":"shadowsocks",
|
||||
"description":"shadowsocks",
|
||||
"build_date":"2019-01-23_20:45:50"
|
||||
"title":"科学上网",
|
||||
"description":"科学上网",
|
||||
"build_date":"2019-01-25_00:00:12"
|
||||
}
|
||||
|
BIN
shadowsocks/history/4.1.7/shadowsocks.tar.gz
Normal file
@ -1 +1,2 @@
|
||||
3.0.5 8e2dcfc093371d6b90df36170c1d4ed5
|
||||
4.1.7 13be05f48754e5ea11ffd8a96248c238
|
||||
|
BIN
shadowsocks/shadowsocks/bin/cdns
Executable file
BIN
shadowsocks/shadowsocks/bin/chinadns1
Executable file
BIN
shadowsocks/shadowsocks/bin/geoip.dat
Normal file
2506
shadowsocks/shadowsocks/bin/geosite.dat
Normal file
BIN
shadowsocks/shadowsocks/bin/haveged
Executable file
BIN
shadowsocks/shadowsocks/bin/https_dns_proxy
Executable file
BIN
shadowsocks/shadowsocks/bin/jq
Executable file
BIN
shadowsocks/shadowsocks/bin/koolbox
Executable file
BIN
shadowsocks/shadowsocks/bin/udp2raw
Executable file
BIN
shadowsocks/shadowsocks/bin/udpspeederv1
Executable file
BIN
shadowsocks/shadowsocks/bin/udpspeederv2
Executable file
BIN
shadowsocks/shadowsocks/bin/v2ctl
Executable file
BIN
shadowsocks/shadowsocks/bin/v2ray
Executable file
@ -1,41 +0,0 @@
|
||||
#!/bin/sh
|
||||
eval `dbus export shadowsocks`
|
||||
eval `dbus export ss`
|
||||
source /jffs/softcenter/scripts/base.sh
|
||||
|
||||
|
||||
kill_socks5(){
|
||||
kill `ps | grep ss-local | grep -v "grep" | grep -v "23456"|awk '{print $1}'` >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# Start ss-local
|
||||
start_socks5(){
|
||||
|
||||
if [ "$ss_local_enable" == "1" ]; then
|
||||
echo $(date): enable ss_local...
|
||||
ss-local -b 0.0.0.0 -s "$ss_local_server" -p "$ss_local_port" -l "$ss_local_proxyport" -k "$ss_local_password" -m "$ss_local_method" -u -f /var/run/ss_local.pid
|
||||
echo $(date): done
|
||||
echo $(date):
|
||||
fi
|
||||
}
|
||||
|
||||
case $ACTION in
|
||||
start)
|
||||
if [ "$ss_local_enable" == "1" ];then
|
||||
start_socks5
|
||||
fi
|
||||
;;
|
||||
stop | kill )
|
||||
kill_socks5
|
||||
;;
|
||||
restart)
|
||||
kill_socks5
|
||||
start_socks5
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 (start|stop|restart)"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
|
@ -1,143 +1,152 @@
|
||||
#! /bin/sh
|
||||
|
||||
eval `dbus export ss`
|
||||
alias echo_date='echo $(date +%Y年%m月%d日\ %X):'
|
||||
alias echo_date='echo 【$(TZ=UTC-8 date -R +%Y年%m月%d日\ %X)】:'
|
||||
mkdir -p /jffs/softcenter/ss
|
||||
mkdir -p /tmp/ss_backup
|
||||
|
||||
remove_conf(){
|
||||
ipset_value=`dbus list ss_ipset | cut -d "=" -f 1`
|
||||
redchn_value=`dbus list ss_redchn | cut -d "=" -f 1`
|
||||
overall_value=`dbus list ss_overall_ | cut -d "=" -f 1`
|
||||
for conf in $ipset_value $redchn_value $overall_value
|
||||
do
|
||||
echo 移除$conf
|
||||
dbus remove $conf
|
||||
done
|
||||
}
|
||||
|
||||
remove_conf
|
||||
# 判断路由架构和平台
|
||||
case $(uname -m) in
|
||||
mips)
|
||||
echo_date 固件平台【 merlin mips 】符合安装要求,开始安装插件!
|
||||
echo_date 固件平台【merlin mips】符合安装要求,开始安装插件!
|
||||
;;
|
||||
*)
|
||||
echo_date 本插件适用于 merlin mips固件平台,你的平台"$(uname -m)"不能安装!!!
|
||||
echo_date 本插件适用于merlin mips固件平台,你的平台"$(uname -m)"不能安装!!!
|
||||
echo_date 退出安装!
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# 关闭ss
|
||||
mkdir -p /jffs/softcenter/ss
|
||||
if [ "$ss_basic_enable" == "1" ];then
|
||||
echo_date 先关闭ss,保证文件更新成功!
|
||||
sh /jffs/softcenter/ss/stop.sh stop_all
|
||||
echo_date 先关闭科学上网插件,保证文件更新成功!
|
||||
sh /jffs/softcenter/ss/ssconfig.sh stop
|
||||
fi
|
||||
|
||||
if [ -n "`ls /jffs/softcenter/ss/postscripts/P*.sh 2>/dev/null`" ];then
|
||||
echo_date 备份触发脚本!
|
||||
find /jffs/softcenter/ss/postscripts -name "P*.sh" | xargs -i mv {} -f /tmp/ss_backup
|
||||
fi
|
||||
|
||||
#升级前先删除无关文件
|
||||
echo_date 清理旧文件
|
||||
rm -rf /jffs/softcenter/ss/*
|
||||
rm -rf /jffs/softcenter/scripts/ss_*
|
||||
rm -rf /jffs/softcenter/webs/Main_Ss*
|
||||
rm -rf /jffs/softcenter/bin/ss-*
|
||||
rm -rf /jffs/softcenter/bin/rss-*
|
||||
rm -rf /jffs/softcenter/bin/obfs*
|
||||
rm -rf /jffs/softcenter/bin/ss-redir
|
||||
rm -rf /jffs/softcenter/bin/ss-tunnel
|
||||
rm -rf /jffs/softcenter/bin/ss-local
|
||||
rm -rf /jffs/softcenter/bin/rss-redir
|
||||
rm -rf /jffs/softcenter/bin/rss-tunnel
|
||||
rm -rf /jffs/softcenter/bin/rss-local
|
||||
rm -rf /jffs/softcenter/bin/obfs-local
|
||||
rm -rf /jffs/softcenter/bin/koolgame
|
||||
rm -rf /jffs/softcenter/bin/pdu
|
||||
rm -rf /jffs/softcenter/bin/haproxy
|
||||
rm -rf /jffs/softcenter/bin/redsocks2
|
||||
rm -rf /jffs/softcenter/bin/pdnsd
|
||||
rm -rf /jffs/softcenter/bin/Pcap_DNSProxy
|
||||
rm -rf /jffs/softcenter/bin/dnscrypt-proxy
|
||||
rm -rf /jffs/softcenter/bin/dns2socks
|
||||
rm -rf /jffs/softcenter/bin/cdns
|
||||
rm -rf /jffs/softcenter/bin/client_linux_mips
|
||||
rm -rf /jffs/softcenter/bin/chinadns
|
||||
rm -rf /jffs/softcenter/bin/chinadns1
|
||||
rm -rf /jffs/softcenter/bin/resolveip
|
||||
rm -rf /jffs/softcenter/bin/udp2raw
|
||||
rm -rf /jffs/softcenter/bin/speeder*
|
||||
rm -rf /jffs/softcenter/bin/v2ray
|
||||
rm -rf /jffs/softcenter/bin/v2ctl
|
||||
rm -rf /jffs/softcenter/bin/jitterentropy-rngd
|
||||
rm -rf /jffs/softcenter/bin/haveged
|
||||
rm -rf /jffs/softcenter/bin/https_dns_proxy
|
||||
rm -rf /jffs/softcenter/bin/dnsmassq
|
||||
rm -rf /jffs/softcenter/res/layer
|
||||
rm -rf /jffs/softcenter/res/shadowsocks.css
|
||||
rm -rf /jffs/softcenter/res/icon-shadowsocks.png
|
||||
rm -rf /jffs/softcenter/res/ss-menu.js
|
||||
rm -rf /jffs/softcenter/res/all.png
|
||||
rm -rf /jffs/softcenter/res/gfwlist.png
|
||||
rm -rf /jffs/softcenter/res/chn.png
|
||||
rm -rf /jffs/softcenter/res/game.png
|
||||
rm -rf /jffs/softcenter/res/shadowsocks.css
|
||||
rm -rf /jffs/softcenter/res/gameV2.png
|
||||
rm -rf /jffs/softcenter/res/ss_proc_status.htm
|
||||
rm -rf /jffs/softcenter/init.d/S89Socks5.sh
|
||||
find /jffs/softcenter/init.d/ -name "*socks5.sh" | xargs rm -rf
|
||||
|
||||
|
||||
echo_date 复制新文件!
|
||||
echo_date 开始复制文件!
|
||||
cd /tmp
|
||||
|
||||
echo_date 复制相关二进制文件!
|
||||
echo_date 复制相关二进制文件!此步时间可能较长!
|
||||
echo_date 如果长时间没有日志刷新,请等待2分钟后进入插件看是否安装成功..。
|
||||
cp -rf /tmp/shadowsocks/bin/* /jffs/softcenter/bin/
|
||||
chmod 755 /jffs/softcenter/bin/*
|
||||
[ ! -L "/jffs/softcenter/bin/rss-tunnel" ] && cp -rf /jffs/softcenter/bin/rss-local /jffs/softcenter/bin/rss-tunnel
|
||||
|
||||
echo_date 复制ss的脚本文件!
|
||||
echo_date 复制相关的脚本文件!
|
||||
cp -rf /tmp/shadowsocks/ss/* /jffs/softcenter/ss/
|
||||
cp -rf /tmp/shadowsocks/scripts/* /jffs/softcenter/scripts/
|
||||
cp -rf /tmp/shadowsocks/init.d/* /jffs/softcenter/init.d/
|
||||
cp -rf /tmp/shadowsocks/install.sh /jffs/softcenter/scripts/ss_install.sh
|
||||
cp -rf /tmp/shadowsocks/uninstall.sh /jffs/softcenter/scripts/uninstall_shadowsocks.sh
|
||||
|
||||
echo_date 复制网页文件!
|
||||
echo_date 复制相关的网页文件!
|
||||
cp -rf /tmp/shadowsocks/webs/* /jffs/softcenter/webs/
|
||||
cp -rf /tmp/shadowsocks/res/* /jffs/softcenter/res/
|
||||
|
||||
echo_date 移除安装包!
|
||||
rm -rf /tmp/shadowsocks* >/dev/null 2>&1
|
||||
|
||||
|
||||
# transform data in skipd when ss version below 3.0.0
|
||||
curr_version=`dbus get ss_basic_version_local`
|
||||
comp=`/usr/sbin/versioncmp $curr_version 3.0.0`
|
||||
if [ -n "$curr_version" ] && [ "$comp" == "1" ];then
|
||||
echo_date 从ss3.0.0版本开始,将对界面内textarea内的值和ss的密码进行base64加密,方便储存!
|
||||
echo_date 生成当前SS版本:$curr_version的配置文件到/jffs根目录!
|
||||
dbus list ss > /jffs/ss_conf_backup_$curr_version.txt
|
||||
echo_date 对部分ss数据进行base64加密数据!
|
||||
node_pass=`dbus list ssconf_basic_password |cut -d "=" -f 1|cut -d "_" -f4|sort -n`
|
||||
for node in $node_pass
|
||||
do
|
||||
dbus set ssconf_basic_password_$node=`dbus get ssconf_basic_password_$node|base64`
|
||||
done
|
||||
dbus set ss_basic_password=`dbus get ss_basic_password|base64`
|
||||
dbus set ss_basic_black_lan=`dbus get ss_basic_black_lan | base64`
|
||||
dbus set ss_basic_white_lan=`dbus get ss_basic_white_lan | base64`
|
||||
dbus set ss_ipset_black_domain_web=`dbus get ss_ipset_black_domain_web | base64`
|
||||
dbus set ss_ipset_white_domain_web=`dbus get ss_ipset_white_domain_web | base64`
|
||||
dbus set ss_ipset_dnsmasq=`dbus get ss_ipset_dnsmasq | base64`
|
||||
dbus set ss_ipset_black_ip=`dbus get ss_ipset_black_ip | base64`
|
||||
dbus set ss_redchn_isp_website_web=`dbus get ss_redchn_isp_website_web | base64`
|
||||
dbus set ss_redchn_dnsmasq=`dbus get ss_redchn_dnsmasq | base64`
|
||||
dbus set ss_redchn_wan_white_ip=`dbus get ss_redchn_wan_white_ip | base64`
|
||||
dbus set ss_redchn_wan_white_domain=`dbus get ss_redchn_wan_white_domain | base64`
|
||||
dbus set ss_redchn_wan_black_ip=`dbus get ss_redchn_wan_black_ip | base64`
|
||||
dbus set ss_redchn_wan_black_domain=`dbus get ss_redchn_wan_black_domain | base64`
|
||||
fi
|
||||
|
||||
# 设置一些默认值
|
||||
echo_date 设置一些默认值
|
||||
[ -z "$ss_dns_china" ] && dbus set ss_dns_china=11
|
||||
[ -z "$ss_dns_foreign" ] && dbus set ss_dns_foreign=1
|
||||
[ -z "$ss_basic_ss_obfs" ] && dbus set ss_basic_ss_obfs=0
|
||||
[ -z "$ss_acl_default_mode" ] && dbus set ss_acl_default_mode="$ss_basic_mode"
|
||||
[ -z "$ss_acl_default_port" ] && dbus set ss_acl_default_port=all
|
||||
[ -z "$ss_dns_plan" ] && dbus set ss_dns_china=1
|
||||
[ -z "$ss_dns_plan_chn" ] && dbus set ss_dns_china=2
|
||||
[ -z "$ss_dns_plan_gfw" ] && dbus set ss_dns_china=1
|
||||
|
||||
echo_date 为新安装文件赋予执行权限...
|
||||
chmod 755 /jffs/softcenter/ss/cru/*
|
||||
chmod 755 /jffs/softcenter/ss/rules/*
|
||||
chmod 755 /jffs/softcenter/ss/socks5/*
|
||||
chmod 755 /jffs/softcenter/ss/*
|
||||
chmod 755 /jffs/softcenter/scripts/ss*
|
||||
chmod 755 /jffs/softcenter/bin/*
|
||||
|
||||
# add icon into softerware center
|
||||
dbus set softcenter_module_shadowsocks_install=1
|
||||
dbus set softcenter_module_shadowsocks_version=3.1.6
|
||||
dbus set softcenter_module_shadowsocks_home_url=Main_Ss_Content.asp
|
||||
if [ -n "`ls /tmp/ss_backup/P*.sh 2>/dev/null`" ];then
|
||||
echo_date 恢复触发脚本!
|
||||
mkdir -p /jffs/softcenter/ss/postscripts
|
||||
find /tmp/ss_backup -name "P*.sh" | xargs -i mv {} -f /jffs/softcenter/ss/postscripts
|
||||
fi
|
||||
|
||||
new_version=`cat /jffs/softcenter/ss/version`
|
||||
dbus set ss_basic_version_local=$new_version
|
||||
echo_date 创建一些二进制文件的软链接!
|
||||
[ ! -L "/jffs/softcenter/bin/rss-tunnel" ] && cp -rf /jffs/softcenter/bin/rss-local /jffs/softcenter/bin/rss-tunnel
|
||||
[ ! -L "/jffs/softcenter/bin/base64" ] && cp -rf /jffs/softcenter/bin/koolbox /jffs/softcenter/bin/base64
|
||||
[ ! -L "/jffs/softcenter/bin/shuf" ] && cp -rf /jffs/softcenter/bin/koolbox /jffs/softcenter/bin/shuf
|
||||
[ ! -L "/jffs/softcenter/bin/netstat" ] && cp -rf /jffs/softcenter/bin/koolbox /jffs/softcenter/bin/netstat
|
||||
[ ! -L "/jffs/softcenter/bin/base64_decode" ] && cp -rf /jffs/softcenter/bin/base64_encode /jffs/softcenter/bin/base64_decode
|
||||
[ ! -L "/jffs/softcenter/init.d/S99socks5.sh" ] && cp -rf /jffs/softcenter/scripts/ss_socks5.sh /jffs/softcenter/init.d/S99socks5.sh
|
||||
|
||||
echo_date 设置一些默认值
|
||||
[ -z "$ss_dns_china" ] && dbus set ss_dns_china=11
|
||||
[ -z "$ss_dns_foreign" ] && dbus set ss_dns_foreign=1
|
||||
[ -z "$ss_basic_ss_obfs" ] && dbus set ss_basic_ss_obfs=0
|
||||
[ -z "$ss_acl_default_mode" ] && [ -n "$ss_basic_mode" ] && dbus set ss_acl_default_mode="$ss_basic_mode"
|
||||
[ -z "$ss_acl_default_mode" ] && [ -z "$ss_basic_mode" ] && dbus set ss_acl_default_mode=1
|
||||
[ -z "$ss_acl_default_port" ] && dbus set ss_acl_default_port=all
|
||||
[ "$ss_basic_v2ray_network" == "ws_hd" ] && dbus set ss_basic_v2ray_network="ws"
|
||||
|
||||
# 移除一些没用的值
|
||||
dbus remove ss_basic_version
|
||||
|
||||
# 离线安装时设置软件中心内储存的版本号和连接
|
||||
CUR_VERSION=`cat /jffs/softcenter/ss/version`
|
||||
dbus set ss_basic_version_local="$CUR_VERSION"
|
||||
dbus set softcenter_module_shadowsocks_install="4"
|
||||
dbus set softcenter_module_shadowsocks_version="$CUR_VERSION"
|
||||
dbus set softcenter_module_shadowsocks_title="科学上网"
|
||||
dbus set softcenter_module_shadowsocks_description="科学上网"
|
||||
dbus set softcenter_module_shadowsocks_home_url="Main_Ss_Content.asp"
|
||||
|
||||
# 设置v2ray 版本号
|
||||
dbus set ss_basic_v2ray_version="v4.6.4"
|
||||
dbus set ss_basic_v2ray_date="20181124"
|
||||
|
||||
sleep 2
|
||||
echo_date 一点点清理工作...
|
||||
rm -rf /tmp/shadowsocks* >/dev/null 2>&1
|
||||
dbus set ss_basic_install_status="0"
|
||||
echo_date 安装更新成功,你为什么这么屌?!
|
||||
echo_date 科学上网插件安装成功!
|
||||
|
||||
if [ "$ss_basic_enable" == "1" ];then
|
||||
echo_date 重启ss!
|
||||
dbus set ss_basic_action=1
|
||||
. /jffs/softcenter/ss/ssconfig.sh restart
|
||||
sh /jffs/softcenter/ss/ssconfig.sh restart
|
||||
fi
|
||||
echo_date 更新完毕,请等待网页自动刷新!
|
||||
echo XU6J03M6
|
||||
|
||||
|
0
shadowsocks/shadowsocks/res/all.png
Executable file → Normal file
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
0
shadowsocks/shadowsocks/res/chn.png
Executable file → Normal file
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
BIN
shadowsocks/shadowsocks/res/game.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
shadowsocks/shadowsocks/res/gameV2.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
0
shadowsocks/shadowsocks/res/gfw.png
Executable file → Normal file
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
0
shadowsocks/shadowsocks/res/icon-shadowsocks.png
Executable file → Normal file
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 9.1 KiB |
652
shadowsocks/shadowsocks/res/layer/layer.js
Normal file
@ -0,0 +1,652 @@
|
||||
/*! layer-v3.1.0 Web弹层组件 MIT License http://layer.layui.com/ By 贤心 */ ;
|
||||
! function(e, t) {
|
||||
"use strict";
|
||||
var i, n, a = e.layui && layui.define,
|
||||
o = {
|
||||
getPath: function() {
|
||||
var e = document.scripts,
|
||||
t = e[e.length - 1],
|
||||
i = t.src;
|
||||
if (!t.getAttribute("merge")) return i.substring(0, i.lastIndexOf("/") + 1)
|
||||
}(),
|
||||
config: {},
|
||||
end: {},
|
||||
minIndex: 0,
|
||||
minLeft: [],
|
||||
btn: ["确定", "取消"],
|
||||
type: ["dialog", "page", "iframe", "loading", "tips"],
|
||||
getStyle: function(t, i) {
|
||||
var n = t.currentStyle ? t.currentStyle : e.getComputedStyle(t, null);
|
||||
return n[n.getPropertyValue ? "getPropertyValue" : "getAttribute"](i)
|
||||
},
|
||||
link: function(t, i, n) {
|
||||
if (r.path) {
|
||||
var a = document.getElementsByTagName("head")[0],
|
||||
s = document.createElement("link");
|
||||
"string" == typeof i && (n = i);
|
||||
var l = (n || t).replace(/\.|\//g, ""),
|
||||
f = "layuicss-" + l,
|
||||
c = 0;
|
||||
s.rel = "stylesheet", s.href = r.path + t, s.id = f, document.getElementById(f) || a.appendChild(s), "function" == typeof i && ! function u() {
|
||||
return ++c > 80 ? e.console && console.error("layer.css: Invalid") : void(1989 === parseInt(o.getStyle(document.getElementById(f), "width")) ? i() : setTimeout(u, 100))
|
||||
}()
|
||||
}
|
||||
}
|
||||
},
|
||||
r = {
|
||||
v: "3.1.0",
|
||||
ie: function() {
|
||||
var t = navigator.userAgent.toLowerCase();
|
||||
return !!(e.ActiveXObject || "ActiveXObject" in e) && ((t.match(/msie\s(\d+)/) || [])[1] || "11")
|
||||
}(),
|
||||
index: e.layer && e.layer.v ? 1e5 : 0,
|
||||
path: o.getPath,
|
||||
config: function(e, t) {
|
||||
return e = e || {}, r.cache = o.config = i.extend({}, o.config, e), r.path = o.config.path || r.path, "string" == typeof e.extend && (e.extend = [e.extend]), o.config.path && r.ready(), e.extend ? (a ? layui.addcss("modules/layer/" + e.extend) : o.link("theme/" + e.extend), this) : this
|
||||
},
|
||||
ready: function(e) {
|
||||
var t = "layer",
|
||||
i = "",
|
||||
n = (a ? "modules/layer/" : "theme/") + "default/layer.css?v=" + r.v + i;
|
||||
return a ? layui.addcss(n, e, t) : o.link(n, e, t), this
|
||||
},
|
||||
alert: function(e, t, n) {
|
||||
var a = "function" == typeof t;
|
||||
return a && (n = t), r.open(i.extend({
|
||||
content: e,
|
||||
yes: n
|
||||
}, a ? {} : t))
|
||||
},
|
||||
confirm: function(e, t, n, a) {
|
||||
var s = "function" == typeof t;
|
||||
return s && (a = n, n = t), r.open(i.extend({
|
||||
content: e,
|
||||
btn: o.btn,
|
||||
yes: n,
|
||||
btn2: a
|
||||
}, s ? {} : t))
|
||||
},
|
||||
msg: function(e, n, a) {
|
||||
var s = "function" == typeof n,
|
||||
f = o.config.skin,
|
||||
c = (f ? f + " " + f + "-msg" : "") || "layui-layer-msg",
|
||||
u = l.anim.length - 1;
|
||||
return s && (a = n), r.open(i.extend({
|
||||
content: e,
|
||||
time: 3e3,
|
||||
shade: !1,
|
||||
skin: c,
|
||||
title: !1,
|
||||
closeBtn: !1,
|
||||
btn: !1,
|
||||
resize: !1,
|
||||
end: a
|
||||
}, s && !o.config.skin ? {
|
||||
skin: c + " layui-layer-hui",
|
||||
anim: u
|
||||
} : function() {
|
||||
return n = n || {}, (n.icon === -1 || n.icon === t && !o.config.skin) && (n.skin = c + " " + (n.skin || "layui-layer-hui")), n
|
||||
}()))
|
||||
},
|
||||
load: function(e, t) {
|
||||
return r.open(i.extend({
|
||||
type: 3,
|
||||
icon: e || 0,
|
||||
resize: !1,
|
||||
shade: .01
|
||||
}, t))
|
||||
},
|
||||
tips: function(e, t, n) {
|
||||
return r.open(i.extend({
|
||||
type: 4,
|
||||
content: [e, t],
|
||||
closeBtn: !1,
|
||||
time: 3e3,
|
||||
shade: !1,
|
||||
resize: !1,
|
||||
fixed: !1,
|
||||
maxWidth: 210
|
||||
}, n))
|
||||
}
|
||||
},
|
||||
s = function(e) {
|
||||
var t = this;
|
||||
t.index = ++r.index, t.config = i.extend({}, t.config, o.config, e), document.body ? t.creat() : setTimeout(function() {
|
||||
t.creat()
|
||||
}, 30)
|
||||
};
|
||||
s.pt = s.prototype;
|
||||
var l = ["layui-layer", ".layui-layer-title", ".layui-layer-main", ".layui-layer-dialog", "layui-layer-iframe", "layui-layer-content", "layui-layer-btn", "layui-layer-close"];
|
||||
l.anim = ["layer-anim-00", "layer-anim-01", "layer-anim-02", "layer-anim-03", "layer-anim-04", "layer-anim-05", "layer-anim-06"], s.pt.config = {
|
||||
type: 0,
|
||||
shade: .3,
|
||||
fixed: !0,
|
||||
move: l[1],
|
||||
title: "信息",
|
||||
offset: "auto",
|
||||
area: "auto",
|
||||
closeBtn: 1,
|
||||
time: 0,
|
||||
zIndex: 19891014,
|
||||
maxWidth: 360,
|
||||
anim: 0,
|
||||
isOutAnim: !0,
|
||||
icon: -1,
|
||||
moveType: 1,
|
||||
resize: !0,
|
||||
scrollbar: !0,
|
||||
tips: 2
|
||||
}, s.pt.vessel = function(e, t) {
|
||||
var n = this,
|
||||
a = n.index,
|
||||
r = n.config,
|
||||
s = r.zIndex + a,
|
||||
f = "object" == typeof r.title,
|
||||
c = r.maxmin && (1 === r.type || 2 === r.type),
|
||||
u = r.title ? '<div class="layui-layer-title" style="' + (f ? r.title[1] : "") + '">' + (f ? r.title[0] : r.title) + "</div>" : "";
|
||||
return r.zIndex = s, t([r.shade ? '<div class="layui-layer-shade" id="layui-layer-shade' + a + '" times="' + a + '" style="' + ("z-index:" + (s - 1) + "; ") + '"></div>' : "", '<div class="' + l[0] + (" layui-layer-" + o.type[r.type]) + (0 != r.type && 2 != r.type || r.shade ? "" : " layui-layer-border") + " " + (r.skin || "") + '" id="' + l[0] + a + '" type="' + o.type[r.type] + '" times="' + a + '" showtime="' + r.time + '" conType="' + (e ? "object" : "string") + '" style="z-index: ' + s + "; width:" + r.area[0] + ";height:" + r.area[1] + (r.fixed ? "" : ";position:absolute;") + '">' + (e && 2 != r.type ? "" : u) + '<div id="' + (r.id || "") + '" class="layui-layer-content' + (0 == r.type && r.icon !== -1 ? " layui-layer-padding" : "") + (3 == r.type ? " layui-layer-loading" + r.icon : "") + '">' + (0 == r.type && r.icon !== -1 ? '<i class="layui-layer-ico layui-layer-ico' + r.icon + '"></i>' : "") + (1 == r.type && e ? "" : r.content || "") + '</div><span class="layui-layer-setwin">' + function() {
|
||||
var e = c ? '<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>' : "";
|
||||
return r.closeBtn && (e += '<a class="layui-layer-ico ' + l[7] + " " + l[7] + (r.title ? r.closeBtn : 4 == r.type ? "1" : "2") + '" href="javascript:;"></a>'), e
|
||||
}() + "</span>" + (r.btn ? function() {
|
||||
var e = "";
|
||||
"string" == typeof r.btn && (r.btn = [r.btn]);
|
||||
for (var t = 0, i = r.btn.length; t < i; t++) e += '<a class="' + l[6] + t + '">' + r.btn[t] + "</a>";
|
||||
return '<div class="' + l[6] + " layui-layer-btn-" + (r.btnAlign || "") + '">' + e + "</div>"
|
||||
}() : "") + (r.resize ? '<span class="layui-layer-resize"></span>' : "") + "</div>"], u, i('<div class="layui-layer-move"></div>')), n
|
||||
}, s.pt.creat = function() {
|
||||
var e = this,
|
||||
t = e.config,
|
||||
a = e.index,
|
||||
s = t.content,
|
||||
f = "object" == typeof s,
|
||||
c = i("body");
|
||||
if (!t.id || !i("#" + t.id)[0]) {
|
||||
switch ("string" == typeof t.area && (t.area = "auto" === t.area ? ["", ""] : [t.area, ""]), t.shift && (t.anim = t.shift), 6 == r.ie && (t.fixed = !1), t.type) {
|
||||
case 0:
|
||||
t.btn = "btn" in t ? t.btn : o.btn[0], r.closeAll("dialog");
|
||||
break;
|
||||
case 2:
|
||||
var s = t.content = f ? t.content : [t.content || "http://layer.layui.com", "auto"];
|
||||
t.content = '<iframe scrolling="' + (t.content[1] || "auto") + '" allowtransparency="true" id="' + l[4] + a + '" name="' + l[4] + a + '" onload="this.className=\'\';" class="layui-layer-load" frameborder="0" src="' + t.content[0] + '"></iframe>';
|
||||
break;
|
||||
case 3:
|
||||
delete t.title, delete t.closeBtn, t.icon === -1 && 0 === t.icon, r.closeAll("loading");
|
||||
break;
|
||||
case 4:
|
||||
f || (t.content = [t.content, "body"]), t.follow = t.content[1], t.content = t.content[0] + '<i class="layui-layer-TipsG"></i>', delete t.title, t.tips = "object" == typeof t.tips ? t.tips : [t.tips, !0], t.tipsMore || r.closeAll("tips")
|
||||
}
|
||||
if (e.vessel(f, function(n, r, u) {
|
||||
c.append(n[0]), f ? function() {
|
||||
2 == t.type || 4 == t.type ? function() {
|
||||
i("body").append(n[1])
|
||||
}() : function() {
|
||||
s.parents("." + l[0])[0] || (s.data("display", s.css("display")).show().addClass("layui-layer-wrap").wrap(n[1]), i("#" + l[0] + a).find("." + l[5]).before(r))
|
||||
}()
|
||||
}() : c.append(n[1]), i(".layui-layer-move")[0] || c.append(o.moveElem = u), e.layero = i("#" + l[0] + a), t.scrollbar || l.html.css("overflow", "hidden").attr("layer-full", a)
|
||||
}).auto(a), i("#layui-layer-shade" + e.index).css({
|
||||
"background-color": t.shade[1] || "#000",
|
||||
opacity: t.shade[0] || t.shade
|
||||
}), 2 == t.type && 6 == r.ie && e.layero.find("iframe").attr("src", s[0]), 4 == t.type ? e.tips() : e.offset(), t.fixed && n.on("resize", function() {
|
||||
e.offset(), (/^\d+%$/.test(t.area[0]) || /^\d+%$/.test(t.area[1])) && e.auto(a), 4 == t.type && e.tips()
|
||||
}), t.time <= 0 || setTimeout(function() {
|
||||
r.close(e.index)
|
||||
}, t.time), e.move().callback(), l.anim[t.anim]) {
|
||||
var u = "layer-anim " + l.anim[t.anim];
|
||||
e.layero.addClass(u).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend", function() {
|
||||
i(this).removeClass(u)
|
||||
})
|
||||
}
|
||||
t.isOutAnim && e.layero.data("isOutAnim", !0)
|
||||
}
|
||||
}, s.pt.auto = function(e) {
|
||||
var t = this,
|
||||
a = t.config,
|
||||
o = i("#" + l[0] + e);
|
||||
"" === a.area[0] && a.maxWidth > 0 && (r.ie && r.ie < 8 && a.btn && o.width(o.innerWidth()), o.outerWidth() > a.maxWidth && o.width(a.maxWidth));
|
||||
var s = [o.innerWidth(), o.innerHeight()],
|
||||
f = o.find(l[1]).outerHeight() || 0,
|
||||
c = o.find("." + l[6]).outerHeight() || 0,
|
||||
u = function(e) {
|
||||
e = o.find(e), e.height(s[1] - f - c - 2 * (0 | parseFloat(e.css("padding-top"))))
|
||||
};
|
||||
switch (a.type) {
|
||||
case 2:
|
||||
u("iframe");
|
||||
break;
|
||||
default:
|
||||
"" === a.area[1] ? a.maxHeight > 0 && o.outerHeight() > a.maxHeight ? (s[1] = a.maxHeight, u("." + l[5])) : a.fixed && s[1] >= n.height() && (s[1] = n.height(), u("." + l[5])) : u("." + l[5])
|
||||
}
|
||||
return t
|
||||
}, s.pt.offset = function() {
|
||||
var e = this,
|
||||
t = e.config,
|
||||
i = e.layero,
|
||||
a = [i.outerWidth(), i.outerHeight()],
|
||||
o = "object" == typeof t.offset;
|
||||
e.offsetTop = (n.height() - a[1]) / 2, e.offsetLeft = (n.width() - a[0]) / 2, o ? (e.offsetTop = t.offset[0], e.offsetLeft = t.offset[1] || e.offsetLeft) : "auto" !== t.offset && ("t" === t.offset ? e.offsetTop = 0 : "r" === t.offset ? e.offsetLeft = n.width() - a[0] : "b" === t.offset ? e.offsetTop = n.height() - a[1] : "l" === t.offset ? e.offsetLeft = 0 : "lt" === t.offset ? (e.offsetTop = 0, e.offsetLeft = 0) : "lb" === t.offset ? (e.offsetTop = n.height() - a[1], e.offsetLeft = 0) : "rt" === t.offset ? (e.offsetTop = 0, e.offsetLeft = n.width() - a[0]) : "rb" === t.offset ? (e.offsetTop = n.height() - a[1], e.offsetLeft = n.width() - a[0]) : e.offsetTop = t.offset), t.fixed || (e.offsetTop = /%$/.test(e.offsetTop) ? n.height() * parseFloat(e.offsetTop) / 100 : parseFloat(e.offsetTop), e.offsetLeft = /%$/.test(e.offsetLeft) ? n.width() * parseFloat(e.offsetLeft) / 100 : parseFloat(e.offsetLeft), e.offsetTop += n.scrollTop(), e.offsetLeft += n.scrollLeft()), i.attr("minLeft") && (e.offsetTop = n.height() - (i.find(l[1]).outerHeight() || 0), e.offsetLeft = i.css("left")), i.css({
|
||||
top: e.offsetTop,
|
||||
left: e.offsetLeft
|
||||
})
|
||||
}, s.pt.tips = function() {
|
||||
var e = this,
|
||||
t = e.config,
|
||||
a = e.layero,
|
||||
o = [a.outerWidth(), a.outerHeight()],
|
||||
r = i(t.follow);
|
||||
r[0] || (r = i("body"));
|
||||
var s = {
|
||||
width: r.outerWidth(),
|
||||
height: r.outerHeight(),
|
||||
top: r.offset().top,
|
||||
left: r.offset().left
|
||||
},
|
||||
f = a.find(".layui-layer-TipsG"),
|
||||
c = t.tips[0];
|
||||
t.tips[1] || f.remove(), s.autoLeft = function() {
|
||||
s.left + o[0] - n.width() > 0 ? (s.tipLeft = s.left + s.width - o[0], f.css({
|
||||
right: 12,
|
||||
left: "auto"
|
||||
})) : s.tipLeft = s.left
|
||||
}, s.where = [
|
||||
function() {
|
||||
s.autoLeft(), s.tipTop = s.top - o[1] - 10, f.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color", t.tips[1])
|
||||
},
|
||||
function() {
|
||||
s.tipLeft = s.left + s.width + 10, s.tipTop = s.top, f.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color", t.tips[1])
|
||||
},
|
||||
function() {
|
||||
s.autoLeft(), s.tipTop = s.top + s.height + 10, f.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color", t.tips[1])
|
||||
},
|
||||
function() {
|
||||
s.tipLeft = s.left - o[0] - 10, s.tipTop = s.top, f.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color", t.tips[1])
|
||||
}
|
||||
], s.where[c - 1](), 1 === c ? s.top - (n.scrollTop() + o[1] + 16) < 0 && s.where[2]() : 2 === c ? n.width() - (s.left + s.width + o[0] + 16) > 0 || s.where[3]() : 3 === c ? s.top - n.scrollTop() + s.height + o[1] + 16 - n.height() > 0 && s.where[0]() : 4 === c && o[0] + 16 - s.left > 0 && s.where[1](), a.find("." + l[5]).css({
|
||||
"background-color": t.tips[1],
|
||||
"padding-right": t.closeBtn ? "30px" : ""
|
||||
}), a.css({
|
||||
left: s.tipLeft - (t.fixed ? n.scrollLeft() : 0),
|
||||
top: s.tipTop - (t.fixed ? n.scrollTop() : 0)
|
||||
})
|
||||
}, s.pt.move = function() {
|
||||
var e = this,
|
||||
t = e.config,
|
||||
a = i(document),
|
||||
s = e.layero,
|
||||
l = s.find(t.move),
|
||||
f = s.find(".layui-layer-resize"),
|
||||
c = {};
|
||||
return t.move && l.css("cursor", "move"), l.on("mousedown", function(e) {
|
||||
e.preventDefault(), t.move && (c.moveStart = !0, c.offset = [e.clientX - parseFloat(s.css("left")), e.clientY - parseFloat(s.css("top"))], o.moveElem.css("cursor", "move").show())
|
||||
}), f.on("mousedown", function(e) {
|
||||
e.preventDefault(), c.resizeStart = !0, c.offset = [e.clientX, e.clientY], c.area = [s.outerWidth(), s.outerHeight()], o.moveElem.css("cursor", "se-resize").show()
|
||||
}), a.on("mousemove", function(i) {
|
||||
if (c.moveStart) {
|
||||
var a = i.clientX - c.offset[0],
|
||||
o = i.clientY - c.offset[1],
|
||||
l = "fixed" === s.css("position");
|
||||
if (i.preventDefault(), c.stX = l ? 0 : n.scrollLeft(), c.stY = l ? 0 : n.scrollTop(), !t.moveOut) {
|
||||
var f = n.width() - s.outerWidth() + c.stX,
|
||||
u = n.height() - s.outerHeight() + c.stY;
|
||||
a < c.stX && (a = c.stX), a > f && (a = f), o < c.stY && (o = c.stY), o > u && (o = u)
|
||||
}
|
||||
s.css({
|
||||
left: a,
|
||||
top: o
|
||||
})
|
||||
}
|
||||
if (t.resize && c.resizeStart) {
|
||||
var a = i.clientX - c.offset[0],
|
||||
o = i.clientY - c.offset[1];
|
||||
i.preventDefault(), r.style(e.index, {
|
||||
width: c.area[0] + a,
|
||||
height: c.area[1] + o
|
||||
}), c.isResize = !0, t.resizing && t.resizing(s)
|
||||
}
|
||||
}).on("mouseup", function(e) {
|
||||
c.moveStart && (delete c.moveStart, o.moveElem.hide(), t.moveEnd && t.moveEnd(s)), c.resizeStart && (delete c.resizeStart, o.moveElem.hide())
|
||||
}), e
|
||||
}, s.pt.callback = function() {
|
||||
function e() {
|
||||
var e = a.cancel && a.cancel(t.index, n);
|
||||
e === !1 || r.close(t.index)
|
||||
}
|
||||
var t = this,
|
||||
n = t.layero,
|
||||
a = t.config;
|
||||
t.openLayer(), a.success && (2 == a.type ? n.find("iframe").on("load", function() {
|
||||
a.success(n, t.index)
|
||||
}) : a.success(n, t.index)), 6 == r.ie && t.IE6(n), n.find("." + l[6]).children("a").on("click", function() {
|
||||
var e = i(this).index();
|
||||
if (0 === e) a.yes ? a.yes(t.index, n) : a.btn1 ? a.btn1(t.index, n) : r.close(t.index);
|
||||
else {
|
||||
var o = a["btn" + (e + 1)] && a["btn" + (e + 1)](t.index, n);
|
||||
o === !1 || r.close(t.index)
|
||||
}
|
||||
}), n.find("." + l[7]).on("click", e), a.shadeClose && i("#layui-layer-shade" + t.index).on("click", function() {
|
||||
r.close(t.index)
|
||||
}), n.find(".layui-layer-min").on("click", function() {
|
||||
var e = a.min && a.min(n);
|
||||
e === !1 || r.min(t.index, a)
|
||||
}), n.find(".layui-layer-max").on("click", function() {
|
||||
i(this).hasClass("layui-layer-maxmin") ? (r.restore(t.index), a.restore && a.restore(n)) : (r.full(t.index, a), setTimeout(function() {
|
||||
a.full && a.full(n)
|
||||
}, 100))
|
||||
}), a.end && (o.end[t.index] = a.end)
|
||||
}, o.reselect = function() {
|
||||
i.each(i("select"), function(e, t) {
|
||||
var n = i(this);
|
||||
n.parents("." + l[0])[0] || 1 == n.attr("layer") && i("." + l[0]).length < 1 && n.removeAttr("layer").show(), n = null
|
||||
})
|
||||
}, s.pt.IE6 = function(e) {
|
||||
i("select").each(function(e, t) {
|
||||
var n = i(this);
|
||||
n.parents("." + l[0])[0] || "none" === n.css("display") || n.attr({
|
||||
layer: "1"
|
||||
}).hide(), n = null
|
||||
})
|
||||
}, s.pt.openLayer = function() {
|
||||
var e = this;
|
||||
r.zIndex = e.config.zIndex, r.setTop = function(e) {
|
||||
var t = function() {
|
||||
r.zIndex++, e.css("z-index", r.zIndex + 1)
|
||||
};
|
||||
return r.zIndex = parseInt(e[0].style.zIndex), e.on("mousedown", t), r.zIndex
|
||||
}
|
||||
}, o.record = function(e) {
|
||||
var t = [e.width(), e.height(), e.position().top, e.position().left + parseFloat(e.css("margin-left"))];
|
||||
e.find(".layui-layer-max").addClass("layui-layer-maxmin"), e.attr({
|
||||
area: t
|
||||
})
|
||||
}, o.rescollbar = function(e) {
|
||||
l.html.attr("layer-full") == e && (l.html[0].style.removeProperty ? l.html[0].style.removeProperty("overflow") : l.html[0].style.removeAttribute("overflow"), l.html.removeAttr("layer-full"))
|
||||
}, e.layer = r, r.getChildFrame = function(e, t) {
|
||||
return t = t || i("." + l[4]).attr("times"), i("#" + l[0] + t).find("iframe").contents().find(e)
|
||||
}, r.getFrameIndex = function(e) {
|
||||
return i("#" + e).parents("." + l[4]).attr("times")
|
||||
}, r.iframeAuto = function(e) {
|
||||
if (e) {
|
||||
var t = r.getChildFrame("html", e).outerHeight(),
|
||||
n = i("#" + l[0] + e),
|
||||
a = n.find(l[1]).outerHeight() || 0,
|
||||
o = n.find("." + l[6]).outerHeight() || 0;
|
||||
n.css({
|
||||
height: t + a + o
|
||||
}), n.find("iframe").css({
|
||||
height: t
|
||||
})
|
||||
}
|
||||
}, r.iframeSrc = function(e, t) {
|
||||
i("#" + l[0] + e).find("iframe").attr("src", t)
|
||||
}, r.style = function(e, t, n) {
|
||||
var a = i("#" + l[0] + e),
|
||||
r = a.find(".layui-layer-content"),
|
||||
s = a.attr("type"),
|
||||
f = a.find(l[1]).outerHeight() || 0,
|
||||
c = a.find("." + l[6]).outerHeight() || 0;
|
||||
a.attr("minLeft");
|
||||
s !== o.type[3] && s !== o.type[4] && (n || (parseFloat(t.width) <= 260 && (t.width = 260), parseFloat(t.height) - f - c <= 64 && (t.height = 64 + f + c)), a.css(t), c = a.find("." + l[6]).outerHeight(), s === o.type[2] ? a.find("iframe").css({
|
||||
height: parseFloat(t.height) - f - c
|
||||
}) : r.css({
|
||||
height: parseFloat(t.height) - f - c - parseFloat(r.css("padding-top")) - parseFloat(r.css("padding-bottom"))
|
||||
}))
|
||||
}, r.min = function(e, t) {
|
||||
var a = i("#" + l[0] + e),
|
||||
s = a.find(l[1]).outerHeight() || 0,
|
||||
f = a.attr("minLeft") || 181 * o.minIndex + "px",
|
||||
c = a.css("position");
|
||||
o.record(a), o.minLeft[0] && (f = o.minLeft[0], o.minLeft.shift()), a.attr("position", c), r.style(e, {
|
||||
width: 180,
|
||||
height: s,
|
||||
left: f,
|
||||
top: n.height() - s,
|
||||
position: "fixed",
|
||||
overflow: "hidden"
|
||||
}, !0), a.find(".layui-layer-min").hide(), "page" === a.attr("type") && a.find(l[4]).hide(), o.rescollbar(e), a.attr("minLeft") || o.minIndex++, a.attr("minLeft", f)
|
||||
}, r.restore = function(e) {
|
||||
var t = i("#" + l[0] + e),
|
||||
n = t.attr("area").split(",");
|
||||
t.attr("type");
|
||||
r.style(e, {
|
||||
width: parseFloat(n[0]),
|
||||
height: parseFloat(n[1]),
|
||||
top: parseFloat(n[2]),
|
||||
left: parseFloat(n[3]),
|
||||
position: t.attr("position"),
|
||||
overflow: "visible"
|
||||
}, !0), t.find(".layui-layer-max").removeClass("layui-layer-maxmin"), t.find(".layui-layer-min").show(), "page" === t.attr("type") && t.find(l[4]).show(), o.rescollbar(e)
|
||||
}, r.full = function(e) {
|
||||
var t, a = i("#" + l[0] + e);
|
||||
o.record(a), l.html.attr("layer-full") || l.html.css("overflow", "hidden").attr("layer-full", e), clearTimeout(t), t = setTimeout(function() {
|
||||
var t = "fixed" === a.css("position");
|
||||
r.style(e, {
|
||||
top: t ? 0 : n.scrollTop(),
|
||||
left: t ? 0 : n.scrollLeft(),
|
||||
width: n.width(),
|
||||
height: n.height()
|
||||
}, !0), a.find(".layui-layer-min").hide()
|
||||
}, 100)
|
||||
}, r.title = function(e, t) {
|
||||
var n = i("#" + l[0] + (t || r.index)).find(l[1]);
|
||||
n.html(e)
|
||||
}, r.close = function(e) {
|
||||
var t = i("#" + l[0] + e),
|
||||
n = t.attr("type"),
|
||||
a = "layer-anim-close";
|
||||
if (t[0]) {
|
||||
var s = "layui-layer-wrap",
|
||||
f = function() {
|
||||
if (n === o.type[1] && "object" === t.attr("conType")) {
|
||||
t.children(":not(." + l[5] + ")").remove();
|
||||
for (var a = t.find("." + s), r = 0; r < 2; r++) a.unwrap();
|
||||
a.css("display", a.data("display")).removeClass(s)
|
||||
} else {
|
||||
if (n === o.type[2]) try {
|
||||
var f = i("#" + l[4] + e)[0];
|
||||
f.contentWindow.document.write(""), f.contentWindow.close(), t.find("." + l[5])[0].removeChild(f)
|
||||
} catch (c) {}
|
||||
t[0].innerHTML = "", t.remove()
|
||||
}
|
||||
"function" == typeof o.end[e] && o.end[e](), delete o.end[e]
|
||||
};
|
||||
t.data("isOutAnim") && t.addClass("layer-anim " + a), i("#layui-layer-moves, #layui-layer-shade" + e).remove(), 6 == r.ie && o.reselect(), o.rescollbar(e), t.attr("minLeft") && (o.minIndex--, o.minLeft.push(t.attr("minLeft"))), r.ie && r.ie < 10 || !t.data("isOutAnim") ? f() : setTimeout(function() {
|
||||
f()
|
||||
}, 200)
|
||||
}
|
||||
}, r.closeAll = function(e) {
|
||||
i.each(i("." + l[0]), function() {
|
||||
var t = i(this),
|
||||
n = e ? t.attr("type") === e : 1;
|
||||
n && r.close(t.attr("times")), n = null
|
||||
})
|
||||
};
|
||||
var f = r.cache || {},
|
||||
c = function(e) {
|
||||
return f.skin ? " " + f.skin + " " + f.skin + "-" + e : ""
|
||||
};
|
||||
r.prompt = function(e, t) {
|
||||
var a = "";
|
||||
if (e = e || {}, "function" == typeof e && (t = e), e.area) {
|
||||
var o = e.area;
|
||||
a = 'style="width: ' + o[0] + "; height: " + o[1] + ';"', delete e.area
|
||||
}
|
||||
var s, l = 2 == e.formType ? '<textarea class="layui-layer-input"' + a + ">" + (e.value || "") + "</textarea>" : function() {
|
||||
return '<input type="' + (1 == e.formType ? "password" : "text") + '" class="layui-layer-input" value="' + (e.value || "") + '">'
|
||||
}(),
|
||||
f = e.success;
|
||||
return delete e.success, r.open(i.extend({
|
||||
type: 1,
|
||||
btn: ["确定", "取消"],
|
||||
content: l,
|
||||
skin: "layui-layer-prompt" + c("prompt"),
|
||||
maxWidth: n.width(),
|
||||
success: function(e) {
|
||||
s = e.find(".layui-layer-input"), s.focus(), "function" == typeof f && f(e)
|
||||
},
|
||||
resize: !1,
|
||||
yes: function(i) {
|
||||
var n = s.val();
|
||||
"" === n ? s.focus() : n.length > (e.maxlength || 500) ? r.tips("最多输入" + (e.maxlength || 500) + "个字数", s, {
|
||||
tips: 1
|
||||
}) : t && t(n, i, s)
|
||||
}
|
||||
}, e))
|
||||
}, r.tab = function(e) {
|
||||
e = e || {};
|
||||
var t = e.tab || {},
|
||||
n = "layui-this",
|
||||
a = e.success;
|
||||
return delete e.success, r.open(i.extend({
|
||||
type: 1,
|
||||
skin: "layui-layer-tab" + c("tab"),
|
||||
resize: !1,
|
||||
title: function() {
|
||||
var e = t.length,
|
||||
i = 1,
|
||||
a = "";
|
||||
if (e > 0)
|
||||
for (a = '<span class="' + n + '">' + t[0].title + "</span>"; i < e; i++) a += "<span>" + t[i].title + "</span>";
|
||||
return a
|
||||
}(),
|
||||
content: '<ul class="layui-layer-tabmain">' + function() {
|
||||
var e = t.length,
|
||||
i = 1,
|
||||
a = "";
|
||||
if (e > 0)
|
||||
for (a = '<li class="layui-layer-tabli ' + n + '">' + (t[0].content || "no content") + "</li>"; i < e; i++) a += '<li class="layui-layer-tabli">' + (t[i].content || "no content") + "</li>";
|
||||
return a
|
||||
}() + "</ul>",
|
||||
success: function(t) {
|
||||
var o = t.find(".layui-layer-title").children(),
|
||||
r = t.find(".layui-layer-tabmain").children();
|
||||
o.on("mousedown", function(t) {
|
||||
t.stopPropagation ? t.stopPropagation() : t.cancelBubble = !0;
|
||||
var a = i(this),
|
||||
o = a.index();
|
||||
a.addClass(n).siblings().removeClass(n), r.eq(o).show().siblings().hide(), "function" == typeof e.change && e.change(o)
|
||||
}), "function" == typeof a && a(t)
|
||||
}
|
||||
}, e))
|
||||
}, r.photos = function(t, n, a) {
|
||||
function o(e, t, i) {
|
||||
var n = new Image;
|
||||
return n.src = e, n.complete ? t(n) : (n.onload = function() {
|
||||
n.onload = null, t(n)
|
||||
}, void(n.onerror = function(e) {
|
||||
n.onerror = null, i(e)
|
||||
}))
|
||||
}
|
||||
var s = {};
|
||||
if (t = t || {}, t.photos) {
|
||||
var l = t.photos.constructor === Object,
|
||||
f = l ? t.photos : {},
|
||||
u = f.data || [],
|
||||
d = f.start || 0;
|
||||
s.imgIndex = (0 | d) + 1, t.img = t.img || "img";
|
||||
var y = t.success;
|
||||
if (delete t.success, l) {
|
||||
if (0 === u.length) return r.msg("没有图片")
|
||||
} else {
|
||||
var p = i(t.photos),
|
||||
h = function() {
|
||||
u = [], p.find(t.img).each(function(e) {
|
||||
var t = i(this);
|
||||
t.attr("layer-index", e), u.push({
|
||||
alt: t.attr("alt"),
|
||||
pid: t.attr("layer-pid"),
|
||||
src: t.attr("layer-src") || t.attr("src"),
|
||||
thumb: t.attr("src")
|
||||
})
|
||||
})
|
||||
};
|
||||
if (h(), 0 === u.length) return;
|
||||
if (n || p.on("click", t.img, function() {
|
||||
var e = i(this),
|
||||
n = e.attr("layer-index");
|
||||
r.photos(i.extend(t, {
|
||||
photos: {
|
||||
start: n,
|
||||
data: u,
|
||||
tab: t.tab
|
||||
},
|
||||
full: t.full
|
||||
}), !0), h()
|
||||
}), !n) return
|
||||
}
|
||||
s.imgprev = function(e) {
|
||||
s.imgIndex--, s.imgIndex < 1 && (s.imgIndex = u.length), s.tabimg(e)
|
||||
}, s.imgnext = function(e, t) {
|
||||
s.imgIndex++, s.imgIndex > u.length && (s.imgIndex = 1, t) || s.tabimg(e)
|
||||
}, s.keyup = function(e) {
|
||||
if (!s.end) {
|
||||
var t = e.keyCode;
|
||||
e.preventDefault(), 37 === t ? s.imgprev(!0) : 39 === t ? s.imgnext(!0) : 27 === t && r.close(s.index)
|
||||
}
|
||||
}, s.tabimg = function(e) {
|
||||
if (!(u.length <= 1)) return f.start = s.imgIndex - 1, r.close(s.index), r.photos(t, !0, e)
|
||||
}, s.event = function() {
|
||||
s.bigimg.hover(function() {
|
||||
s.imgsee.show()
|
||||
}, function() {
|
||||
s.imgsee.hide()
|
||||
}), s.bigimg.find(".layui-layer-imgprev").on("click", function(e) {
|
||||
e.preventDefault(), s.imgprev()
|
||||
}), s.bigimg.find(".layui-layer-imgnext").on("click", function(e) {
|
||||
e.preventDefault(), s.imgnext()
|
||||
}), i(document).on("keyup", s.keyup)
|
||||
}, s.loadi = r.load(1, {
|
||||
shade: !("shade" in t) && .9,
|
||||
scrollbar: !1
|
||||
}), o(u[d].src, function(n) {
|
||||
r.close(s.loadi), s.index = r.open(i.extend({
|
||||
type: 1,
|
||||
id: "layui-layer-photos",
|
||||
area: function() {
|
||||
var a = [n.width, n.height],
|
||||
o = [i(e).width() - 100, i(e).height() - 100];
|
||||
if (!t.full && (a[0] > o[0] || a[1] > o[1])) {
|
||||
var r = [a[0] / o[0], a[1] / o[1]];
|
||||
r[0] > r[1] ? (a[0] = a[0] / r[0], a[1] = a[1] / r[0]) : r[0] < r[1] && (a[0] = a[0] / r[1], a[1] = a[1] / r[1])
|
||||
}
|
||||
return [a[0] + "px", a[1] + "px"]
|
||||
}(),
|
||||
title: !1,
|
||||
shade: .9,
|
||||
shadeClose: !0,
|
||||
closeBtn: !1,
|
||||
move: ".layui-layer-phimg img",
|
||||
moveType: 1,
|
||||
scrollbar: !1,
|
||||
moveOut: !0,
|
||||
isOutAnim: !1,
|
||||
skin: "layui-layer-photos" + c("photos"),
|
||||
content: '<div class="layui-layer-phimg"><img src="' + u[d].src + '" alt="' + (u[d].alt || "") + '" layer-pid="' + u[d].pid + '"><div class="layui-layer-imgsee">' + (u.length > 1 ? '<span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span>' : "") + '<div class="layui-layer-imgbar" style="display:' + (a ? "block" : "") + '"><span class="layui-layer-imgtit"><a href="javascript:;">' + (u[d].alt || "") + "</a><em>" + s.imgIndex + "/" + u.length + "</em></span></div></div></div>",
|
||||
success: function(e, i) {
|
||||
s.bigimg = e.find(".layui-layer-phimg"), s.imgsee = e.find(".layui-layer-imguide,.layui-layer-imgbar"), s.event(e), t.tab && t.tab(u[d], e), "function" == typeof y && y(e)
|
||||
},
|
||||
end: function() {
|
||||
s.end = !0, i(document).off("keyup", s.keyup)
|
||||
}
|
||||
}, t))
|
||||
}, function() {
|
||||
r.close(s.loadi), r.msg("当前图片地址异常<br>是否继续查看下一张?", {
|
||||
time: 3e4,
|
||||
btn: ["下一张", "不看了"],
|
||||
yes: function() {
|
||||
u.length > 1 && s.imgnext(!0, !0)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}, o.run = function(t) {
|
||||
i = t, n = i(e), l.html = i("html"), r.open = function(e) {
|
||||
var t = new s(e);
|
||||
return t.index
|
||||
}
|
||||
}, e.layui && layui.define ? (r.ready(), layui.define("jquery", function(t) {
|
||||
r.path = layui.cache.dir, o.run(layui.$j), e.layer = r, t("layer", r)
|
||||
})) : "function" == typeof define && define.amd ? define(["jquery"], function() {
|
||||
return o.run(e.jQuery), r
|
||||
}) : function() {
|
||||
o.run(e.jQuery), r.ready()
|
||||
}()
|
||||
}(window);
|
2
shadowsocks/shadowsocks/res/layer/mobile/layer.js
Normal file
@ -0,0 +1,2 @@
|
||||
/*! layer mobile-v2.0.0 Web弹层组件 MIT License http://layer.layui.com/mobile By 贤心 */
|
||||
;!function(e){"use strict";var t=document,n="querySelectorAll",i="getElementsByClassName",a=function(e){return t[n](e)},s={type:0,shade:!0,shadeClose:!0,fixed:!0,anim:"scale"},l={extend:function(e){var t=JSON.parse(JSON.stringify(s));for(var n in e)t[n]=e[n];return t},timer:{},end:{}};l.touch=function(e,t){e.addEventListener("click",function(e){t.call(this,e)},!1)};var r=0,o=["layui-m-layer"],c=function(e){var t=this;t.config=l.extend(e),t.view()};c.prototype.view=function(){var e=this,n=e.config,s=t.createElement("div");e.id=s.id=o[0]+r,s.setAttribute("class",o[0]+" "+o[0]+(n.type||0)),s.setAttribute("index",r);var l=function(){var e="object"==typeof n.title;return n.title?'<h3 style="'+(e?n.title[1]:"")+'">'+(e?n.title[0]:n.title)+"</h3>":""}(),c=function(){"string"==typeof n.btn&&(n.btn=[n.btn]);var e,t=(n.btn||[]).length;return 0!==t&&n.btn?(e='<span yes type="1">'+n.btn[0]+"</span>",2===t&&(e='<span no type="0">'+n.btn[1]+"</span>"+e),'<div class="layui-m-layerbtn">'+e+"</div>"):""}();if(n.fixed||(n.top=n.hasOwnProperty("top")?n.top:100,n.style=n.style||"",n.style+=" top:"+(t.body.scrollTop+n.top)+"px"),2===n.type&&(n.content='<i></i><i class="layui-m-layerload"></i><i></i><p>'+(n.content||"")+"</p>"),n.skin&&(n.anim="up"),"msg"===n.skin&&(n.shade=!1),s.innerHTML=(n.shade?"<div "+("string"==typeof n.shade?'style="'+n.shade+'"':"")+' class="layui-m-layershade"></div>':"")+'<div class="layui-m-layermain" '+(n.fixed?"":'style="position:static;"')+'><div class="layui-m-layersection"><div class="layui-m-layerchild '+(n.skin?"layui-m-layer-"+n.skin+" ":"")+(n.className?n.className:"")+" "+(n.anim?"layui-m-anim-"+n.anim:"")+'" '+(n.style?'style="'+n.style+'"':"")+">"+l+'<div class="layui-m-layercont">'+n.content+"</div>"+c+"</div></div></div>",!n.type||2===n.type){var d=t[i](o[0]+n.type),y=d.length;y>=1&&layer.close(d[0].getAttribute("index"))}document.body.appendChild(s);var u=e.elem=a("#"+e.id)[0];n.success&&n.success(u),e.index=r++,e.action(n,u)},c.prototype.action=function(e,t){var n=this;e.time&&(l.timer[n.index]=setTimeout(function(){layer.close(n.index)},1e3*e.time));var a=function(){var t=this.getAttribute("type");0==t?(e.no&&e.no(),layer.close(n.index)):e.yes?e.yes(n.index):layer.close(n.index)};if(e.btn)for(var s=t[i]("layui-m-layerbtn")[0].children,r=s.length,o=0;o<r;o++)l.touch(s[o],a);if(e.shade&&e.shadeClose){var c=t[i]("layui-m-layershade")[0];l.touch(c,function(){layer.close(n.index,e.end)})}e.end&&(l.end[n.index]=e.end)},e.layer={v:"2.0",index:r,open:function(e){var t=new c(e||{});return t.index},close:function(e){var n=a("#"+o[0]+e)[0];n&&(n.innerHTML="",t.body.removeChild(n),clearTimeout(l.timer[e]),delete l.timer[e],"function"==typeof l.end[e]&&l.end[e](),delete l.end[e])},closeAll:function(){for(var e=t[i](o[0]),n=0,a=e.length;n<a;n++)layer.close(0|e[0].getAttribute("index"))}},"function"==typeof define?define(function(){return layer}):function(){var e=document.scripts,n=e[e.length-1],i=n.src,a=i.substring(0,i.lastIndexOf("/")+1);n.getAttribute("merge")||document.head.appendChild(function(){var e=t.createElement("link");return e.href=a+"need/layer.css?2.0",e.type="text/css",e.rel="styleSheet",e.id="layermcss",e}())}()}(window);
|
1
shadowsocks/shadowsocks/res/layer/mobile/need/layer.css
Normal file
BIN
shadowsocks/shadowsocks/res/layer/theme/default/icon-ext.png
Normal file
After Width: | Height: | Size: 5.8 KiB |
BIN
shadowsocks/shadowsocks/res/layer/theme/default/icon.png
Normal file
After Width: | Height: | Size: 11 KiB |
795
shadowsocks/shadowsocks/res/layer/theme/default/layer.css
Normal file
@ -0,0 +1,795 @@
|
||||
.layui-layer-imgbar,.layui-layer-imgtit a,.layui-layer-tab .layui-layer-title span,.layui-layer-title{
|
||||
text-overflow:ellipsis;
|
||||
white-space:nowrap
|
||||
}
|
||||
html #layuicss-layer{
|
||||
display:none;
|
||||
position:absolute;
|
||||
width:1989px
|
||||
}
|
||||
.layui-layer,.layui-layer-shade{
|
||||
position:fixed;
|
||||
_position:absolute;
|
||||
pointer-events:auto
|
||||
}
|
||||
.layui-layer-shade{
|
||||
top:0;
|
||||
left:0;
|
||||
width:100%;
|
||||
height:100%;
|
||||
_height:expression(document.body.offsetHeight+"px")
|
||||
}
|
||||
.layui-layer{
|
||||
-webkit-overflow-scrolling:touch;
|
||||
top:150px;
|
||||
left:0;
|
||||
margin:0;
|
||||
padding:0;
|
||||
background-color:#fff;
|
||||
-webkit-background-clip:content;
|
||||
border-radius:2px;
|
||||
box-shadow:1px 1px 50px rgba(0,0,0,.3)
|
||||
}
|
||||
.layui-layer-close{
|
||||
position:absolute
|
||||
}
|
||||
.layui-layer-content{
|
||||
position:relative
|
||||
}
|
||||
.layui-layer-border{
|
||||
border:1px solid #B2B2B2;
|
||||
border:1px solid rgba(0,0,0,.1);
|
||||
box-shadow:1px 1px 5px rgba(0,0,0,.2)
|
||||
}
|
||||
.layui-layer-load{
|
||||
background:url(loading-1.gif) center center no-repeat #eee
|
||||
}
|
||||
.layui-layer-ico{
|
||||
background:url(icon.png) no-repeat
|
||||
}
|
||||
.layui-layer-btn a,.layui-layer-dialog .layui-layer-ico,.layui-layer-setwin a{
|
||||
display:inline-block;
|
||||
*display:inline;
|
||||
*zoom:1;
|
||||
vertical-align:top
|
||||
}
|
||||
.layui-layer-move{
|
||||
display:none;
|
||||
position:fixed;
|
||||
*position:absolute;
|
||||
left:0;
|
||||
top:0;
|
||||
width:100%;
|
||||
height:100%;
|
||||
cursor:move;
|
||||
opacity:0;
|
||||
filter:alpha(opacity=0);
|
||||
background-color:#fff;
|
||||
z-index:2147483647
|
||||
}
|
||||
.layui-layer-resize{
|
||||
position:absolute;
|
||||
width:15px;
|
||||
height:15px;
|
||||
right:0;
|
||||
bottom:0;
|
||||
cursor:se-resize
|
||||
}
|
||||
.layer-anim{
|
||||
-webkit-animation-fill-mode:both;
|
||||
animation-fill-mode:both;
|
||||
-webkit-animation-duration:.3s;
|
||||
animation-duration:.3s
|
||||
}
|
||||
@-webkit-keyframes layer-bounceIn{
|
||||
0%{
|
||||
opacity:0;
|
||||
-webkit-transform:scale(.5);
|
||||
transform:scale(.5)
|
||||
}
|
||||
100%{
|
||||
opacity:1;
|
||||
-webkit-transform:scale(1);
|
||||
transform:scale(1)
|
||||
}
|
||||
}
|
||||
@keyframes layer-bounceIn{
|
||||
0%{
|
||||
opacity:0;
|
||||
-webkit-transform:scale(.5);
|
||||
-ms-transform:scale(.5);
|
||||
transform:scale(.5)
|
||||
}
|
||||
100%{
|
||||
opacity:1;
|
||||
-webkit-transform:scale(1);
|
||||
-ms-transform:scale(1);
|
||||
transform:scale(1)
|
||||
}
|
||||
}
|
||||
.layer-anim-00{
|
||||
-webkit-animation-name:layer-bounceIn;
|
||||
animation-name:layer-bounceIn
|
||||
}
|
||||
@-webkit-keyframes layer-zoomInDown{
|
||||
0%{
|
||||
opacity:0;
|
||||
-webkit-transform:scale(.1) translateY(-2000px);
|
||||
transform:scale(.1) translateY(-2000px);
|
||||
-webkit-animation-timing-function:ease-in-out;
|
||||
animation-timing-function:ease-in-out
|
||||
}
|
||||
60%{
|
||||
opacity:1;
|
||||
-webkit-transform:scale(.475) translateY(60px);
|
||||
transform:scale(.475) translateY(60px);
|
||||
-webkit-animation-timing-function:ease-out;
|
||||
animation-timing-function:ease-out
|
||||
}
|
||||
}
|
||||
@keyframes layer-zoomInDown{
|
||||
0%{
|
||||
opacity:0;
|
||||
-webkit-transform:scale(.1) translateY(-2000px);
|
||||
-ms-transform:scale(.1) translateY(-2000px);
|
||||
transform:scale(.1) translateY(-2000px);
|
||||
-webkit-animation-timing-function:ease-in-out;
|
||||
animation-timing-function:ease-in-out
|
||||
}
|
||||
60%{
|
||||
opacity:1;
|
||||
-webkit-transform:scale(.475) translateY(60px);
|
||||
-ms-transform:scale(.475) translateY(60px);
|
||||
transform:scale(.475) translateY(60px);
|
||||
-webkit-animation-timing-function:ease-out;
|
||||
animation-timing-function:ease-out
|
||||
}
|
||||
}
|
||||
.layer-anim-01{
|
||||
-webkit-animation-name:layer-zoomInDown;
|
||||
animation-name:layer-zoomInDown
|
||||
}
|
||||
@-webkit-keyframes layer-fadeInUpBig{
|
||||
0%{
|
||||
opacity:0;
|
||||
-webkit-transform:translateY(2000px);
|
||||
transform:translateY(2000px)
|
||||
}
|
||||
100%{
|
||||
opacity:1;
|
||||
-webkit-transform:translateY(0);
|
||||
transform:translateY(0)
|
||||
}
|
||||
}
|
||||
@keyframes layer-fadeInUpBig{
|
||||
0%{
|
||||
opacity:0;
|
||||
-webkit-transform:translateY(2000px);
|
||||
-ms-transform:translateY(2000px);
|
||||
transform:translateY(2000px)
|
||||
}
|
||||
100%{
|
||||
opacity:1;
|
||||
-webkit-transform:translateY(0);
|
||||
-ms-transform:translateY(0);
|
||||
transform:translateY(0)
|
||||
}
|
||||
}
|
||||
.layer-anim-02{
|
||||
-webkit-animation-name:layer-fadeInUpBig;
|
||||
animation-name:layer-fadeInUpBig
|
||||
}
|
||||
@-webkit-keyframes layer-zoomInLeft{
|
||||
0%{
|
||||
opacity:0;
|
||||
-webkit-transform:scale(.1) translateX(-2000px);
|
||||
transform:scale(.1) translateX(-2000px);
|
||||
-webkit-animation-timing-function:ease-in-out;
|
||||
animation-timing-function:ease-in-out
|
||||
}
|
||||
60%{
|
||||
opacity:1;
|
||||
-webkit-transform:scale(.475) translateX(48px);
|
||||
transform:scale(.475) translateX(48px);
|
||||
-webkit-animation-timing-function:ease-out;
|
||||
animation-timing-function:ease-out
|
||||
}
|
||||
}
|
||||
@keyframes layer-zoomInLeft{
|
||||
0%{
|
||||
opacity:0;
|
||||
-webkit-transform:scale(.1) translateX(-2000px);
|
||||
-ms-transform:scale(.1) translateX(-2000px);
|
||||
transform:scale(.1) translateX(-2000px);
|
||||
-webkit-animation-timing-function:ease-in-out;
|
||||
animation-timing-function:ease-in-out
|
||||
}
|
||||
60%{
|
||||
opacity:1;
|
||||
-webkit-transform:scale(.475) translateX(48px);
|
||||
-ms-transform:scale(.475) translateX(48px);
|
||||
transform:scale(.475) translateX(48px);
|
||||
-webkit-animation-timing-function:ease-out;
|
||||
animation-timing-function:ease-out
|
||||
}
|
||||
}
|
||||
.layer-anim-03{
|
||||
-webkit-animation-name:layer-zoomInLeft;
|
||||
animation-name:layer-zoomInLeft
|
||||
}
|
||||
@-webkit-keyframes layer-rollIn{
|
||||
0%{
|
||||
opacity:0;
|
||||
-webkit-transform:translateX(-100%) rotate(-120deg);
|
||||
transform:translateX(-100%) rotate(-120deg)
|
||||
}
|
||||
100%{
|
||||
opacity:1;
|
||||
-webkit-transform:translateX(0) rotate(0);
|
||||
transform:translateX(0) rotate(0)
|
||||
}
|
||||
}
|
||||
@keyframes layer-rollIn{
|
||||
0%{
|
||||
opacity:0;
|
||||
-webkit-transform:translateX(-100%) rotate(-120deg);
|
||||
-ms-transform:translateX(-100%) rotate(-120deg);
|
||||
transform:translateX(-100%) rotate(-120deg)
|
||||
}
|
||||
100%{
|
||||
opacity:1;
|
||||
-webkit-transform:translateX(0) rotate(0);
|
||||
-ms-transform:translateX(0) rotate(0);
|
||||
transform:translateX(0) rotate(0)
|
||||
}
|
||||
}
|
||||
.layer-anim-04{
|
||||
-webkit-animation-name:layer-rollIn;
|
||||
animation-name:layer-rollIn
|
||||
}
|
||||
@keyframes layer-fadeIn{
|
||||
0%{
|
||||
opacity:0
|
||||
}
|
||||
100%{
|
||||
opacity:1
|
||||
}
|
||||
}
|
||||
.layer-anim-05{
|
||||
-webkit-animation-name:layer-fadeIn;
|
||||
animation-name:layer-fadeIn
|
||||
}
|
||||
@-webkit-keyframes layer-shake{
|
||||
0%,100%{
|
||||
-webkit-transform:translateX(0);
|
||||
transform:translateX(0)
|
||||
}
|
||||
10%,30%,50%,70%,90%{
|
||||
-webkit-transform:translateX(-10px);
|
||||
transform:translateX(-10px)
|
||||
}
|
||||
20%,40%,60%,80%{
|
||||
-webkit-transform:translateX(10px);
|
||||
transform:translateX(10px)
|
||||
}
|
||||
}
|
||||
@keyframes layer-shake{
|
||||
0%,100%{
|
||||
-webkit-transform:translateX(0);
|
||||
-ms-transform:translateX(0);
|
||||
transform:translateX(0)
|
||||
}
|
||||
10%,30%,50%,70%,90%{
|
||||
-webkit-transform:translateX(-10px);
|
||||
-ms-transform:translateX(-10px);
|
||||
transform:translateX(-10px)
|
||||
}
|
||||
20%,40%,60%,80%{
|
||||
-webkit-transform:translateX(10px);
|
||||
-ms-transform:translateX(10px);
|
||||
transform:translateX(10px)
|
||||
}
|
||||
}
|
||||
.layer-anim-06{
|
||||
-webkit-animation-name:layer-shake;
|
||||
animation-name:layer-shake
|
||||
}
|
||||
@-webkit-keyframes fadeIn{
|
||||
0%{
|
||||
opacity:0
|
||||
}
|
||||
100%{
|
||||
opacity:1
|
||||
}
|
||||
}
|
||||
.layui-layer-title{
|
||||
padding:0 80px 0 20px;
|
||||
height:42px;
|
||||
line-height:42px;
|
||||
border-bottom:1px solid #eee;
|
||||
font-size:14px;
|
||||
color:#333;
|
||||
overflow:hidden;
|
||||
background-color:#F8F8F8;
|
||||
border-radius:2px 2px 0 0
|
||||
}
|
||||
.layui-layer-setwin{
|
||||
position:absolute;
|
||||
right:15px;
|
||||
*right:0;
|
||||
top:15px;
|
||||
font-size:0;
|
||||
line-height:initial
|
||||
}
|
||||
.layui-layer-setwin a{
|
||||
position:relative;
|
||||
width:16px;
|
||||
height:16px;
|
||||
margin-left:10px;
|
||||
font-size:12px;
|
||||
_overflow:hidden
|
||||
}
|
||||
.layui-layer-setwin .layui-layer-min cite{
|
||||
position:absolute;
|
||||
width:14px;
|
||||
height:2px;
|
||||
left:0;
|
||||
top:50%;
|
||||
margin-top:-1px;
|
||||
background-color:#2E2D3C;
|
||||
cursor:pointer;
|
||||
_overflow:hidden
|
||||
}
|
||||
.layui-layer-setwin .layui-layer-min:hover cite{
|
||||
background-color:#2D93CA
|
||||
}
|
||||
.layui-layer-setwin .layui-layer-max{
|
||||
background-position:-32px -40px
|
||||
}
|
||||
.layui-layer-setwin .layui-layer-max:hover{
|
||||
background-position:-16px -40px
|
||||
}
|
||||
.layui-layer-setwin .layui-layer-maxmin{
|
||||
background-position:-65px -40px
|
||||
}
|
||||
.layui-layer-setwin .layui-layer-maxmin:hover{
|
||||
background-position:-49px -40px
|
||||
}
|
||||
.layui-layer-setwin .layui-layer-close1{
|
||||
background-position:1px -40px;
|
||||
cursor:pointer
|
||||
}
|
||||
.layui-layer-setwin .layui-layer-close1:hover{
|
||||
opacity:.7
|
||||
}
|
||||
.layui-layer-setwin .layui-layer-close2{
|
||||
position:absolute;
|
||||
right:-28px;
|
||||
top:-28px;
|
||||
width:30px;
|
||||
height:30px;
|
||||
margin-left:0;
|
||||
background-position:-149px -31px;
|
||||
*right:-18px;
|
||||
_display:none
|
||||
}
|
||||
.layui-layer-setwin .layui-layer-close2:hover{
|
||||
background-position:-180px -31px
|
||||
}
|
||||
.layui-layer-btn{
|
||||
text-align:right;
|
||||
padding:0 15px 12px;
|
||||
pointer-events:auto;
|
||||
user-select:none;
|
||||
-webkit-user-select:none
|
||||
}
|
||||
.layui-layer-btn a{
|
||||
height:28px;
|
||||
line-height:28px;
|
||||
margin:5px 5px 0;
|
||||
padding:0 15px;
|
||||
border:1px solid #dedede;
|
||||
background-color:#fff;
|
||||
color:#333;
|
||||
border-radius:2px;
|
||||
font-weight:400;
|
||||
cursor:pointer;
|
||||
text-decoration:none
|
||||
}
|
||||
.layui-layer-btn a:hover{
|
||||
opacity:.9;
|
||||
text-decoration:none
|
||||
}
|
||||
.layui-layer-btn a:active{
|
||||
opacity:.8
|
||||
}
|
||||
.layui-layer-btn .layui-layer-btn0{
|
||||
border-color:#1E9FFF;
|
||||
background-color:#1E9FFF;
|
||||
color:#fff
|
||||
}
|
||||
.layui-layer-btn-l{
|
||||
text-align:left
|
||||
}
|
||||
.layui-layer-btn-c{
|
||||
text-align:center
|
||||
}
|
||||
.layui-layer-dialog{
|
||||
min-width:260px
|
||||
}
|
||||
.layui-layer-dialog .layui-layer-content{
|
||||
position:relative;
|
||||
padding:20px;
|
||||
line-height:24px;
|
||||
word-break:break-all;
|
||||
overflow:hidden;
|
||||
font-size:14px;
|
||||
overflow-x:hidden;
|
||||
overflow-y:auto;
|
||||
color: #000;
|
||||
}
|
||||
.layui-layer-dialog .layui-layer-content .layui-layer-ico{
|
||||
position:absolute;
|
||||
top:16px;
|
||||
left:15px;
|
||||
_left:-40px;
|
||||
width:30px;
|
||||
height:30px
|
||||
}
|
||||
.layui-layer-ico1{
|
||||
background-position:-30px 0
|
||||
}
|
||||
.layui-layer-ico2{
|
||||
background-position:-60px 0
|
||||
}
|
||||
.layui-layer-ico3{
|
||||
background-position:-90px 0
|
||||
}
|
||||
.layui-layer-ico4{
|
||||
background-position:-120px 0
|
||||
}
|
||||
.layui-layer-ico5{
|
||||
background-position:-150px 0
|
||||
}
|
||||
.layui-layer-ico6{
|
||||
background-position:-180px 0
|
||||
}
|
||||
.layui-layer-rim{
|
||||
border:6px solid #8D8D8D;
|
||||
border:6px solid rgba(0,0,0,.3);
|
||||
border-radius:5px;
|
||||
box-shadow:none
|
||||
}
|
||||
.layui-layer-msg{
|
||||
min-width:180px;
|
||||
border:1px solid #D3D4D3;
|
||||
box-shadow:none
|
||||
}
|
||||
.layui-layer-hui{
|
||||
min-width:100px;
|
||||
background-color:#000;
|
||||
filter:alpha(opacity=60);
|
||||
background-color:rgba(0,0,0,.6);
|
||||
color:#fff;
|
||||
border:none
|
||||
}
|
||||
.layui-layer-hui .layui-layer-content{
|
||||
padding:12px 25px;
|
||||
text-align:center;
|
||||
color: white;
|
||||
}
|
||||
.layui-layer-dialog .layui-layer-padding{
|
||||
padding:20px 20px 20px 55px;
|
||||
text-align:left
|
||||
}
|
||||
.layui-layer-page .layui-layer-content{
|
||||
position:relative;
|
||||
overflow:auto
|
||||
}
|
||||
.layui-layer-iframe .layui-layer-btn,.layui-layer-page .layui-layer-btn{
|
||||
padding-top:10px
|
||||
}
|
||||
.layui-layer-nobg{
|
||||
background:0 0
|
||||
}
|
||||
.layui-layer-iframe iframe{
|
||||
display:block;
|
||||
width:100%
|
||||
}
|
||||
.layui-layer-loading{
|
||||
border-radius:100%;
|
||||
background:0 0;
|
||||
box-shadow:none;
|
||||
border:none
|
||||
}
|
||||
.layui-layer-loading .layui-layer-content{
|
||||
width:60px;
|
||||
height:24px;
|
||||
background:url(loading-0.gif) no-repeat
|
||||
}
|
||||
.layui-layer-loading .layui-layer-loading1{
|
||||
width:37px;
|
||||
height:37px;
|
||||
background:url(loading-1.gif) no-repeat
|
||||
}
|
||||
.layui-layer-ico16,.layui-layer-loading .layui-layer-loading2{
|
||||
width:32px;
|
||||
height:32px;
|
||||
background:url(loading-2.gif) no-repeat
|
||||
}
|
||||
.layui-layer-tips{
|
||||
background:0 0;
|
||||
box-shadow:none;
|
||||
border:none
|
||||
}
|
||||
.layui-layer-tips .layui-layer-content{
|
||||
position:relative;
|
||||
line-height:22px;
|
||||
min-width:12px;
|
||||
padding:8px 15px;
|
||||
font-size:12px;
|
||||
_float:left;
|
||||
border-radius:2px;
|
||||
box-shadow:1px 1px 3px rgba(0,0,0,.2);
|
||||
background-color:#000;
|
||||
color:#fff
|
||||
}
|
||||
.layui-layer-tips .layui-layer-close{
|
||||
right:-2px;
|
||||
top:-1px
|
||||
}
|
||||
.layui-layer-tips i.layui-layer-TipsG{
|
||||
position:absolute;
|
||||
width:0;
|
||||
height:0;
|
||||
border-width:8px;
|
||||
border-color:transparent;
|
||||
border-style:dashed;
|
||||
*overflow:hidden
|
||||
}
|
||||
.layui-layer-tips i.layui-layer-TipsB,.layui-layer-tips i.layui-layer-TipsT{
|
||||
left:5px;
|
||||
border-right-style:solid;
|
||||
border-right-color:#000
|
||||
}
|
||||
.layui-layer-tips i.layui-layer-TipsT{
|
||||
bottom:-8px
|
||||
}
|
||||
.layui-layer-tips i.layui-layer-TipsB{
|
||||
top:-8px
|
||||
}
|
||||
.layui-layer-tips i.layui-layer-TipsL,.layui-layer-tips i.layui-layer-TipsR{
|
||||
top:5px;
|
||||
border-bottom-style:solid;
|
||||
border-bottom-color:#000
|
||||
}
|
||||
.layui-layer-tips i.layui-layer-TipsR{
|
||||
left:-8px
|
||||
}
|
||||
.layui-layer-tips i.layui-layer-TipsL{
|
||||
right:-8px
|
||||
}
|
||||
.layui-layer-lan[type=dialog]{
|
||||
min-width:280px
|
||||
}
|
||||
.layui-layer-lan .layui-layer-title{
|
||||
background:#4476A7;
|
||||
color:#fff;
|
||||
border:none
|
||||
}
|
||||
.layui-layer-lan .layui-layer-btn{
|
||||
padding:5px 10px 10px;
|
||||
text-align:right;
|
||||
border-top:1px solid #E9E7E7
|
||||
}
|
||||
.layui-layer-lan .layui-layer-btn a{
|
||||
background:#fff;
|
||||
border-color:#E9E7E7;
|
||||
color:#333
|
||||
}
|
||||
.layui-layer-lan .layui-layer-btn .layui-layer-btn1{
|
||||
background:#C9C5C5
|
||||
}
|
||||
.layui-layer-molv .layui-layer-title{
|
||||
background:#009f95;
|
||||
color:#fff;
|
||||
border:none
|
||||
}
|
||||
.layui-layer-molv .layui-layer-btn a{
|
||||
background:#009f95;
|
||||
border-color:#009f95
|
||||
}
|
||||
.layui-layer-molv .layui-layer-btn .layui-layer-btn1{
|
||||
background:#92B8B1
|
||||
}
|
||||
.layui-layer-iconext{
|
||||
background:url(icon-ext.png) no-repeat
|
||||
}
|
||||
.layui-layer-prompt .layui-layer-input{
|
||||
display:block;
|
||||
width:230px;
|
||||
height:36px;
|
||||
margin:0 auto;
|
||||
line-height:30px;
|
||||
padding-left:10px;
|
||||
border:1px solid #e6e6e6;
|
||||
color:#333
|
||||
}
|
||||
.layui-layer-prompt textarea.layui-layer-input{
|
||||
width:300px;
|
||||
height:100px;
|
||||
line-height:20px;
|
||||
padding:6px 10px
|
||||
}
|
||||
.layui-layer-prompt .layui-layer-content{
|
||||
padding:20px
|
||||
}
|
||||
.layui-layer-prompt .layui-layer-btn{
|
||||
padding-top:0
|
||||
}
|
||||
.layui-layer-tab{
|
||||
box-shadow:1px 1px 50px rgba(0,0,0,.4)
|
||||
}
|
||||
.layui-layer-tab .layui-layer-title{
|
||||
padding-left:0;
|
||||
overflow:visible
|
||||
}
|
||||
.layui-layer-tab .layui-layer-title span{
|
||||
position:relative;
|
||||
float:left;
|
||||
min-width:80px;
|
||||
max-width:260px;
|
||||
padding:0 20px;
|
||||
text-align:center;
|
||||
overflow:hidden;
|
||||
cursor:pointer
|
||||
}
|
||||
.layui-layer-tab .layui-layer-title span.layui-this{
|
||||
height:43px;
|
||||
border-left:1px solid #eee;
|
||||
border-right:1px solid #eee;
|
||||
background-color:#fff;
|
||||
z-index:10
|
||||
}
|
||||
.layui-layer-tab .layui-layer-title span:first-child{
|
||||
border-left:none
|
||||
}
|
||||
.layui-layer-tabmain{
|
||||
line-height:24px;
|
||||
clear:both
|
||||
}
|
||||
.layui-layer-tabmain .layui-layer-tabli{
|
||||
display:none
|
||||
}
|
||||
.layui-layer-tabmain .layui-layer-tabli.layui-this{
|
||||
display:block
|
||||
}
|
||||
.layui-layer-photos{
|
||||
-webkit-animation-duration:.8s;
|
||||
animation-duration:.8s
|
||||
}
|
||||
.layui-layer-photos .layui-layer-content{
|
||||
overflow:hidden;
|
||||
text-align:center
|
||||
}
|
||||
.layui-layer-photos .layui-layer-phimg img{
|
||||
position:relative;
|
||||
width:100%;
|
||||
display:inline-block;
|
||||
*display:inline;
|
||||
*zoom:1;
|
||||
vertical-align:top
|
||||
}
|
||||
.layui-layer-imgbar,.layui-layer-imguide{
|
||||
display:none
|
||||
}
|
||||
.layui-layer-imgnext,.layui-layer-imgprev{
|
||||
position:absolute;
|
||||
top:50%;
|
||||
width:27px;
|
||||
_width:44px;
|
||||
height:44px;
|
||||
margin-top:-22px;
|
||||
outline:0;
|
||||
blr:expression(this.onFocus=this.blur())
|
||||
}
|
||||
.layui-layer-imgprev{
|
||||
left:10px;
|
||||
background-position:-5px -5px;
|
||||
_background-position:-70px -5px
|
||||
}
|
||||
.layui-layer-imgprev:hover{
|
||||
background-position:-33px -5px;
|
||||
_background-position:-120px -5px
|
||||
}
|
||||
.layui-layer-imgnext{
|
||||
right:10px;
|
||||
_right:8px;
|
||||
background-position:-5px -50px;
|
||||
_background-position:-70px -50px
|
||||
}
|
||||
.layui-layer-imgnext:hover{
|
||||
background-position:-33px -50px;
|
||||
_background-position:-120px -50px
|
||||
}
|
||||
.layui-layer-imgbar{
|
||||
position:absolute;
|
||||
left:0;
|
||||
bottom:0;
|
||||
width:100%;
|
||||
height:32px;
|
||||
line-height:32px;
|
||||
background-color:rgba(0,0,0,.8);
|
||||
background-color:#000\9;
|
||||
filter:Alpha(opacity=80);
|
||||
color:#fff;
|
||||
overflow:hidden;
|
||||
font-size:0
|
||||
}
|
||||
.layui-layer-imgtit *{
|
||||
display:inline-block;
|
||||
*display:inline;
|
||||
*zoom:1;
|
||||
vertical-align:top;
|
||||
font-size:12px
|
||||
}
|
||||
.layui-layer-imgtit a{
|
||||
max-width:65%;
|
||||
overflow:hidden;
|
||||
color:#fff
|
||||
}
|
||||
.layui-layer-imgtit a:hover{
|
||||
color:#fff;
|
||||
text-decoration:underline
|
||||
}
|
||||
.layui-layer-imgtit em{
|
||||
padding-left:10px;
|
||||
font-style:normal
|
||||
}
|
||||
@-webkit-keyframes layer-bounceOut{
|
||||
100%{
|
||||
opacity:0;
|
||||
-webkit-transform:scale(.7);
|
||||
transform:scale(.7)
|
||||
}
|
||||
30%{
|
||||
-webkit-transform:scale(1.05);
|
||||
transform:scale(1.05)
|
||||
}
|
||||
0%{
|
||||
-webkit-transform:scale(1);
|
||||
transform:scale(1)
|
||||
}
|
||||
}
|
||||
@keyframes layer-bounceOut{
|
||||
100%{
|
||||
opacity:0;
|
||||
-webkit-transform:scale(.7);
|
||||
-ms-transform:scale(.7);
|
||||
transform:scale(.7)
|
||||
}
|
||||
30%{
|
||||
-webkit-transform:scale(1.05);
|
||||
-ms-transform:scale(1.05);
|
||||
transform:scale(1.05)
|
||||
}
|
||||
0%{
|
||||
-webkit-transform:scale(1);
|
||||
-ms-transform:scale(1);
|
||||
transform:scale(1)
|
||||
}
|
||||
}
|
||||
.layer-anim-close{
|
||||
-webkit-animation-name:layer-bounceOut;
|
||||
animation-name:layer-bounceOut;
|
||||
-webkit-animation-fill-mode:both;
|
||||
animation-fill-mode:both;
|
||||
-webkit-animation-duration:.2s;
|
||||
animation-duration:.2s
|
||||
}
|
||||
@media screen and (max-width:1100px){
|
||||
.layui-layer-iframe{
|
||||
overflow-y:auto;
|
||||
-webkit-overflow-scrolling:touch
|
||||
}
|
||||
}
|
BIN
shadowsocks/shadowsocks/res/layer/theme/default/loading-0.gif
Normal file
After Width: | Height: | Size: 5.7 KiB |
BIN
shadowsocks/shadowsocks/res/layer/theme/default/loading-1.gif
Normal file
After Width: | Height: | Size: 701 B |
BIN
shadowsocks/shadowsocks/res/layer/theme/default/loading-2.gif
Normal file
After Width: | Height: | Size: 1.7 KiB |
@ -44,7 +44,7 @@
|
||||
border-radius: 5px 5px 5px 5px;
|
||||
width:20%;
|
||||
}
|
||||
.show-btn1, .show-btn1_1, .show-btn2, .show-btn3, .show-btn4, .show-btn5, .show-btn6, .show-btn7 {
|
||||
.show-btn1, .show-btn1_1, .show-btn2, .show-btn3, .show-btn3_1, .show-btn3_2, .show-btn4, .show-btn5, .show-btn6, .show-btn7 {
|
||||
border: 1px solid #222;
|
||||
background: linear-gradient(to bottom, #76a0ba 0%, #688292 100%); /* W3C */
|
||||
background: linear-gradient(to bottom, #919fa4 0%, #67767d 100%); /* W3C */
|
||||
@ -133,36 +133,18 @@ input[type=button]:focus {
|
||||
border: 1px solid #222;
|
||||
}
|
||||
|
||||
#ss_node_list_table_td { -ms-overflow-style: none; overflow: auto; } /* for IE hide scrollbar on ss node ta */
|
||||
#ss_node_list_table_td::-webkit-scrollbar {
|
||||
width: 0px; /* remove scrollbar space */
|
||||
background: transparent; /* optional: just make scrollbar invisible */
|
||||
}
|
||||
|
||||
#log_content3, #log_content1, #proc_status { -ms-overflow-style: none; overflow: auto; } /* for IE hide scrollbar on ss node ta */
|
||||
#log_content3::-webkit-scrollbar, #log_content1::-webkit-scrollbar, #proc_status::-webkit-scrollbar {
|
||||
width: 0px; /* remove scrollbar space */
|
||||
background: transparent; /* optional: just make scrollbar invisible */
|
||||
}
|
||||
#log_content3:focus, #log_content1:focus, #proc_status:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
#log_content3, #log_content1, #proc_status {overflow: -moz-scrollbars-none;}
|
||||
|
||||
|
||||
.FormTable1{
|
||||
table-layout:fixed;
|
||||
width:748px;
|
||||
width:749.71px;
|
||||
font-size:12px;
|
||||
font-family:Arial, Helvetica, sans-serif;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
border: 1px solid #000000;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
.FormTable1 th{
|
||||
table-layout:fixed;
|
||||
overflow:hidden;
|
||||
font-family:Arial, Helvetica, sans-serif;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
background-color:#1F2D35;
|
||||
color:#FFFFFF ; /*Viz add*/
|
||||
font-weight:normal;
|
||||
@ -194,7 +176,7 @@ input[type=button]:focus {
|
||||
.SimpleNote { padding:5px 10px;}
|
||||
|
||||
#iframe1{
|
||||
font-family: sans-serif;
|
||||
font-family: Lucida Console;
|
||||
color: red;
|
||||
}
|
||||
|
||||
@ -206,7 +188,7 @@ input[type=button]:focus {
|
||||
border-bottom-width:1px;
|
||||
border-color:#888;
|
||||
color:#FFFFFF;
|
||||
font-family:'Courier New', Courier, mono;
|
||||
font-family: Lucida Console;
|
||||
font-size:13px;
|
||||
}
|
||||
.input_option_2{
|
||||
@ -214,7 +196,7 @@ input[type=button]:focus {
|
||||
background-color:#475a5f;
|
||||
border: 0px solid #222;
|
||||
color:#FFFFFF;
|
||||
font-family:'Courier New', Courier, mono;
|
||||
font-family: Lucida Console;
|
||||
font-size:13px;
|
||||
}
|
||||
|
||||
@ -223,7 +205,7 @@ input[type=button]:focus {
|
||||
background-color:#576D73;
|
||||
border: 0px solid #222;
|
||||
color:#FFFFFF;
|
||||
font-family:'Courier New', Courier, mono;
|
||||
font-family: Lucida Console;
|
||||
font-size:13px;
|
||||
}
|
||||
#ss_basic_kcp_parameter{
|
||||
@ -232,7 +214,7 @@ input[type=button]:focus {
|
||||
overflow: hidden;
|
||||
width: 99%;
|
||||
font-size: 13px;
|
||||
font-family:'Courier New', Courier, mono;
|
||||
font-family: Lucida Console;
|
||||
height: 25px;
|
||||
line-height: 1.5;
|
||||
padding:0px;
|
||||
@ -255,29 +237,12 @@ input[type=button]:focus {
|
||||
border-radius: 5px 5px 5px 5px;
|
||||
width:14%;
|
||||
}
|
||||
.kp_btn {
|
||||
border: 1px solid #222;
|
||||
background: linear-gradient(to bottom, #003333 0%, #000000 100%); /* W3C */
|
||||
font-size:10pt;
|
||||
color: #fff;
|
||||
padding: 5px 5px;
|
||||
border-radius: 5px 5px 5px 5px;
|
||||
width:14%;
|
||||
}
|
||||
.kp_btn:hover {
|
||||
border: 1px solid #222;
|
||||
background: linear-gradient(to bottom, #27c9c9 0%, #279fd9 100%); /* W3C */
|
||||
font-size:10pt;
|
||||
color: #fff;
|
||||
padding: 5px 5px;
|
||||
border-radius: 5px 5px 5px 5px;
|
||||
width:14%;
|
||||
}
|
||||
|
||||
.FormTitle_chrome56{
|
||||
margin-top:-100px;
|
||||
line-height:160%;
|
||||
font-size:12px;
|
||||
font-family:Arial, Verdana, Arial, Helvetica, sans-serif;
|
||||
font-family: Lucida Console;
|
||||
border:1px solid #4D595D;
|
||||
color:white;
|
||||
position:relative;
|
||||
@ -319,7 +284,6 @@ input[type=button]:focus {
|
||||
margin-top:-100px;
|
||||
line-height:160%;
|
||||
font-size:12px;
|
||||
font-family:Arial, Verdana, Arial, Helvetica, sans-serif;
|
||||
border:1px solid #4D595D;
|
||||
color:white;
|
||||
}
|
||||
@ -347,3 +311,35 @@ input[type=button]:focus {
|
||||
font-style: normal;
|
||||
font-weight:normal;
|
||||
}
|
||||
.input_ss_table{
|
||||
margin-left:2px;
|
||||
padding-left:0.4em;
|
||||
height:21px;
|
||||
width:158.2px;
|
||||
line-height:23px \9; /*IE*/
|
||||
font-size:13px;
|
||||
font-family: Lucida Console;
|
||||
background-image:none;
|
||||
background-color: #576d73;
|
||||
border:1px solid gray;
|
||||
color:#FFFFFF;
|
||||
}
|
||||
|
||||
.sub-btn1, .sub-btn2, .sub-btn3 {
|
||||
border: 1px solid #222;
|
||||
border-bottom:none;
|
||||
background: linear-gradient(to bottom, #919fa4 0%, #67767d 100%); /* W3C */
|
||||
font-size:10pt;
|
||||
color: #fff;
|
||||
padding: 10px 3.75px;
|
||||
border-radius: 5px 5px 0px 0px;
|
||||
width:16%;
|
||||
}
|
||||
.sub-btn1:hover, .sub-btn2:hover, .sub-btn3:hover, .active2 {
|
||||
background: #2f3a3e;
|
||||
}
|
||||
|
||||
.cloud_main_radius h2 { border-bottom:1px #AAA dashed;}
|
||||
.cloud_main_radius h3 { font-size:12px;color:#FFF;font-weight:normal;font-style: normal;}
|
||||
.cloud_main_radius h4 { font-size:12px;color:#FC0;font-weight:normal;font-style: normal;}
|
||||
.cloud_main_radius h5 { color:#FFF;font-weight:normal;font-style: normal;}
|
||||
|
1
shadowsocks/shadowsocks/res/ss_udp_status.htm
Normal file
@ -0,0 +1 @@
|
||||
<% nvram_dump("ss_udp_status.log",""); %>
|
@ -1,9 +1,10 @@
|
||||
#!/bin/sh
|
||||
alias echo_date='echo $(date +%Y年%m月%d日\ %X):'
|
||||
|
||||
source /jffs/softcenter/scripts/base.sh
|
||||
alias echo_date='echo 【$(TZ=UTC-8 date -R +%Y年%m月%d日\ %X)】:'
|
||||
|
||||
echo_date 开始清理shadowsocks配置...
|
||||
confs=`dbus list ss | cut -d "=" -f 1 | grep -v "version" | grep -v "ss_basic_state_china" | grep -v "ss_basic_state_foreign"`
|
||||
|
||||
confs=`dbus list ss | cut -d "=" -f 1 | grep -v "version" | grep -v "ssserver_" | grep -v "ssid_" |grep -v "ss_basic_state_china" | grep -v "ss_basic_state_foreign"`
|
||||
for conf in $confs
|
||||
do
|
||||
echo_date 移除$conf
|
||||
@ -13,4 +14,4 @@ echo_date 设置一些默认参数...
|
||||
dbus set ss_basic_enable="0"
|
||||
dbus set ss_basic_version_local=`cat /jffs/softcenter/ss/version`
|
||||
echo_date 尝试关闭shadowsocks...
|
||||
sh /jffs/softcenter/ss/stop.sh stop_all
|
||||
sh /jffs/softcenter/ss/ssconfig.sh stop
|
||||
|
@ -1,47 +1,100 @@
|
||||
#!/bin/sh
|
||||
|
||||
source /jffs/softcenter/scripts/base.sh
|
||||
alias echo_date='echo $(date +%Y年%m月%d日\ %X):'
|
||||
alias echo_date='echo 【$(TZ=UTC-8 date -R +%Y年%m月%d日\ %X)】:'
|
||||
|
||||
remove_first(){
|
||||
confs2=`dbus list ss | cut -d "=" -f 1 | grep -v "version" | grep -v "ssserver_" | grep -v "ssid_" |grep -v "ss_basic_state_china" | grep -v "ss_basic_state_foreign"`
|
||||
for conf in $confs2
|
||||
do
|
||||
echo_date 移除$conf
|
||||
dbus remove $conf
|
||||
done
|
||||
}
|
||||
|
||||
upgrade_ss_conf(){
|
||||
nodes=`dbus list ssc|grep port|cut -d "=" -f1|cut -d "_" -f4|sort -n`
|
||||
for node in $nodes
|
||||
do
|
||||
if [ "`dbus get ssconf_basic_use_rss_$node`" == "1" ];then
|
||||
#ssr
|
||||
dbus remove ssconf_basic_ss_obfs_$node
|
||||
dbus remove ssconf_basic_ss_obfs_host_$node
|
||||
dbus remove ssconf_basic_koolgame_udp_$node
|
||||
else
|
||||
if [ -n "`dbus get ssconf_basic_koolgame_udp_$node`" ];then
|
||||
#koolgame
|
||||
dbus remove ssconf_basic_rss_protocol_$node
|
||||
dbus remove ssconf_basic_rss_protocol_param_$node
|
||||
dbus remove ssconf_basic_rss_obfs_$node
|
||||
dbus remove ssconf_basic_rss_obfs_param_$node
|
||||
dbus remove ssconf_basic_ss_obfs_$node
|
||||
dbus remove ssconf_basic_ss_obfs_host_$node
|
||||
else
|
||||
#ss
|
||||
dbus remove ssconf_basic_rss_protocol_$node
|
||||
dbus remove ssconf_basic_rss_protocol_param_$node
|
||||
dbus remove ssconf_basic_rss_obfs_$node
|
||||
dbus remove ssconf_basic_rss_obfs_param_$node
|
||||
dbus remove ssconf_basic_koolgame_udp_$node
|
||||
[ -z "`dbus get ssconf_basic_ss_obfs_$node`" ] && dbus set ssconf_basic_ss_obfs_$node="0"
|
||||
fi
|
||||
fi
|
||||
dbus remove ssconf_basic_use_rss_$node
|
||||
done
|
||||
|
||||
use_node=`dbus get ssconf_basic_node`
|
||||
[ -z "$use_node" ] && use_node="1"
|
||||
dbus remove ss_basic_server
|
||||
dbus remove ss_basic_mode
|
||||
dbus remove ss_basic_port
|
||||
dbus remove ss_basic_method
|
||||
dbus remove ss_basic_ss_obfs
|
||||
dbus remove ss_basic_ss_obfs_host
|
||||
dbus remove ss_basic_rss_protocol
|
||||
dbus remove ss_basic_rss_protocol_param
|
||||
dbus remove ss_basic_rss_obfs
|
||||
dbus remove ss_basic_rss_obfs_param
|
||||
dbus remove ss_basic_koolgame_udp
|
||||
dbus remove ss_basic_use_rss
|
||||
dbus remove ss_basic_use_kcp
|
||||
sleep 1
|
||||
[ -n "`dbus get ssconf_basic_server_$node`" ] && dbus set ss_basic_server=`dbus get ssconf_basic_server_$node`
|
||||
[ -n "`dbus get ssconf_basic_mode_$node`" ] && dbus set ss_basic_mode=`dbus get ssconf_basic_mode_$node`
|
||||
[ -n "`dbus get ssconf_basic_port_$node`" ] && dbus set ss_basic_port=`dbus get ssconf_basic_port_$node`
|
||||
[ -n "`dbus get ssconf_basic_method_$node`" ] && dbus set ss_basic_method=`dbus get ssconf_basic_method_$node`
|
||||
[ -n "`dbus get ssconf_basic_ss_obfs_$node`" ] && dbus set ss_basic_ss_obfs=`dbus get ssconf_basic_ss_obfs_$node`
|
||||
[ -n "`dbus get ssconf_basic_ss_obfs_host_$node`" ] && dbus set ss_basic_ss_obfs_host=`dbus get ssconf_basic_ss_obfs_host_$node`
|
||||
[ -n "`dbus get ssconf_basic_rss_protocol_$node`" ] && dbus set ss_basic_rss_protocol=`dbus get ssconf_basic_rss_protocol_$node`
|
||||
[ -n "`dbus get ssconf_basic_rss_protocol_param_$node`" ] && dbus set ss_basic_rss_protocol_param=`dbus get ssconf_basic_rss_protocol_param_$node`
|
||||
[ -n "`dbus get ssconf_basic_rss_obfs_$node`" ] && dbus set ss_basic_rss_obfs=`dbus get ssconf_basic_rss_obfs_$node`
|
||||
[ -n "`dbus get ssconf_basic_rss_obfs_param_$node`" ] && dbus set ss_basic_rss_obfs_param=`dbus get ssconf_basic_rss_obfs_param_$node`
|
||||
[ -n "`dbus get ssconf_basic_koolgame_udp_$node`" ] && dbus set ss_basic_koolgame_udp=`dbus get ssconf_basic_koolgame_udp_$node`
|
||||
[ -n "`dbus get ssconf_basic_use_kcp_$node`" ] && dbus set ss_basic_koolgame_udp=`dbus get ssconf_basic_use_kcp_$node`
|
||||
}
|
||||
|
||||
remove_first
|
||||
|
||||
confs=`cat /tmp/ss_conf_backup.txt`
|
||||
format=`echo $confs|grep "{"`
|
||||
if [ -z "$format" ];then
|
||||
echo_date 检测到ss备份文件...
|
||||
cat /tmp/ss_conf_backup.txt | grep -E "^ss"| sed '/webtest/d' | sed '/ping/d' |sed '/ss_node_table/d' | sed '/_state_/d' | sed 's/=/=\"/' | sed 's/$/\"/g'|sed 's/^/dbus set /' | sed '1 i\\n' | sed '1 isource /jffs/softcenter/scripts/base.sh' | sed '1 i#!/bin/sh' > /tmp/ss_conf_backup_tmp.sh
|
||||
cat /tmp/ss_conf_backup.txt | grep -E "^ss"| sed '/webtest/d' | sed '/ssid_/d' | sed '/ssserver_/d' | sed '/ping/d' |sed '/ss_node_table/d' | sed '/_state_/d' | sed 's/=/=\"/' | sed 's/$/\"/g'|sed 's/^/dbus set /' | sed '1 i\\n' | sed '1 isource /jffs/softcenter/scripts/base.sh' | sed '1 i#!/bin/sh' > /tmp/ss_conf_backup_tmp.sh
|
||||
echo_date 开始恢复配置...
|
||||
chmod +x /tmp/ss_conf_backup_tmp.sh
|
||||
sh /tmp/ss_conf_backup_tmp.sh
|
||||
sleep 1
|
||||
sleep 2
|
||||
backup_version=`dbus get ss_basic_version_local`
|
||||
comp=`versioncmp $backup_version 3.0.0`
|
||||
[ -z "$backup_version" ] && backup_version="3.6.5"
|
||||
comp=`versioncmp $backup_version 3.6.5`
|
||||
if [ "$comp" == "1" ];then
|
||||
echo_date 检测到备份文件来自低于3.0.0版本,开始对部分数据进行base64转换,以适应新版本!
|
||||
node_pass=`dbus list ssconf_basic_password |cut -d "=" -f 1|cut -d "_" -f4|sort -n`
|
||||
for node in $node_pass
|
||||
do
|
||||
dbus set ssconf_basic_password_$node=`dbus get ssconf_basic_password_$node|base64`
|
||||
done
|
||||
dbus set ss_basic_password=`dbus get ss_basic_password|base64`
|
||||
dbus set ss_basic_black_lan=`dbus get ss_basic_black_lan | base64`
|
||||
dbus set ss_basic_white_lan=`dbus get ss_basic_white_lan | base64`
|
||||
dbus set ss_ipset_black_domain_web=`dbus get ss_ipset_black_domain_web | base64`
|
||||
dbus set ss_ipset_white_domain_web=`dbus get ss_ipset_white_domain_web | base64`
|
||||
dbus set ss_ipset_dnsmasq=`dbus get ss_ipset_dnsmasq | base64`
|
||||
dbus set ss_ipset_black_ip=`dbus get ss_ipset_black_ip | base64`
|
||||
dbus set ss_redchn_isp_website_web=`dbus get ss_redchn_isp_website_web | base64`
|
||||
dbus set ss_redchn_dnsmasq=`dbus get ss_redchn_dnsmasq | base64`
|
||||
dbus set ss_redchn_wan_white_ip=`dbus get ss_redchn_wan_white_ip | base64`
|
||||
dbus set ss_redchn_wan_white_domain=`dbus get ss_redchn_wan_white_domain | base64`
|
||||
dbus set ss_redchn_wan_black_ip=`dbus get ss_redchn_wan_black_ip | base64`
|
||||
dbus set ss_redchn_wan_black_domain=`dbus get ss_redchn_wan_black_domain | base64`
|
||||
dbus set ss_game_dnsmasq=`dbus get ss_game_dnsmasq | base64`
|
||||
dbus set ss_gameV2_dnsmasq=`dbus get ss_gameV2_dnsmasq | base64`
|
||||
echo_date 检测到备份文件来自低于3.6.5版本,开始对部分数据进行升级,以适应新版本!
|
||||
upgrade_ss_conf
|
||||
fi
|
||||
|
||||
dbus set ss_basic_enable="0"
|
||||
dbus set ss_basic_version_local=`cat /jffs/softcenter/ss/version`
|
||||
|
||||
echo_date 配置恢复成功!
|
||||
|
||||
else
|
||||
ss_formate=`echo $confs|grep "obfs"`
|
||||
if [ -z "$ss_formate" ];then
|
||||
@ -98,10 +151,9 @@ else
|
||||
|
||||
dbus set ssconf_basic_server_"$k"="$server"
|
||||
dbus set ssconf_basic_port_"$k"="$port"
|
||||
dbus set ssconf_basic_password_"$k"=`echo "$password" | base64`
|
||||
dbus set ssconf_basic_password_"$k"=`echo "$password" | base64_encode`
|
||||
dbus set ssconf_basic_method_"$k"="$method"
|
||||
dbus set ssconf_basic_name_"$k"="$remark"
|
||||
dbus set ssconf_basic_use_rss_"$k"=0
|
||||
dbus set ssconf_basic_mode_"$k"=2
|
||||
min=`expr $min + 1`
|
||||
k=`expr $k + 1`
|
||||
@ -172,14 +224,13 @@ else
|
||||
|
||||
dbus set ssconf_basic_server_"$k"="$server"
|
||||
dbus set ssconf_basic_port_"$k"="$port"
|
||||
dbus set ssconf_basic_password_"$k"=`echo "$password" | base64`
|
||||
dbus set ssconf_basic_password_"$k"=`echo "$password" | base64_encode`
|
||||
dbus set ssconf_basic_method_"$k"="$method"
|
||||
dbus set ssconf_basic_name_"$k"="$remark"
|
||||
dbus set ssconf_basic_rss_obfs_"$k"="$obf"
|
||||
dbus set ssconf_basic_rss_obfs_param_"$k"="$obfspara"
|
||||
dbus set ssconf_basic_rss_protocol_"$k"="$protoco"
|
||||
dbus set ssconf_basic_rss_protocol_para_"$k"="$protocolpara"
|
||||
dbus set ssconf_basic_use_rss_"$k"=1
|
||||
dbus set ssconf_basic_rss_protocol_param_"$k"="$protocolpara"
|
||||
dbus set ssconf_basic_mode_"$k"=2
|
||||
min=`expr $min + 1`
|
||||
k=`expr $k + 1`
|
||||
@ -187,7 +238,8 @@ else
|
||||
echo_date 导入配置成功!
|
||||
fi
|
||||
fi
|
||||
echo_date 一点点清理工作...
|
||||
sleep 2
|
||||
rm -rf /tmp/ss_conf_*
|
||||
echo_date 完成!
|
||||
|
||||
echo_date 一点点清理工作...
|
||||
sleep 1
|
||||
rm -rf /tmp/ss_conf_*
|
||||
echo_date 完成!
|
||||
|
@ -1,11 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
# 导入skipd数据
|
||||
eval `dbus export ss`
|
||||
ss_basic_dnslookup_server="114.114.114.114"
|
||||
|
||||
# 引用环境变量等
|
||||
source /jffs/softcenter/scripts/base.sh
|
||||
username=`nvram get http_username`
|
||||
alias echo_date='echo $(date +%Y年%m月%d日\ %X):'
|
||||
alias echo_date='echo 【$(TZ=UTC-8 date -R +%Y年%m月%d日\ %X)】:'
|
||||
|
||||
write_haproxy_cfg(){
|
||||
echo_date 生成haproxy配置文件到/jffs/softcenter/configs目录.
|
||||
@ -189,7 +191,7 @@ start_haproxy(){
|
||||
echo_date ┣如果此处等待过久,可能服务器域名解析失败造成的!可以刷新页面后关闭一次SS!
|
||||
echo_date ┣然后进入附加设置-SS服务器地址解析,更改解析dns或者更换解析方式!
|
||||
echo_date ┗启动haproxy主进程...
|
||||
haproxy -f /koolshare/configs/haproxy.cfg
|
||||
haproxy -f /jffs/softcenter/configs/haproxy.cfg
|
||||
fi
|
||||
}
|
||||
|
||||
@ -200,5 +202,7 @@ if [ "$ss_lb_enable" == "1" ];then
|
||||
start_haproxy
|
||||
echo_date 成功!
|
||||
else
|
||||
echo_date 关闭haproxy进程!
|
||||
killall haproxy >/dev/null 2>&1
|
||||
echo_date 成功!
|
||||
fi
|
||||
|
1100
shadowsocks/shadowsocks/scripts/ss_online_update.sh
Executable file
63
shadowsocks/shadowsocks/scripts/ss_pack.sh
Executable file
@ -0,0 +1,63 @@
|
||||
#!/bin/sh
|
||||
|
||||
rm -rf /tmp/shadowsocks*
|
||||
|
||||
echo "开始打包..."
|
||||
echo "请等待一会儿..."
|
||||
|
||||
cd /tmp
|
||||
mkdir shadowsocks
|
||||
mkdir shadowsocks/bin
|
||||
mkdir shadowsocks/scripts
|
||||
mkdir shadowsocks/webs
|
||||
mkdir shadowsocks/res
|
||||
|
||||
TARGET_FOLDER=/tmp/shadowsocks
|
||||
cp /jffs/softcenter/scripts/ss_install.sh $TARGET_FOLDER/install.sh
|
||||
cp /jffs/softcenter/scripts/uninstall_shadowsocks.sh $TARGET_FOLDER/uninstall.sh
|
||||
cp /jffs/softcenter/scripts/ss_* $TARGET_FOLDER/scripts/
|
||||
cp /jffs/softcenter/bin/ss-local $TARGET_FOLDER/bin/
|
||||
cp /jffs/softcenter/bin/ss-redir $TARGET_FOLDER/bin/
|
||||
cp /jffs/softcenter/bin/ss-tunnel $TARGET_FOLDER/bin/
|
||||
cp /jffs/softcenter/bin/obfs-local $TARGET_FOLDER/bin/
|
||||
cp /jffs/softcenter/bin/rss-local $TARGET_FOLDER/bin/
|
||||
cp /jffs/softcenter/bin/rss-redir $TARGET_FOLDER/bin/
|
||||
cp /jffs/softcenter/bin/koolgame $TARGET_FOLDER/bin/
|
||||
cp /jffs/softcenter/bin/pdu $TARGET_FOLDER/bin/
|
||||
cp /jffs/softcenter/bin/dns2socks $TARGET_FOLDER/bin/
|
||||
cp /jffs/softcenter/bin/cdns $TARGET_FOLDER/bin/
|
||||
cp /jffs/softcenter/bin/chinadns $TARGET_FOLDER/bin/
|
||||
cp /jffs/softcenter/bin/chinadns1 $TARGET_FOLDER/bin/
|
||||
cp /jffs/softcenter/bin/resolveip $TARGET_FOLDER/bin/
|
||||
cp /jffs/softcenter/bin/haproxy $TARGET_FOLDER/bin/
|
||||
cp /jffs/softcenter/bin/client_linux_mips $TARGET_FOLDER/bin/
|
||||
cp /jffs/softcenter/bin/base64_encode $TARGET_FOLDER/bin/
|
||||
cp /jffs/softcenter/bin/koolbox $TARGET_FOLDER/bin/
|
||||
cp /jffs/softcenter/bin/jq $TARGET_FOLDER/bin/
|
||||
cp /jffs/softcenter/bin/speeder* $TARGET_FOLDER/bin/
|
||||
cp /jffs/softcenter/bin/udp2raw $TARGET_FOLDER/bin/
|
||||
cp /jffs/softcenter/bin/v2ray $TARGET_FOLDER/bin/
|
||||
cp /jffs/softcenter/bin/v2ctl $TARGET_FOLDER/bin/
|
||||
cp /jffs/softcenter/bin/haveged $TARGET_FOLDER/bin/
|
||||
cp /jffs/softcenter/bin/https_dns_proxy $TARGET_FOLDER/bin/
|
||||
cp /jffs/softcenter/bin/dnsmasq $TARGET_FOLDER/bin/
|
||||
cp /jffs/softcenter/webs/Main_Ss_Content.asp $TARGET_FOLDER/webs/
|
||||
cp /jffs/softcenter/webs/Main_Ss_LoadBlance.asp $TARGET_FOLDER/webs/
|
||||
cp /jffs/softcenter/webs/Main_SsLocal_Content.asp $TARGET_FOLDER/webs/
|
||||
cp /jffs/softcenter/res/icon-shadowsocks.png $TARGET_FOLDER/res/
|
||||
cp /jffs/softcenter/res/ss-menu.js $TARGET_FOLDER/res/
|
||||
cp /jffs/softcenter/res/all.png $TARGET_FOLDER/res/
|
||||
cp /jffs/softcenter/res/gfw.png $TARGET_FOLDER/res/
|
||||
cp /jffs/softcenter/res/chn.png $TARGET_FOLDER/res/
|
||||
cp /jffs/softcenter/res/game.png $TARGET_FOLDER/res/
|
||||
cp /jffs/softcenter/res/gameV2.png $TARGET_FOLDER/res/
|
||||
cp /jffs/softcenter/res/shadowsocks.css $TARGET_FOLDER/res/
|
||||
cp /jffs/softcenter/res/ss_proc_status.htm $TARGET_FOLDER/res/
|
||||
cp /jffs/softcenter/res/ss_udp_status.htm $TARGET_FOLDER/res/
|
||||
cp -rf /jffs/softcenter/res/layer $TARGET_FOLDER/res/
|
||||
cp -r /jffs/softcenter/ss $TARGET_FOLDER/
|
||||
rm -rf $TARGET_FOLDER/ss/*.json
|
||||
|
||||
tar -czv -f /tmp/shadowsocks.tar.gz shadowsocks/
|
||||
rm -rf $TARGET_FOLDER
|
||||
echo "打包完毕!"
|
@ -12,35 +12,35 @@ if [ ! -z "$pings" ];then
|
||||
fi
|
||||
|
||||
# start testing
|
||||
if [ "$ssconf_basic_Ping_node" != "0" ];then
|
||||
server_mu="$ssconf_basic_Ping_node"
|
||||
server_address=`dbus get ssconf_basic_server_$server_mu`
|
||||
[ "$ssconf_basic_Ping_Method" == "5" ] && ping_text=`ping -4 $server_address -c 10 -w 10 -q`
|
||||
[ "$ssconf_basic_Ping_Method" == "6" ] && ping_text=`ping -4 $server_address -c 20 -w 20 -q`
|
||||
[ "$ssconf_basic_Ping_Method" == "7" ] && ping_text=`ping -4 $server_address -c 50 -w 50 -q`
|
||||
if [ "$ssconf_basic_ping_node" != "0" ];then
|
||||
server_nu="$ssconf_basic_ping_node"
|
||||
server_address=`dbus get ssconf_basic_server_$server_nu`
|
||||
[ "$ssconf_basic_ping_method" == "5" ] && ping_text=`ping -4 $server_address -c 10 -w 10 -q`
|
||||
[ "$ssconf_basic_ping_method" == "6" ] && ping_text=`ping -4 $server_address -c 20 -w 20 -q`
|
||||
[ "$ssconf_basic_ping_method" == "7" ] && ping_text=`ping -4 $server_address -c 50 -w 50 -q`
|
||||
ping_time=`echo $ping_text | awk -F '/' '{print $4}'`
|
||||
ping_loss=`echo $ping_text | awk -F ', ' '{print $3}' | awk '{print $1}'`
|
||||
|
||||
if [ ! -z "$ping_time" ];then
|
||||
dbus set ssconf_basic_ping_"$server_mu"="$ping_time" ms / "$ping_loss"
|
||||
dbus set ssconf_basic_ping_"$server_nu"="$ping_time" ms / "$ping_loss"
|
||||
else
|
||||
dbus set ssconf_basic_ping_"$server_mu"="failed"
|
||||
dbus set ssconf_basic_ping_"$server_nu"="failed"
|
||||
fi
|
||||
else
|
||||
if [ "$ssconf_basic_Ping_Method" == "1" ];then
|
||||
if [ "$ssconf_basic_ping_method" == "1" ];then
|
||||
servers=`dbus list ssconf_basic_server | sort -n -t "_" -k 4`
|
||||
for server in $servers
|
||||
do
|
||||
server_mu=`echo $server|cut -d "=" -f 1|cut -d "_" -f 4`
|
||||
server_nu=`echo $server|cut -d "=" -f 1|cut -d "_" -f 4`
|
||||
server_address=`echo $server|cut -d "=" -f 2`
|
||||
ping_text=`ping -4 $server_address -c 10 -w 10 -q`
|
||||
ping_time=`echo $ping_text | awk -F '/' '{print $4}'`
|
||||
ping_loss=`echo $ping_text | awk -F ', ' '{print $3}' | awk '{print $1}'`
|
||||
|
||||
if [ ! -z "$ping_time" ];then
|
||||
dbus set ssconf_basic_ping_"$server_mu"="$ping_time" ms / "$ping_loss"
|
||||
dbus set ssconf_basic_ping_"$server_nu"="$ping_time" ms / "$ping_loss"
|
||||
else
|
||||
dbus set ssconf_basic_ping_"$server_mu"="failed"
|
||||
dbus set ssconf_basic_ping_"$server_nu"="failed"
|
||||
fi
|
||||
done
|
||||
else
|
||||
@ -48,18 +48,18 @@ else
|
||||
for server in $servers
|
||||
do
|
||||
{
|
||||
server_mu=`echo $server|cut -d "=" -f 1|cut -d "_" -f 4`
|
||||
server_nu=`echo $server|cut -d "=" -f 1|cut -d "_" -f 4`
|
||||
server_address=`echo $server|cut -d "=" -f 2`
|
||||
[ "$ssconf_basic_Ping_Method" == "2" ] && ping_text=`ping -4 $server_address -c 10 -w 10 -q`
|
||||
[ "$ssconf_basic_Ping_Method" == "3" ] && ping_text=`ping -4 $server_address -c 20 -w 20 -q`
|
||||
[ "$ssconf_basic_Ping_Method" == "4" ] && ping_text=`ping -4 $server_address -c 50 -w 50 -q`
|
||||
[ "$ssconf_basic_ping_method" == "2" ] && ping_text=`ping -4 $server_address -c 10 -w 10 -q`
|
||||
[ "$ssconf_basic_ping_method" == "3" ] && ping_text=`ping -4 $server_address -c 20 -w 20 -q`
|
||||
[ "$ssconf_basic_ping_method" == "4" ] && ping_text=`ping -4 $server_address -c 50 -w 50 -q`
|
||||
ping_time=`echo $ping_text | awk -F '/' '{print $4}'`
|
||||
ping_loss=`echo $ping_text | awk -F ', ' '{print $3}' | awk '{print $1}'`
|
||||
|
||||
if [ ! -z "$ping_time" ];then
|
||||
dbus set ssconf_basic_ping_"$server_mu"="$ping_time" ms / "$ping_loss"
|
||||
dbus set ssconf_basic_ping_"$server_nu"="$ping_time" ms / "$ping_loss"
|
||||
else
|
||||
dbus set ssconf_basic_ping_"$server_mu"="failed"
|
||||
dbus set ssconf_basic_ping_"$server_nu"="failed"
|
||||
fi
|
||||
}&
|
||||
done
|
||||
|
@ -1,36 +0,0 @@
|
||||
#!/bin/sh
|
||||
alias echo_date='echo $(date +%Y年%m月%d日\ %X):'
|
||||
|
||||
echo_date ----------------------- shadowsocks 启动前触发脚本 -----------------------
|
||||
lb_enable=`dbus get ss_lb_enable`
|
||||
if [ "$lb_enable" == "1" ];then
|
||||
if [ `dbus get ss_basic_server | grep -o "127.0.0.1"` ] && [ `dbus get ss_basic_port` == `dbus get ss_lb_port` ];then
|
||||
echo_date ss启动前触发:触发启动负载均衡功能!
|
||||
#start haproxy
|
||||
sh /jffs/softcenter/scripts/ss_lb_config.sh
|
||||
#start kcptun
|
||||
lb_node=`dbus list ssconf_basic_use_lb_|sed 's/ssconf_basic_use_lb_//g' |cut -d "=" -f 1 | sort -n`
|
||||
for node in $lb_node
|
||||
do
|
||||
name=`dbus get ssconf_basic_name_$node`
|
||||
kcp=`dbus get ssconf_basic_use_kcp_$node`
|
||||
kcp_server=`dbus get ssconf_basic_server_$node`
|
||||
# marked for change in future
|
||||
server_ip=`nslookup "$kcp_server" 119.29.29.29 | sed '1,4d' | awk '{print $3}' | grep -v :|awk 'NR==1{print}'`
|
||||
kcp_port=`dbus get ss_basic_kcp_port`
|
||||
kcp_para=`dbus get ss_basic_kcp_parameter`
|
||||
if [ "$kcp" == "1" ];then
|
||||
export GOGC=40
|
||||
start-stop-daemon -S -q -b -m -p /tmp/var/kcp.pid -x /jffs/softcenter/bin/client_linux_mips -- -l 127.0.0.1:1091 -r $server_ip:$kcp_port $kcp_para
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo_date ss启动前触发:未选择负载均衡节点,不触发负载均衡启动!
|
||||
fi
|
||||
else
|
||||
if [ `dbus get ss_basic_server | grep -o "127.0.0.1"` ] && [ `dbus get ss_basic_port` == `dbus get ss_lb_port` ];then
|
||||
echo_date ss启动前触发【警告】:你选择了负载均衡节点,但是负载均衡开关未启用!!
|
||||
else
|
||||
echo_date ss启动前触发:你选择了普通节点,不触发负载均衡启动!.
|
||||
fi
|
||||
fi
|
@ -3,7 +3,7 @@
|
||||
eval `dbus export ss`
|
||||
source /jffs/softcenter/scripts/base.sh
|
||||
source helper.sh
|
||||
alias echo_date='echo $(date +%Y年%m月%d日\ %X):'
|
||||
alias echo_date='echo 【$(TZ=UTC-8 date -R +%Y年%m月%d日\ %X)】:'
|
||||
|
||||
get_mode_name() {
|
||||
case "$1" in
|
||||
@ -13,6 +13,9 @@ get_mode_name() {
|
||||
2)
|
||||
echo "【大陆白名单模式】"
|
||||
;;
|
||||
3)
|
||||
echo "【游戏模式】"
|
||||
;;
|
||||
5)
|
||||
echo "【全局模式】"
|
||||
;;
|
||||
@ -22,149 +25,173 @@ get_mode_name() {
|
||||
get_dns_name() {
|
||||
case "$1" in
|
||||
1)
|
||||
echo "dns2socks"
|
||||
echo "cdns"
|
||||
;;
|
||||
2)
|
||||
if [ "$ss_basic_use_rss" == "1" ];then
|
||||
echo "chinadns2"
|
||||
;;
|
||||
3)
|
||||
echo "dns2socks"
|
||||
;;
|
||||
4)
|
||||
if [ -n "$ss_basic_rss_obfs" ];then
|
||||
echo "ssr-tunnel"
|
||||
else
|
||||
echo "ss-tunnel"
|
||||
fi
|
||||
;;
|
||||
3)
|
||||
echo "dnscrypt-proxy"
|
||||
;;
|
||||
4)
|
||||
echo "pdnsd"
|
||||
;;
|
||||
5)
|
||||
if [ "$ss_chinadns_foreign_method" == "1" ];then
|
||||
echo "chinadns, 上游dns方案dns2socks"
|
||||
elif [ "$ss_chinadns_foreign_method" == "3" ];then
|
||||
echo "chinadns, 上游dns方案ss-tunnel"
|
||||
elif [ "$ss_chinadns_foreign_method" == "4" ];then
|
||||
echo "chinadns, 上游dns方案自定义"
|
||||
fi
|
||||
echo "chinadns1 + dns2socks上游"
|
||||
;;
|
||||
6)
|
||||
echo "https_dns_proxy"
|
||||
;;
|
||||
7)
|
||||
echo "v2ray dns"
|
||||
;;
|
||||
8)
|
||||
echo "koolgame内置"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
echo_version(){
|
||||
echo ① 程序版本(插件版本:3.3.4):
|
||||
echo_date
|
||||
SOFVERSION=`cat /jffs/softcenter/ss/version`
|
||||
if [ -z "$ss_basic_v2ray_version" ];then
|
||||
ss_basic_v2ray_version_tmp=`/jffs/softcenter/bin/v2ray -version 2>/dev/null | head -n 1 | cut -d " " -f2`
|
||||
if [ -n "$ss_basic_v2ray_version_tmp" ];then
|
||||
ss_basic_v2ray_version="$ss_basic_v2ray_version_tmp"
|
||||
dbus set ss_basic_v2ray_version="$ss_basic_v2ray_version_tmp"
|
||||
else
|
||||
ss_basic_v2ray_version="null"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$ss_basic_v2ray_date" ];then
|
||||
ss_basic_v2ray_date_tmp=`/jffs/softcenter/bin/v2ray -version 2>/dev/null | head -n 1 | cut -d " " -f5`
|
||||
if [ -n "$ss_basic_v2ray_date_tmp" ];then
|
||||
ss_basic_v2ray_date="$ss_basic_v2ray_date_tmp"
|
||||
dbus set ss_basic_v2ray_date="$ss_basic_v2ray_date_tmp"
|
||||
else
|
||||
ss_basic_v2ray_date="null"
|
||||
fi
|
||||
fi
|
||||
echo ① 程序版本(插件版本:$SOFVERSION):
|
||||
echo -----------------------------------------------------------
|
||||
echo "程序 版本 备注"
|
||||
echo "ss-redir 3.0.6 2017年6月9日"
|
||||
echo "ss-tunnel 3.0.6 2017年6月9日"
|
||||
echo "ss-local 3.0.6 2017年6月9日"
|
||||
echo "obfs-local 0.0.3 2017年6月9日"
|
||||
echo "ssr-redir 2.5.6 with mbed TLS 2.4.0"
|
||||
echo "ssr-tunnel 2.5.6 with mbed TLS 2.4.0"
|
||||
echo "ssr-local 2.5.6 with mbed TLS 2.4.0"
|
||||
echo "haproxy 1.7.5 "
|
||||
echo "ss-redir 3.2.1 2018年11月25日编译"
|
||||
echo "ss-tunnel 3.2.1 2018年11月25日编译"
|
||||
echo "ss-local 3.2.1 2018年11月25日编译"
|
||||
echo "obfs-local 0.0.5 2018年11月25日编译"
|
||||
echo "ssrr-redir 3.5.3 2018年11月25日编译"
|
||||
echo "ssrr-tunnel 3.5.3 2018年11月25日编译"
|
||||
echo "ssrr-local 3.5.3 2018年11月25日编译"
|
||||
echo "haproxy 1.8.8 2018年05月03日编译"
|
||||
echo "dns2socks V2.0 "
|
||||
echo "dnscrypt-proxy 1.6.0 "
|
||||
echo "ChinaDNS 1.3.2 "
|
||||
echo "pndsd 1.2.9a-par "
|
||||
echo "cdns 1.0 2017年12月09日编译"
|
||||
echo "chinadns1 1.3.2 2017年12月09日编译"
|
||||
echo "chinadns2 2.0.0 2017年12月09日编译"
|
||||
echo "client_linux_mips 20181114 kcptun"
|
||||
echo "v2ray $ss_basic_v2ray_version $ss_basic_v2ray_date"
|
||||
echo -----------------------------------------------------------
|
||||
}
|
||||
|
||||
check_status(){
|
||||
#echo ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
|
||||
#echo
|
||||
SS_REDIR=`pidof ss-redir`
|
||||
SS_TUNNEL=`pidof ss-tunnel`
|
||||
SS_LOCAL=`ps|grep ss-local|grep 23456|awk '{print $1}'`
|
||||
SSR_REDIR=`pidof rss-redir`
|
||||
SSR_LOCAL=`ps|grep rss-local|grep 23456|awk '{print $1}'`
|
||||
SSR_TUNNEL=`pidof rss-tunnel`
|
||||
KOOLGAME=`pidof koolgame`
|
||||
DNS2SOCKS=`pidof dns2socks`
|
||||
DNS_CRYPT=`pidof dnscrypt-proxy`
|
||||
PDNSD=`pidof pdnsd`
|
||||
CDNS=`pidof cdns`
|
||||
CHINADNS1=`pidof chinadns1`
|
||||
CHINADNS=`pidof chinadns`
|
||||
KCPTUN=`pidof client_linux_mips`
|
||||
HAPROXY=`pidof haproxy`
|
||||
CHINADNS=`pidof chinadns`
|
||||
V2RAY=`pidof v2ray`
|
||||
HDP=`pidof https_dns_proxy`
|
||||
DMQ=`pidof dnsmasq`
|
||||
game_on=`dbus list ss_acl_mode|cut -d "=" -f 2 | grep 3`
|
||||
|
||||
if [ "$ss_basic_use_rss" == "1" ];then
|
||||
if [ "$ss_basic_type" == "0" ];then
|
||||
echo_version
|
||||
echo
|
||||
echo ② 检测当前相关进程工作状态:(你正在使用SSR-libev,选择的模式是$(get_mode_name $ss_basic_mode),国外DNS解析方案是:$(get_dns_name $ss_dns_foreign))
|
||||
echo -----------------------------------------------------------
|
||||
echo "程序 状态 PID"
|
||||
[ -n "$SSR_REDIR" ] && echo "ssr-redir 工作中 pid:$SSR_REDIR" || echo "ssr-redir 未运行"
|
||||
else
|
||||
echo_version
|
||||
echo
|
||||
echo ② 检测当前相关进程工作状态:(你正在使用SS-libev,选择的模式是$(get_mode_name $ss_basic_mode),国外DNS解析方案是:$(get_dns_name $ss_dns_foreign))
|
||||
echo ② 检测当前相关进程工作状态:(你正在使用SS-libev,选择的模式是$(get_mode_name $ss_basic_mode),国外DNS解析方案是:$(get_dns_name $ss_foreign_dns))
|
||||
echo -----------------------------------------------------------
|
||||
echo "程序 状态 PID"
|
||||
[ -n "$SS_REDIR" ] && echo "ss-redir 工作中 pid:$SS_REDIR" || echo "ss-redir 未运行"
|
||||
elif [ "$ss_basic_type" == "1" ];then
|
||||
echo_version
|
||||
echo
|
||||
echo ② 检测当前相关进程工作状态:(你正在使用SSR-libev,选择的模式是$(get_mode_name $ss_basic_mode),国外DNS解析方案是:$(get_dns_name $ss_foreign_dns))
|
||||
echo -----------------------------------------------------------
|
||||
echo "程序 状态 PID"
|
||||
[ -n "$SSR_REDIR" ] && echo "ssr-redir 工作中 pid:$SSR_REDIR" || echo "ssr-redir 未运行"
|
||||
elif [ "$ss_basic_type" == "2" ];then
|
||||
echo_version
|
||||
echo
|
||||
echo ② 检测当前相关进程工作状态:(你正在使用koolgame,选择的模式是$(get_mode_name $ss_basic_mode),国外DNS解析方案是:$(get_dns_name 8))
|
||||
echo -----------------------------------------------------------
|
||||
echo "程序 状态 PID"
|
||||
[ -n "$KOOLGAME" ] && echo "koolgame 工作中 pid:$KOOLGAME" || echo "koolgame 未运行"
|
||||
elif [ "$ss_basic_type" == "3" ];then
|
||||
echo_version
|
||||
echo
|
||||
echo ② 检测当前相关进程工作状态:(你正在使用V2Ray,选择的模式是$(get_mode_name $ss_basic_mode),国外DNS解析方案是:$(get_dns_name $ss_foreign_dns))
|
||||
echo -----------------------------------------------------------
|
||||
echo "程序 状态 PID"
|
||||
[ -n "$V2RAY" ] && echo "v2ray 工作中 pid:$V2RAY" || echo "v2ray 未运行"
|
||||
fi
|
||||
if [ "$ss_basic_server" == "127.0.0.1" ];then
|
||||
[ -n "$HAPROXY" ] && echo "haproxy 工作中 pid:$HAPROXY" || echo "haproxy 未运行"
|
||||
fi
|
||||
if [ "$ss_dns_foreign" == "1" ];then
|
||||
if [ "$ss_basic_use_rss" == "1" ];then
|
||||
[ -n "$SSR_LOCAL" ] && echo "ssr-local 工作中 pid:$SSR_LOCAL" || echo "ssr-local 未运行"
|
||||
[ -n "$DNS2SOCKS" ] && echo "dns2socks 工作中 pid:$DNS2SOCKS" || echo "dns2socks 未运行"
|
||||
else
|
||||
[ -n "$SS_LOCAL" ] && echo "ss-local 工作中 pid:$SS_LOCAL" || echo "ss-local 未运行"
|
||||
[ -n "$DNS2SOCKS" ] && echo "dns2socks 工作中 pid:$DNS2SOCKS" || echo "dns2socks 未运行"
|
||||
fi
|
||||
elif [ "$ss_dns_foreign" == "2" ];then
|
||||
if [ "$ss_basic_use_rss" == "1" ];then
|
||||
[ -n "$SSR_TUNNEL" ] && echo "ssr-tunnel 工作中 pid:$SSR_TUNNEL" || echo "ssr-tunnel 未运行"
|
||||
else
|
||||
[ -n "$SS_TUNNEL" ] && echo "ss-tunnel 工作中 pid:$SS_TUNNEL" || echo "ss-tunnel 未运行"
|
||||
fi
|
||||
elif [ "$ss_dns_foreign" == "3" ];then
|
||||
[ -n "$DNS_CRYPT" ] && echo "dnscrypt-proxy 工作中 pid:$DNS_CRYPT" || echo "dnscrypt-proxy 未运行"
|
||||
elif [ "$ss_dns_foreign" == "4" ];then
|
||||
if [ "$ss_pdnsd_method" == "1" ];then
|
||||
if [ "$ss_pdnsd_udp_server" == "1" ];then
|
||||
if [ "$ss_basic_use_rss" == "1" ];then
|
||||
[ -n "$SSR_LOCAL" ] && echo "ssr-local 工作中 pid:$SSR_LOCAL" || echo "ssr-local 未运行"
|
||||
[ -n "$DNS2SOCKS" ] && echo "dns2socks 工作中 pid:$DNS2SOCKS" || echo "dns2socks 未运行"
|
||||
else
|
||||
[ -n "$SS_LOCAL" ] && echo "ss-local 工作中 pid:$SS_LOCAL" || echo "ss-local 未运行"
|
||||
[ -n "$DNS2SOCKS" ] && echo "dns2socks 工作中 pid:$DNS2SOCKS" || echo "dns2socks 未运行"
|
||||
fi
|
||||
elif [ "$ss_pdnsd_udp_server" == "3" ];then
|
||||
if [ "$ss_basic_use_rss" == "1" ];then
|
||||
[ -n "$SSR_TUNNEL" ] && echo "ssr-tunnel 工作中 pid:$SSR_TUNNEL" || echo "ssr-tunnel 未运行"
|
||||
else
|
||||
[ -n "$SS_TUNNEL" ] && echo "ss-tunnel 工作中 pid:$SS_TUNNEL" || echo "ss-tunnel 未运行"
|
||||
fi
|
||||
elif [ "$ss_pdnsd_udp_server" == "2" ];then
|
||||
[ -n "$DNS_CRYPT" ] && echo "dnscrypt-proxy 工作中 pid:$DNS_CRYPT" || echo "dnscrypt-proxy 未运行"
|
||||
fi
|
||||
fi
|
||||
[ -n "$PDNSD" ] && echo "pdnsd 工作中 pid:$PDNSD" || echo "pdnsd 未运行"
|
||||
|
||||
elif [ "$ss_dns_foreign" == "5" ];then
|
||||
if [ "$ss_chinadns_foreign_method" == "1" ];then
|
||||
if [ "$ss_basic_use_rss" == "1" ];then
|
||||
if [ -z "$ss_basic_koolgame_udp" ];then
|
||||
if [ "$ss_basic_use_kcp" == "1" ];then
|
||||
[ -n "$KCPTUN" ] && echo "kcptun 工作中 pid:$KCPTUN" || echo "kcptun 未运行"
|
||||
fi
|
||||
|
||||
if [ "$ss_basic_server" == "127.0.0.1" ];then
|
||||
[ -n "$HAPROXY" ] && echo "haproxy 工作中 pid:$HAPROXY" || echo "haproxy 未运行"
|
||||
fi
|
||||
|
||||
if [ "$ss_foreign_dns" == "1" ];then
|
||||
[ -n "$CDNS" ] && echo "cdns 工作中 pid:$CDNS" || echo "cdns 未运行"
|
||||
elif [ "$ss_foreign_dns" == "2" ];then
|
||||
[ -n "$CHINADNS" ] && echo "chinadns 工作中 pid:$CHINADNS" || echo "chinadns 未运行"
|
||||
elif [ "$ss_foreign_dns" == "3" ];then
|
||||
if [ -n "$ss_basic_rss_obfs" ];then
|
||||
[ -n "$SSR_LOCAL" ] && echo "ssr-local 工作中 pid:$SSR_LOCAL" || echo "ssr-local 未运行"
|
||||
[ -n "$DNS2SOCKS" ] && echo "dns2socks 工作中 pid:$DNS2SOCKS" || echo "dns2socks 未运行"
|
||||
else
|
||||
[ -n "$SS_LOCAL" ] && echo "ss-local 工作中 pid:$SS_LOCAL" || echo "ss-local 未运行"
|
||||
if [ "$ss_basic_type" != "3" ];then
|
||||
[ -n "$SS_LOCAL" ] && echo "ss-local 工作中 pid:$SS_LOCAL" || echo "ss-local 未运行"
|
||||
fi
|
||||
[ -n "$DNS2SOCKS" ] && echo "dns2socks 工作中 pid:$DNS2SOCKS" || echo "dns2socks 未运行"
|
||||
fi
|
||||
elif [ "$ss_chinadns_foreign_method" == "2" ];then
|
||||
[ -n "$DNS_CRYPT" ] && echo "dnscrypt-proxy 工作中 pid:$DNS_CRYPT" || echo "dnscrypt-proxy 未运行"
|
||||
elif [ "$ss_chinadns_foreign_method" == "3" ];then
|
||||
if [ "$ss_basic_use_rss" == "1" ];then
|
||||
elif [ "$ss_foreign_dns" == "4" ];then
|
||||
if [ -n "$ss_basic_rss_obfs" ];then
|
||||
[ -n "$SSR_TUNNEL" ] && echo "ssr-tunnel 工作中 pid:$SSR_TUNNEL" || echo "ssr-tunnel 未运行"
|
||||
else
|
||||
[ -n "$SS_TUNNEL" ] && echo "ss-tunnel 工作中 pid:$SS_TUNNEL" || echo "ss-tunnel 未运行"
|
||||
fi
|
||||
elif [ "$ss_foreign_dns" == "5" ];then
|
||||
if [ "$ss_basic_type" != "3" ];then
|
||||
[ -n "$SSR_LOCAL" ] && echo "ssr-local 工作中 pid:$SSR_LOCAL" || echo "ssr-local 未运行"
|
||||
fi
|
||||
[ -n "$DNS2SOCKS" ] && echo "dns2socks 工作中 pid:$DNS2SOCKS" || echo "dns2socks 未运行"
|
||||
[ -n "$CHINADNS1" ] && echo "chinadns1 工作中 pid:$CHINADNS1" || echo "chinadns1 未运行"
|
||||
elif [ "$ss_foreign_dns" == "6" ];then
|
||||
[ -n "$HDP" ] && echo "https_dns_proxy 工作中 pid:$HDP" || echo "https_dns_proxy 未运行"
|
||||
fi
|
||||
[ -n "$CHINADNS" ] && echo "chinadns 工作中 pid:$CHINADNS" || echo "chinadns 未运行"
|
||||
fi
|
||||
[ -n "$DMQ" ] && echo "dnsmasq 工作中 pid:$DMQ" || echo "dnsmasq 未运行"
|
||||
|
||||
echo -----------------------------------------------------------
|
||||
echo
|
||||
echo
|
||||
echo ③ 检测iptbales工作状态:
|
||||
#echo ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
|
||||
echo ----------------------------------------------------- nat表 PREROUTING 链 --------------------------------------------------------
|
||||
iptables -nvL PREROUTING -t nat
|
||||
echo
|
||||
@ -174,12 +201,18 @@ check_status(){
|
||||
echo ----------------------------------------------------- nat表 SHADOWSOCKS 链 --------------------------------------------------------
|
||||
iptables -nvL SHADOWSOCKS -t nat
|
||||
echo
|
||||
echo ----------------------------------------------------- nat表 SHADOWSOCKS_EXT 链 --------------------------------------------------------
|
||||
iptables -nvL SHADOWSOCKS_EXT -t nat
|
||||
echo
|
||||
echo ----------------------------------------------------- nat表 SHADOWSOCKS_GFW 链 ----------------------------------------------------
|
||||
iptables -nvL SHADOWSOCKS_GFW -t nat
|
||||
echo
|
||||
echo ----------------------------------------------------- nat表 SHADOWSOCKS_CHN 链 -----------------------------------------------------
|
||||
iptables -nvL SHADOWSOCKS_CHN -t nat
|
||||
echo
|
||||
echo ----------------------------------------------------- nat表 SHADOWSOCKS_GAM 链 -----------------------------------------------------
|
||||
iptables -nvL SHADOWSOCKS_GAM -t nat
|
||||
echo
|
||||
echo ----------------------------------------------------- nat表 SHADOWSOCKS_GLO 链 -----------------------------------------------------
|
||||
iptables -nvL SHADOWSOCKS_GLO -t nat
|
||||
echo
|
||||
@ -187,11 +220,23 @@ check_status(){
|
||||
iptables -nvL SHADOWSOCKS_HOM -t nat
|
||||
echo -----------------------------------------------------------------------------------------------------------------------------------
|
||||
echo
|
||||
[ -n "$game_on" ] || [ "$ss_basic_mode" == "3" ] && echo ------------------------------------------------------ mangle表 PREROUTING 链 -------------------------------------------------------
|
||||
[ -n "$game_on" ] || [ "$ss_basic_mode" == "3" ] && iptables -nvL PREROUTING -t mangle
|
||||
[ -n "$game_on" ] || [ "$ss_basic_mode" == "3" ] && echo
|
||||
[ -n "$game_on" ] || [ "$ss_basic_mode" == "3" ] && echo ------------------------------------------------------ mangle表 SHADOWSOCKS 链 -------------------------------------------------------
|
||||
[ -n "$game_on" ] || [ "$ss_basic_mode" == "3" ] && iptables -nvL SHADOWSOCKS -t mangle
|
||||
[ -n "$game_on" ] || [ "$ss_basic_mode" == "3" ] && echo
|
||||
[ -n "$game_on" ] || [ "$ss_basic_mode" == "3" ] && echo ------------------------------------------------------ mangle表 SHADOWSOCKS_GAM 链 -------------------------------------------------------
|
||||
[ -n "$game_on" ] || [ "$ss_basic_mode" == "3" ] && iptables -nvL SHADOWSOCKS_GAM -t mangle
|
||||
echo -----------------------------------------------------------------------------------------------------------------------------------
|
||||
echo
|
||||
}
|
||||
|
||||
if [ "$ss_basic_enable" == "1" ];then
|
||||
check_status > /tmp/ss_proc_status.log 2>&1
|
||||
echo "" > /tmp/ss_proc_status.log 2>&1
|
||||
check_status >> /tmp/ss_proc_status.log 2>&1
|
||||
else
|
||||
echo 插件尚未启用!
|
||||
echo 插件尚未启用!> /tmp/ss_proc_status.log 2>&1
|
||||
fi
|
||||
echo XU6J03M6 >> /tmp/ss_proc_status.log
|
||||
|
||||
|
129
shadowsocks/shadowsocks/scripts/ss_reboot_job.sh
Executable file
@ -0,0 +1,129 @@
|
||||
#!/bin/sh
|
||||
|
||||
eval `dbus export ss`
|
||||
source /jffs/softcenter/scripts/base.sh
|
||||
alias echo_date='echo 【$(TZ=UTC-8 date -R +%Y年%m月%d日\ %X)】:'
|
||||
|
||||
# -------------------
|
||||
|
||||
remove_ss_reboot_job(){
|
||||
if [ -n "`cru l|grep ss_reboot`" ]; then
|
||||
echo_date 【科学上网】:删除插件自动重启定时任务...
|
||||
sed -i '/ss_reboot/d' /var/spool/cron/crontabs/* >/dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
set_ss_reboot_job(){
|
||||
if [[ "${ss_reboot_check}" == "0" ]]; then
|
||||
remove_ss_reboot_job
|
||||
elif [[ "${ss_reboot_check}" == "1" ]]; then
|
||||
echo_date 【科学上网】:设置每天${ss_basic_time_hour}时${ss_basic_time_min}分重启插件...
|
||||
cru a ss_reboot ${ss_basic_time_min} ${ss_basic_time_hour}" * * * /bin/sh /jffs/softcenter/ss/ssconfig.sh restart"
|
||||
elif [[ "${ss_reboot_check}" == "2" ]]; then
|
||||
echo_date 【科学上网】:设置每周${ss_basic_week}的${ss_basic_time_hour}时${ss_basic_time_min}分重启插件...
|
||||
cru a ss_reboot ${ss_basic_time_min} ${ss_basic_time_hour}" * * "${ss_basic_week}" /bin/sh /jffs/softcenter/ss/ssconfig.sh restart"
|
||||
elif [[ "${ss_reboot_check}" == "3" ]]; then
|
||||
echo_date 【科学上网】:设置每月${ss_basic_day}日${ss_basic_time_hour}时${ss_basic_time_min}分重启插件...
|
||||
cru a ss_reboot ${ss_basic_time_min} ${ss_basic_time_hour} ${ss_basic_day}" * * /bin/sh /jffs/softcenter/ss/ssconfig.sh restart"
|
||||
elif [[ "${ss_reboot_check}" == "4" ]]; then
|
||||
if [[ "${ss_basic_inter_pre}" == "1" ]]; then
|
||||
echo_date 【科学上网】:设置每隔${ss_basic_inter_min}分钟重启插件...
|
||||
cru a ss_reboot "*/"${ss_basic_inter_min}" * * * * /bin/sh /jffs/softcenter/ss/ssconfig.sh restart"
|
||||
elif [[ "${ss_basic_inter_pre}" == "2" ]]; then
|
||||
echo_date 【科学上网】:设置每隔${ss_basic_inter_hour}小时重启插件...
|
||||
cru a ss_reboot "0 */"${ss_basic_inter_hour}" * * * /bin/sh /jffs/softcenter/ss/ssconfig.sh restart"
|
||||
elif [[ "${ss_basic_inter_pre}" == "3" ]]; then
|
||||
echo_date 【科学上网】:设置每隔${ss_basic_inter_day}天${ss_basic_inter_hour}小时${ss_basic_time_min}分钟重启插件...
|
||||
cru a ss_reboot ${ss_basic_time_min} ${ss_basic_time_hour}" */"${ss_basic_inter_day} " * * /bin/sh /jffs/softcenter/ss/ssconfig.sh restart"
|
||||
fi
|
||||
elif [[ "${ss_reboot_check}" == "5" ]]; then
|
||||
check_custom_time=`dbus get ss_basic_custom | base64_decode`
|
||||
echo_date 【科学上网】:设置每天${check_custom_time}时的${ss_basic_time_min}分重启插件...
|
||||
cru a ss_reboot ${ss_basic_time_min} ${check_custom_time}" * * * /bin/sh /jffs/softcenter/ss/ssconfig.sh restart"
|
||||
fi
|
||||
}
|
||||
|
||||
# -------------------
|
||||
|
||||
remove_ss_trigger_job(){
|
||||
if [ -n "`cru l|grep ss_tri_check`" ]; then
|
||||
echo_date 删除插件触发重启定时任务...
|
||||
sed -i '/ss_tri_check/d' /var/spool/cron/crontabs/* >/dev/null 2>&1
|
||||
else
|
||||
echo_date 插件触发重启定时任务已经删除...
|
||||
fi
|
||||
}
|
||||
|
||||
set_ss_trigger_job(){
|
||||
if [ "$ss_basic_tri_reboot_time" == "0" ];then
|
||||
remove_ss_trigger_job
|
||||
else
|
||||
if [ "$ss_basic_tri_reboot_policy" == "1" ];then
|
||||
echo_date 设置每隔$ss_basic_tri_reboot_time分钟检查服务器IP地址,如果IP发生变化,则重启科学上网插件...
|
||||
else
|
||||
echo_date 设置每隔$ss_basic_tri_reboot_time分钟检查服务器IP地址,如果IP发生变化,则重启dnsmasq...
|
||||
fi
|
||||
echo_date 科学上网插件触发重启功能的日志将显示再系统日志内。
|
||||
cru d ss_tri_check >/dev/null 2>&1
|
||||
cru a ss_tri_check "*/$ss_basic_tri_reboot_time * * * * /jffs/softcenter/scripts/ss_reboot_job.sh check_ip"
|
||||
fi
|
||||
}
|
||||
|
||||
check_ip(){
|
||||
if [ -f "/tmp/ss_host.conf" ];then
|
||||
HOST=`cat /tmp/ss_host.conf | cut -d "/" -f2`
|
||||
OLD_IP=`cat /tmp/ss_host.conf | cut -d "/" -f3`
|
||||
if [ -n "$HOST" ] && [ -n "$OLD_IP" ];then
|
||||
NEW_IP=`nslookup "$HOST" 114.114.114.114 | sed '1,4d' | awk '{print $3}' | grep -v :|awk 'NR==1{print}'`
|
||||
if [ "$?" == "0" ];then
|
||||
NEW_IP=`echo $NEW_IP|grep -E "([0-9]{1,3}[\.]){3}[0-9]{1,3}|:"`
|
||||
else
|
||||
logger 【科学上网插件触发重启功能】:SS服务器域名解析失败!
|
||||
fi
|
||||
|
||||
if [ "$OLD_IP"x == "$NEW_IP"x ];then
|
||||
logger 【科学上网插件触发重启功能】:服务器ip地址未发生变化,不进行任何操作!
|
||||
else
|
||||
logger 【科学上网插件触发重启功能】:服务器ip地址发生变化,旧ip:【"$OLD_IP"】,新ip:【"$NEW_IP"】
|
||||
#写入新的解析文件
|
||||
echo "address=/$HOST/$NEW_IP" > /tmp/ss_host.conf
|
||||
if [ "$ss_basic_tri_reboot_policy" == "1" ];then
|
||||
logger 【科学上网插件触发重启功能】:重启整个插件,以应用新的ip
|
||||
sh /jffs/softcenter/ss/ssconfig.sh restart
|
||||
else
|
||||
logger 【科学上网插件触发重启功能】:重启dnsmasq,以应用新的ip
|
||||
[ -L "/jffs/configs/dnsmasq.d/ss_host.conf" ] && rm -rf /jffs/configs/dnsmasq.d/ss_host.conf
|
||||
service restart_dnsmasq >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
else
|
||||
logger 【科学上网插件触发重启功能】:未找到你当前节点的服务器地址,可能插件提交时未正确解析!
|
||||
logger 【科学上网插件触发重启功能】:请尝试直接使用ip地址作为服务器地址!
|
||||
fi
|
||||
else
|
||||
if [ -n "$ss_basic_server_ip" ];then
|
||||
IFIP=`echo $ss_basic_server_ip|grep -E "([0-9]{1,3}[\.]){3}[0-9]{1,3}|:"`
|
||||
logger 【科学上网插件触发重启功能】:当前节点的服务器地址已经是IP格式!不进行任何操作!
|
||||
else
|
||||
logger 【科学上网插件触发重启功能】:未找到你当前节点的服务器地址,可能已是IP格式!不进行任何操作!
|
||||
fi
|
||||
fi
|
||||
}
|
||||
# -------------------
|
||||
|
||||
case "$1" in
|
||||
check_ip)
|
||||
# 开始检查IP
|
||||
check_ip
|
||||
;;
|
||||
*)
|
||||
# web提交操作,设定【插件定时重启设定】和【插件触发重启设定】
|
||||
if [ "$ss_basic_reboot_action" == "1" ];then
|
||||
set_ss_reboot_job
|
||||
dbus remove ss_basic_reboot_action
|
||||
elif [ "$ss_basic_reboot_action" == "2" ];then
|
||||
set_ss_trigger_job
|
||||
dbus remove ss_basic_reboot_action
|
||||
fi
|
||||
;;
|
||||
esac
|
@ -1,145 +1,185 @@
|
||||
#!/bin/sh
|
||||
|
||||
eval `dbus export ss`
|
||||
source /jffs/softcenter/scripts/base.sh
|
||||
LOGTIME=$(date "+%Y-%m-%d %H:%M:%S")
|
||||
alias echo_date='echo $(date +%Y年%m月%d日\ %X):'
|
||||
alias echo_date='echo 【$(TZ=UTC-8 date -R +%Y年%m月%d日\ %X)】:'
|
||||
|
||||
# version dectet
|
||||
version_gfwlist1=$(cat /jffs/softcenter/ss/rules/version | sed -n 1p | sed 's/ /\n/g'| sed -n 1p)
|
||||
version_chnroute1=$(cat /jffs/softcenter/ss/rules/version | sed -n 2p | sed 's/ /\n/g'| sed -n 1p)
|
||||
version_cdn1=$(cat /jffs/softcenter/ss/rules/version | sed -n 4p | sed 's/ /\n/g'| sed -n 1p)
|
||||
start_update(){
|
||||
url_main="https://raw.githubusercontent.com/paldier/softcenter/master/rules"
|
||||
url_back=""
|
||||
# version dectet
|
||||
version_gfwlist1=$(cat /jffs/softcenter/ss/rules/version | sed -n 1p | sed 's/ /\n/g'| sed -n 1p)
|
||||
version_chnroute1=$(cat /jffs/softcenter/ss/rules/version | sed -n 2p | sed 's/ /\n/g'| sed -n 1p)
|
||||
version_cdn1=$(cat /jffs/softcenter/ss/rules/version | sed -n 4p | sed 's/ /\n/g'| sed -n 1p)
|
||||
|
||||
echo ====================================================================================================
|
||||
echo_date 开始更新shadowsocks规则,请等待...
|
||||
wget --no-check-certificate --timeout=8 -qO - https://raw.githubusercontent.com/paldier/softcenter/master/maintain_files/version1 > /tmp/version1
|
||||
if [ "$?" == "0" ]; then
|
||||
echo_date 检测到在线版本文件,继续...
|
||||
else
|
||||
echo_date 没有检测到在线版本欸,可能是访问github有问题,去大陆白名单模式试试吧!
|
||||
rm -rf /tmp/version1
|
||||
exit
|
||||
fi
|
||||
echo ==================================================================================================
|
||||
echo_date 开始更新shadowsocks规则,请等待...
|
||||
wget --no-check-certificate --timeout=8 -qO - "$url_main"/version1 > /tmp/ss_version
|
||||
if [ "$?" == "0" ]; then
|
||||
echo_date 检测到在线版本文件,继续...
|
||||
else
|
||||
echo_date 没有检测到在线版本,可能是访问github有问题,去大陆白名单模式试试吧!
|
||||
rm -rf /tmp/ss_version
|
||||
exit
|
||||
fi
|
||||
|
||||
online_content=$(cat /tmp/version1)
|
||||
if [ -z "$online_content" ];then
|
||||
rm -rf /tmp/version1
|
||||
fi
|
||||
online_content=$(cat /tmp/ss_version)
|
||||
if [ -z "$online_content" ];then
|
||||
rm -rf /tmp/ss_version
|
||||
fi
|
||||
|
||||
git_line1=$(cat /tmp/version1 | sed -n 1p)
|
||||
git_line2=$(cat /tmp/version1 | sed -n 2p)
|
||||
git_line4=$(cat /tmp/version1 | sed -n 4p)
|
||||
git_line1=$(cat /tmp/ss_version | sed -n 1p)
|
||||
git_line2=$(cat /tmp/ss_version | sed -n 2p)
|
||||
git_line4=$(cat /tmp/ss_version | sed -n 4p)
|
||||
|
||||
version_gfwlist2=$(echo $git_line1 | sed 's/ /\n/g'| sed -n 1p)
|
||||
version_chnroute2=$(echo $git_line2 | sed 's/ /\n/g'| sed -n 1p)
|
||||
version_cdn2=$(echo $git_line4 | sed 's/ /\n/g'| sed -n 1p)
|
||||
version_gfwlist2=$(echo $git_line1 | sed 's/ /\n/g'| sed -n 1p)
|
||||
version_chnroute2=$(echo $git_line2 | sed 's/ /\n/g'| sed -n 1p)
|
||||
version_cdn2=$(echo $git_line4 | sed 's/ /\n/g'| sed -n 1p)
|
||||
|
||||
md5sum_gfwlist2=$(echo $git_line1 | sed 's/ /\n/g'| tail -n 2 | head -n 1)
|
||||
md5sum_chnroute2=$(echo $git_line2 | sed 's/ /\n/g'| tail -n 2 | head -n 1)
|
||||
md5sum_cdn2=$(echo $git_line4 | sed 's/ /\n/g'| tail -n 2 | head -n 1)
|
||||
md5sum_gfwlist2=$(echo $git_line1 | sed 's/ /\n/g'| tail -n 2 | head -n 1)
|
||||
md5sum_chnroute2=$(echo $git_line2 | sed 's/ /\n/g'| tail -n 2 | head -n 1)
|
||||
md5sum_cdn2=$(echo $git_line4 | sed 's/ /\n/g'| tail -n 2 | head -n 1)
|
||||
|
||||
# update gfwlist
|
||||
if [ "$ss_basic_gfwlist_update" == "1" ];then
|
||||
if [ ! -z "$version_gfwlist2" ];then
|
||||
if [ "$version_gfwlist1" != "$version_gfwlist2" ];then
|
||||
echo_date 检测到新版本gfwlist,开始更新...
|
||||
echo_date 下载gfwlist到临时文件...
|
||||
wget --no-check-certificate --timeout=8 -qO - https://raw.githubusercontent.com/paldier/softcenter/master/maintain_files/gfwlist.conf > /tmp/gfwlist.conf
|
||||
md5sum_gfwlist1=$(md5sum /tmp/gfwlist.conf | sed 's/ /\n/g'| sed -n 1p)
|
||||
if [ "$md5sum_gfwlist1"x = "$md5sum_gfwlist2"x ];then
|
||||
echo_date 下载完成,校验通过,将临时文件覆盖到原始gfwlist文件
|
||||
mv /tmp/gfwlist.conf /jffs/softcenter/ss/rules/gfwlist.conf
|
||||
sed -i "1s/.*/$git_line1/" /jffs/softcenter/ss/rules/version
|
||||
reboot="1"
|
||||
echo_date 你的gfwlist已经更新到最新了哦~
|
||||
# update gfwlist
|
||||
if [ "$ss_basic_gfwlist_update" == "1" ];then
|
||||
echo_date " --------------------------------------------------------------------"
|
||||
if [ ! -z "$version_gfwlist2" ];then
|
||||
if [ "$version_gfwlist1" != "$version_gfwlist2" ];then
|
||||
echo_date 检测到新版本gfwlist,开始更新...
|
||||
echo_date 下载gfwlist到临时文件...
|
||||
wget --no-check-certificate --timeout=8 -qO - "$url_main"/gfwlist.conf > /tmp/gfwlist.conf
|
||||
md5sum_gfwlist1=$(md5sum /tmp/gfwlist.conf | sed 's/ /\n/g'| sed -n 1p)
|
||||
if [ "$md5sum_gfwlist1"x = "$md5sum_gfwlist2"x ];then
|
||||
echo_date 下载完成,校验通过,将临时文件覆盖到原始gfwlist文件
|
||||
mv /tmp/gfwlist.conf /jffs/softcenter/ss/rules/gfwlist.conf
|
||||
sed -i "1s/.*/$git_line1/" /jffs/softcenter/ss/rules/version
|
||||
reboot="1"
|
||||
echo_date 【更新成功】你的gfwlist已经更新到最新了哦~
|
||||
else
|
||||
echo_date 下载完成,但是校验没有通过!
|
||||
fi
|
||||
else
|
||||
echo_date 下载完成,但是校验没有通过!
|
||||
echo_date 检测到gfwlist本地版本号和在线版本号相同,不进行更新!
|
||||
fi
|
||||
else
|
||||
echo_date 检测到gfwlist本地版本号和在线版本号相同,那还更新个毛啊!
|
||||
echo_date gfwlist文件下载失败!
|
||||
fi
|
||||
else
|
||||
echo_date gfwlist文件下载失败!
|
||||
echo_date 然而你并没有勾选gfwlist更新!
|
||||
fi
|
||||
else
|
||||
echo_date 然而你并没有勾选gfwlist更新!
|
||||
fi
|
||||
|
||||
|
||||
# update chnroute
|
||||
if [ "$ss_basic_chnroute_update" == "1" ];then
|
||||
if [ ! -z "$version_chnroute2" ];then
|
||||
if [ "$version_chnroute1" != "$version_chnroute2" ];then
|
||||
echo_date 检测到新版本chnroute,开始更新...
|
||||
echo_date 下载chnroute到临时文件...
|
||||
wget --no-check-certificate --timeout=8 -qO - https://raw.githubusercontent.com/paldier/softcenter/master/maintain_files/chnroute.txt > /tmp/chnroute.txt
|
||||
md5sum_chnroute1=$(md5sum /tmp/chnroute.txt | sed 's/ /\n/g'| sed -n 1p)
|
||||
if [ "$md5sum_chnroute1"x = "$md5sum_chnroute2"x ];then
|
||||
echo_date 下载完成,校验通过,将临时文件覆盖到原始chnroute文件
|
||||
mv /tmp/chnroute.txt /jffs/softcenter/ss/rules/chnroute.txt
|
||||
sed -i "2s/.*/$git_line2/" /jffs/softcenter/ss/rules/version
|
||||
reboot="1"
|
||||
echo_date 你的chnroute已经更新到最新了哦~
|
||||
# update chnroute
|
||||
if [ "$ss_basic_chnroute_update" == "1" ];then
|
||||
echo_date " --------------------------------------------------------------------"
|
||||
if [ ! -z "$version_chnroute2" ];then
|
||||
if [ "$version_chnroute1" != "$version_chnroute2" ];then
|
||||
echo_date 检测到新版本chnroute,开始更新...
|
||||
echo_date 下载chnroute到临时文件...
|
||||
wget --no-check-certificate --timeout=8 -qO - "$url_main"/chnroute.txt > /tmp/chnroute.txt
|
||||
md5sum_chnroute1=$(md5sum /tmp/chnroute.txt | sed 's/ /\n/g'| sed -n 1p)
|
||||
if [ "$md5sum_chnroute1"x = "$md5sum_chnroute2"x ];then
|
||||
echo_date 下载完成,校验通过,将临时文件覆盖到原始chnroute文件
|
||||
mv /tmp/chnroute.txt /jffs/softcenter/ss/rules/chnroute.txt
|
||||
sed -i "2s/.*/$git_line2/" /jffs/softcenter/ss/rules/version
|
||||
reboot="1"
|
||||
echo_date 【更新成功】你的chnroute已经更新到最新了哦~
|
||||
else
|
||||
echo_date md5sum 下载完成,但是校验没有通过!
|
||||
fi
|
||||
else
|
||||
echo_date md5sum 下载完成,但是校验没有通过!
|
||||
echo_date 检测到chnroute本地版本号和在线版本号相同,不进行更新!
|
||||
fi
|
||||
else
|
||||
echo_date 检测到chnroute本地版本号和在线版本号相同,那还更新个毛啊!
|
||||
echo_date chnroute文件下载失败!
|
||||
fi
|
||||
else
|
||||
echo_date file chnroute文件下载失败!
|
||||
echo_date 然而你并没有勾选chnroute更新!
|
||||
fi
|
||||
else
|
||||
echo_date 然而你并没有勾选chnroute更新!
|
||||
fi
|
||||
|
||||
# update cdn file
|
||||
if [ "$ss_basic_cdn_update" == "1" ];then
|
||||
if [ ! -z "$version_cdn2" ];then
|
||||
if [ "$version_cdn1" != "$version_cdn2" ];then
|
||||
echo_date 检测到新版本cdn名单,开始更新...
|
||||
echo_date 下载cdn名单到临时文件...
|
||||
wget --no-check-certificate --timeout=8 -qO - https://raw.githubusercontent.com/paldier/softcenter/master/maintain_files/cdn.txt > /tmp/cdn.txt
|
||||
md5sum_cdn1=$(md5sum /tmp/cdn.txt | sed 's/ /\n/g'| sed -n 1p)
|
||||
if [ "$md5sum_cdn1"x = "$md5sum_cdn2"x ];then
|
||||
echo_date 下载完成,校验通过,将临时文件覆盖到原始cdn名单文件
|
||||
mv /tmp/cdn.txt /jffs/softcenter/ss/rules/cdn.txt
|
||||
sed -i "4s/.*/$git_line4/" /jffs/softcenter/ss/rules/version
|
||||
reboot="1"
|
||||
echo_date 你的cdn名单已经更新到最新了哦~
|
||||
# update cdn file
|
||||
if [ "$ss_basic_cdn_update" == "1" ];then
|
||||
echo_date " --------------------------------------------------------------------"
|
||||
if [ ! -z "$version_cdn2" ];then
|
||||
if [ "$version_cdn1" != "$version_cdn2" ];then
|
||||
echo_date 检测到新版本cdn名单,开始更新...
|
||||
echo_date 下载cdn名单到临时文件...
|
||||
wget --no-check-certificate --timeout=8 -qO - "$url_main"/cdn.txt > /tmp/cdn.txt
|
||||
md5sum_cdn1=$(md5sum /tmp/cdn.txt | sed 's/ /\n/g'| sed -n 1p)
|
||||
if [ "$md5sum_cdn1"x = "$md5sum_cdn2"x ];then
|
||||
echo_date 下载完成,校验通过,将临时文件覆盖到原始cdn名单文件
|
||||
mv /tmp/cdn.txt /jffs/softcenter/ss/rules/cdn.txt
|
||||
sed -i "4s/.*/$git_line4/" /jffs/softcenter/ss/rules/version
|
||||
reboot="1"
|
||||
echo_date 【更新成功】你的cdn名单已经更新到最新了哦~
|
||||
else
|
||||
echo_date 下载完成,但是校验没有通过!
|
||||
fi
|
||||
else
|
||||
echo_date 下载完成,但是校验没有通过!
|
||||
echo_date 检测到cdn名单本地版本号和在线版本号相同,不进行更新!
|
||||
fi
|
||||
else
|
||||
echo_date 检测到cdn名单本地版本号和在线版本号相同,那还更新个毛啊!
|
||||
echo_date cdn名单文件下载失败!
|
||||
fi
|
||||
else
|
||||
echo_date file cdn名单文件下载失败!
|
||||
echo_date 然而你并没有勾选cdn名单更新!
|
||||
fi
|
||||
else
|
||||
echo_date 然而你并没有勾选cdn名单更新!
|
||||
fi
|
||||
echo_date " --------------------------------------------------------------------"
|
||||
rm -rf /tmp/gfwlist.conf1
|
||||
rm -rf /tmp/chnroute.txt1
|
||||
rm -rf /tmp/cdn.txt1
|
||||
rm -rf /tmp/ss_version
|
||||
|
||||
echo_date Shadowsocks更新进程运行完毕!
|
||||
# write number
|
||||
nvram set update_ipset="$(cat /jffs/softcenter/ss/rules/version | sed -n 1p | sed 's/#/\n/g'| sed -n 1p)"
|
||||
nvram set update_chnroute="$(cat /jffs/softcenter/ss/rules/version | sed -n 2p | sed 's/#/\n/g'| sed -n 1p)"
|
||||
nvram set update_cdn="$(cat /jffs/softcenter/ss/rules/version | sed -n 4p | sed 's/#/\n/g'| sed -n 1p)"
|
||||
|
||||
nvram set ipset_numbers=$(cat /jffs/softcenter/ss/rules/gfwlist.conf | grep -c ipset)
|
||||
nvram set chnroute_numbers=$(cat /jffs/softcenter/ss/rules/chnroute.txt | grep -c .)
|
||||
nvram set cdn_numbers=$(cat /jffs/softcenter/ss/rules/cdn.txt | grep -c .)
|
||||
#======================================================================
|
||||
if [ "$reboot" == "1" ];then
|
||||
echo_date 自动重启shadowsocks,以应用新的规则文件!请稍后!
|
||||
dbus set ss_basic_action=1
|
||||
sh /jffs/softcenter/ss/ssconfig.sh restart
|
||||
fi
|
||||
echo ==================================================================================================
|
||||
}
|
||||
|
||||
change_cru(){
|
||||
echo ==================================================================================================
|
||||
sed -i '/ssupdate/d' /var/spool/cron/crontabs/* >/dev/null 2>&1
|
||||
if [ "1" == "$ss_basic_rule_update" ]; then
|
||||
echo_date 应用ss规则定时更新任务:每天"$ss_basic_rule_update_time"自动检测更新规则.
|
||||
cru a ssupdate "0 $ss_basic_rule_update_time * * * /bin/sh /jffs/softcenter/scripts/ss_rule_update.sh"
|
||||
else
|
||||
echo_date ss规则定时更新任务未启用!
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
rm -rf /tmp/gfwlist.conf1
|
||||
rm -rf /tmp/chnroute.txt1
|
||||
rm -rf /tmp/cdn.txt1
|
||||
rm -rf /tmp/version1
|
||||
|
||||
echo_date Shadowsocks更新进程运行完毕!
|
||||
# write number
|
||||
nvram set update_ipset="$(cat /jffs/softcenter/ss/rules/version | sed -n 1p | sed 's/#/\n/g'| sed -n 1p)"
|
||||
nvram set update_chnroute="$(cat /jffs/softcenter/ss/rules/version | sed -n 2p | sed 's/#/\n/g'| sed -n 1p)"
|
||||
nvram set update_cdn="$(cat /jffs/softcenter/ss/rules/version | sed -n 4p | sed 's/#/\n/g'| sed -n 1p)"
|
||||
nvram set ipset_numbers=$(cat /jffs/softcenter/ss/rules/gfwlist.conf | grep -c ipset)
|
||||
nvram set chnroute_numbers=$(cat /jffs/softcenter/ss/rules/chnroute.txt | grep -c .)
|
||||
nvram set cdn_numbers=$(cat /jffs/softcenter/ss/rules/cdn.txt | grep -c .)
|
||||
|
||||
# reboot ss
|
||||
if [ "$reboot" == "1" ];then
|
||||
echo_date 自动重启shadowsocks,以应用新的规则文件!请稍后!
|
||||
dbus set ss_basic_action=1
|
||||
sh /jffs/softcenter/ss/ssconfig.sh restart
|
||||
fi
|
||||
echo ====================================================================================================
|
||||
exit
|
||||
|
||||
case $ss_basic_update_action in
|
||||
1)
|
||||
#svae only
|
||||
change_cru
|
||||
# incase next time auto update failed
|
||||
dbus remove ss_basic_update_action
|
||||
;;
|
||||
2)
|
||||
#save and apply form we action
|
||||
ss_basic_gfwlist_update=1
|
||||
ss_basic_chnroute_update=1
|
||||
ss_basic_cdn_update=1
|
||||
change_cru
|
||||
start_update
|
||||
dbus remove ss_basic_update_action
|
||||
;;
|
||||
*)
|
||||
#this is for autoupdate
|
||||
change_cru
|
||||
start_update
|
||||
dbus remove ss_basic_update_action
|
||||
;;
|
||||
esac
|
||||
|
@ -1,3 +1,72 @@
|
||||
#!/bin/sh
|
||||
|
||||
/jffs/softcenter/ss/socks5/socks5config.sh restart
|
||||
eval `dbus export ss`
|
||||
source /jffs/softcenter/scripts/base.sh
|
||||
alias echo_date='echo 【$(TZ=UTC-8 date -R +%Y年%m月%d日\ %X)】:'
|
||||
|
||||
kill_socks5(){
|
||||
PID=`ps | grep ss-local | grep -v "grep" | grep -v "23456"|awk '{print $1}'`
|
||||
if [ -n "$PID" ];then
|
||||
echo_date 关闭ss-local...
|
||||
kill -9 "$PID" >/dev/null 2>&1
|
||||
echo_date 完成...
|
||||
fi
|
||||
}
|
||||
|
||||
# Start ss-local
|
||||
start_socks5(){
|
||||
echo_date 开启ss-local...
|
||||
if [ "$ss_local_obfs_host" != "" ];then
|
||||
if [ "$ss_local_obfs" == "http" ];then
|
||||
ARG_OBFS="obfs=http;obfs-host=$ss_local_obfs_host"
|
||||
elif [ "$ss_local_obfs" == "tls" ];then
|
||||
ARG_OBFS="obfs=tls;obfs-host=$ss_local_obfs_host"
|
||||
else
|
||||
ARG_OBFS=""
|
||||
fi
|
||||
else
|
||||
if [ "$ss_local_obfs" == "http" ];then
|
||||
ARG_OBFS="obfs=http"
|
||||
elif [ "$ss_local_obfs" == "tls" ];then
|
||||
ARG_OBFS="obfs=tls"
|
||||
else
|
||||
ARG_OBFS=""
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$ss_local_acl" == "0" ];then
|
||||
ARG_ACL=""
|
||||
elif [ "$ss_local_acl" == "1" ];then
|
||||
ARG_ACL="--acl /jffs/softcenter/ss/rules/gfwlist.acl"
|
||||
elif [ "$ss_local_acl" == "2" ];then
|
||||
ARG_ACL="--acl /jffs/softcenter/ss/rules/chn.acl"
|
||||
fi
|
||||
|
||||
if [ "$ss_local_obfs" == "0" ];then
|
||||
ss-local -b 0.0.0.0 -s "$ss_local_server" -p "$ss_local_port" -l "$ss_local_proxyport" -k "$ss_local_password" -m "$ss_local_method" -u $ARG_ACL -f /var/run/ss_local.pid
|
||||
else
|
||||
ss-local -b 0.0.0.0 -s "$ss_local_server" -p "$ss_local_port" -l "$ss_local_proxyport" -k "$ss_local_password" -m "$ss_local_method" -u $ARG_ACL --plugin obfs-local --plugin-opts "$ARG_OBFS" -f /var/run/ss_local.pid
|
||||
fi
|
||||
echo_date 完成...
|
||||
}
|
||||
|
||||
case $1 in
|
||||
start)
|
||||
if [ "$ss_local_enable" == "1" ];then
|
||||
logger "[软件中心]: 启动socks5!"
|
||||
[ "$ss_basic_sleep" != "0" ] && sleep $ss_basic_sleep
|
||||
kill_socks5
|
||||
start_socks5 >> /tmp/syslog.log
|
||||
else
|
||||
logger "[软件中心]: socks5未开启,不启动!"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if [ "$ss_local_enable" == "1" ];then
|
||||
kill_socks5
|
||||
start_socks5
|
||||
else
|
||||
kill_socks5
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
@ -1,5 +1,107 @@
|
||||
#!/bin/sh
|
||||
|
||||
eval `dbus export ss`
|
||||
alias echo_date='echo 【$(TZ=UTC-8 date -R +%Y年%m月%d日\ %X)】:'
|
||||
main_url="https://raw.githubusercontent.com/paldier/softcenter/master/shadowsocks"
|
||||
backup_url=""
|
||||
|
||||
sh /jffs/softcenter/ss/ssconfig.sh update
|
||||
install_ss(){
|
||||
echo_date 开始解压压缩包...
|
||||
tar -zxf shadowsocks.tar.gz
|
||||
chmod a+x /tmp/shadowsocks/install.sh
|
||||
echo_date 开始安装更新文件...
|
||||
sh /tmp/shadowsocks/install.sh
|
||||
rm -rf /tmp/shadowsocks*
|
||||
}
|
||||
|
||||
update_ss(){
|
||||
echo_date 更新过程中请不要刷新本页面或者关闭路由等,不然可能导致问题!
|
||||
echo_date 开启SS检查更新:使用主服务器:github
|
||||
echo_date 检测主服务器在线版本号...
|
||||
ss_basic_version_web1=`curl --connect-timeout 5 -s "$main_url"/version | sed -n 1p`
|
||||
if [ -n "$ss_basic_version_web1" ];then
|
||||
echo_date 检测到主服务器在线版本号:$ss_basic_version_web1
|
||||
dbus set ss_basic_version_web=$ss_basic_version_web1
|
||||
if [ "$ss_basic_version_local" != "$ss_basic_version_web1" ];then
|
||||
echo_date 主服务器在线版本号:"$ss_basic_version_web1" 和本地版本号:"$ss_basic_version_local" 不同!
|
||||
cd /tmp
|
||||
md5_web1=`curl -s "$main_url"/version | sed -n 2p`
|
||||
echo_date 开启下载进程,从主服务器上下载更新包...
|
||||
wget --no-check-certificate --timeout=5 "$main_url"/shadowsocks.tar.gz
|
||||
md5sum_gz=`md5sum /tmp/shadowsocks.tar.gz | sed 's/ /\n/g'| sed -n 1p`
|
||||
if [ "$md5sum_gz" != "$md5_web1" ]; then
|
||||
echo_date 更新包md5校验不一致!估计是下载的时候出了什么状况,请等待一会儿再试...
|
||||
rm -rf /tmp/shadowsocks* >/dev/null 2>&1
|
||||
sleep 1
|
||||
echo_date 更换备用备用更新地址,请稍后...
|
||||
sleep 1
|
||||
update_ss2
|
||||
else
|
||||
echo_date 更新包md5校验一致! 开始安装!...
|
||||
install_ss
|
||||
fi
|
||||
else
|
||||
echo_date 主服务器在线版本号:"$ss_basic_version_web1" 和本地版本号:"$ss_basic_version_local" 相同!
|
||||
echo_date 退出插件更新!
|
||||
sleep 1
|
||||
exit
|
||||
fi
|
||||
else
|
||||
echo_date 没有检测到主服务器在线版本号,访问github服务器可能有点问题!
|
||||
sleep 1
|
||||
echo_date 更换备用备用更新地址,请稍后...
|
||||
sleep 1
|
||||
update_ss2
|
||||
fi
|
||||
}
|
||||
|
||||
update_ss2(){
|
||||
echo_date "目前还没有任何备用服务器!请尝试使用离线安装功能!"
|
||||
echo_date "历史版本下载地址:https://github.com/paldier/softcenter/tree/master/shadowsocks/history"
|
||||
echo_date "下载后请将下载包名字改为:shadowsocks.tar.gz,再使用离线安装进行安装"
|
||||
sleep 1
|
||||
exit
|
||||
}
|
||||
|
||||
# update_ss2(){
|
||||
# echo_date 开启SS检查更新:使用备用服务器
|
||||
# echo_date 检测备用服务器在线版本号...
|
||||
# ss_basic_version_web2=`curl --connect-timeout 5 -s "$backup_url"/version | sed -n 1p`
|
||||
# if [ -n "$ss_basic_version_web2" ];then
|
||||
# echo_date 检测到备用服务器在线版本号:$ss_basic_version_web1
|
||||
# dbus set ss_basic_version_web=$ss_basic_version_web2
|
||||
# if [ "$ss_basic_version_local" != "$ss_basic_version_web2" ];then
|
||||
# echo_date 备用服务器在线版本号:"$ss_basic_version_web1" 和本地版本号:"$ss_basic_version_local" 不同!
|
||||
# cd /tmp
|
||||
# md5_web2=`curl -s "$backup_url"/version | sed -n 2p`
|
||||
# echo_date 开启下载进程,从备用服务器上下载更新包...
|
||||
# wget "$backup_url"/shadowsocks.tar.gz
|
||||
# md5sum_gz=`md5sum /tmp/shadowsocks.tar.gz | sed 's/ /\n/g'| sed -n 1p`
|
||||
# if [ "$md5sum_gz" != "$md5_web2" ]; then
|
||||
# echo_date 更新包md5校验不一致!估计是下载的时候除了什么状况,请等待一会儿再试...
|
||||
# rm -rf /tmp/shadowsocks* >/dev/null 2>&1
|
||||
# sleep 1
|
||||
# echo_date 然而只有这一台备用更更新服务器,请尝试离线手动安装...
|
||||
# sleep 1
|
||||
# exit
|
||||
# else
|
||||
# echo_date 更新包md5校验一致! 开始安装!...
|
||||
# install_ss
|
||||
# fi
|
||||
# else
|
||||
# echo_date 备用服务器在线版本号:"$ss_basic_version_web1" 和本地版本号:"$ss_basic_version_local" 相同!
|
||||
# sleep 1
|
||||
# echo_date 那还更新个毛啊,关闭更新进程!
|
||||
# sleep 1
|
||||
# exit
|
||||
# fi
|
||||
# else
|
||||
# echo_date 没有检测到备用服务器在线版本号,访问备用服务器可能有问题!
|
||||
# sleep 1
|
||||
# echo_date 然而只有这一台备用更更新服务器,请尝试离线手动安装...
|
||||
# sleep 1
|
||||
# exit
|
||||
# fi
|
||||
# }
|
||||
|
||||
update_ss
|
||||
|
263
shadowsocks/shadowsocks/scripts/ss_v2ray.sh
Executable file
@ -0,0 +1,263 @@
|
||||
#!/bin/sh
|
||||
|
||||
eval `dbus export ss`
|
||||
source /jffs/softcenter/scripts/base.sh
|
||||
alias echo_date='echo 【$(TZ=UTC-8 date -R +%Y年%m月%d日\ %X)】:'
|
||||
V2RAY_CONFIG_FILE="/jffs/softcenter/ss/v2ray.json"
|
||||
url_main="https://raw.githubusercontent.com/paldier/softcenter/master/v2ray_binary"
|
||||
url_back=""
|
||||
|
||||
get_latest_version(){
|
||||
rm -rf /tmp/v2ray_latest_info.txt
|
||||
echo_date "检测V2Ray最新版本..."
|
||||
curl --connect-timeout 8 -s $url_main/latest.txt > /tmp/v2ray_latest_info.txt
|
||||
if [ "$?" == "0" ];then
|
||||
if [ -z "`cat /tmp/v2ray_latest_info.txt`" ];then
|
||||
echo_date "获取V2Ray最新版本信息失败!使用备用服务器检测!"
|
||||
get_latest_version_backup
|
||||
fi
|
||||
if [ -n "`cat /tmp/v2ray_latest_info.txt|grep "404"`" ];then
|
||||
echo_date "获取V2Ray最新版本信息失败!使用备用服务器检测!"
|
||||
get_latest_version_backup
|
||||
fi
|
||||
V2VERSION=`cat /tmp/v2ray_latest_info.txt | sed 's/v//g'` || 0
|
||||
echo_date "检测到V2Ray最新版本:v$V2VERSION"
|
||||
if [ ! -f "/jffs/softcenter/bin/v2ray" -o ! -f "/jffs/softcenter/bin/v2ctl" ];then
|
||||
echo_date "v2ray安装文件丢失!重新下载!"
|
||||
CUR_VER="0"
|
||||
else
|
||||
CUR_VER=`v2ray -version 2>/dev/null | head -n 1 | cut -d " " -f2 | sed 's/v//g'` || 0
|
||||
echo_date "当前已安装V2Ray版本:v$CUR_VER"
|
||||
fi
|
||||
COMP=`versioncmp $CUR_VER $V2VERSION`
|
||||
if [ "$COMP" == "1" ];then
|
||||
[ "$CUR_VER" != "0" ] && echo_date "V2Ray已安装版本号低于最新版本,开始更新程序..."
|
||||
update_now v$V2VERSION
|
||||
else
|
||||
V2RAY_LOCAL_VER=`/jffs/softcenter/bin/v2ray -version 2>/dev/null | head -n 1 | cut -d " " -f2`
|
||||
V2RAY_LOCAL_DATE=`/jffs/softcenter/bin/v2ray -version 2>/dev/null | head -n 1 | cut -d " " -f4`
|
||||
[ -n "$V2RAY_LOCAL_VER" ] && dbus set ss_basic_v2ray_version="$V2RAY_LOCAL_VER"
|
||||
[ -n "$V2RAY_LOCAL_DATE" ] && dbus set ss_basic_v2ray_date="$V2RAY_LOCAL_DATE"
|
||||
echo_date "V2Ray已安装版本已经是最新,退出更新程序!"
|
||||
fi
|
||||
else
|
||||
echo_date "获取V2Ray最新版本信息失败!使用备用服务器检测!"
|
||||
get_latest_version_backup
|
||||
fi
|
||||
}
|
||||
|
||||
get_latest_version_backup(){
|
||||
echo_date "目前还没有任何备用服务器!"
|
||||
echo_date "获取V2Ray最新版本信息失败!请检查到你的网络!"
|
||||
echo_date "==================================================================="
|
||||
echo XU6J03M6
|
||||
exit 1
|
||||
}
|
||||
|
||||
# get_latest_version_backup(){
|
||||
# rm -rf /tmp/v2ray_latest_info.txt
|
||||
# echo_date "检测V2Ray最新版本..."
|
||||
# curl --connect-timeout 8 -s $url_back/latest.txt > /tmp/v2ray_latest_info.txt
|
||||
# if [ "$?" == "0" ];then
|
||||
# if [ -z "`cat /tmp/v2ray_latest_info.txt`" ];then
|
||||
# echo_date "获取V2Ray最新版本信息失败!退出!"
|
||||
# echo_date "==================================================================="
|
||||
# echo XU6J03M6
|
||||
# exit 1
|
||||
# fi
|
||||
# if [ -n "`cat /tmp/v2ray_latest_info.txt|grep "404"`" ];then
|
||||
# echo_date "获取V2Ray最新版本信息失败!退出!"
|
||||
# echo_date "==================================================================="
|
||||
# echo XU6J03M6
|
||||
# exit 1
|
||||
# fi
|
||||
# V2VERSION=`cat /tmp/v2ray_latest_info.txt | sed 's/v//g'`
|
||||
# echo_date "检测到V2Ray最新版本:v$V2VERSION"
|
||||
# if [ ! -f "/jffs/softcenter/bin/v2ray" -o ! -f "/jffs/softcenter/bin/v2ctl" ];then
|
||||
# echo_date "v2ray安装文件丢失!重新下载!"
|
||||
# CUR_VER="0"
|
||||
# else
|
||||
# CUR_VER=`v2ray -version 2>/dev/null | head -n 1 | cut -d " " -f2 | sed 's/v//g'` || 0
|
||||
# echo_date "当前已安装V2Ray版本:v$CUR_VER"
|
||||
# fi
|
||||
# COMP=`versioncmp $V2VERSION $CUR_VER`
|
||||
# if [ "$COMP" == "1" ];then
|
||||
# [ "$CUR_VER" != "0" ] && echo_date "V2Ray已安装版本号低于最新版本,开始更新程序..."
|
||||
# update_now_backup v$V2VERSION
|
||||
# else
|
||||
# V2RAY_LOCAL_VER=`/jffs/softcenter/bin/v2ray -version 2>/dev/null | head -n 1 | cut -d " " -f2`
|
||||
# V2RAY_LOCAL_DATE=`/jffs/softcenter/bin/v2ray -version 2>/dev/null | head -n 1 | cut -d " " -f5`
|
||||
# [ -n "$V2RAY_LOCAL_VER" ] && dbus set ss_basic_v2ray_version="$V2RAY_LOCAL_VER"
|
||||
# [ -n "$V2RAY_LOCAL_DATE" ] && dbus set ss_basic_v2ray_date="$V2RAY_LOCAL_DATE"
|
||||
# echo_date "V2Ray已安装版本已经是最新,退出更新程序!"
|
||||
# fi
|
||||
# else
|
||||
# echo_date "获取V2Ray最新版本信息失败!请检查到你的网络!"
|
||||
# echo_date "==================================================================="
|
||||
# echo XU6J03M6
|
||||
# exit 1
|
||||
# fi
|
||||
# }
|
||||
|
||||
update_now(){
|
||||
rm -rf /tmp/v2ray
|
||||
mkdir -p /tmp/v2ray && cd /tmp/v2ray
|
||||
|
||||
echo_date "开始下载校验文件:md5sum.txt"
|
||||
wget --no-check-certificate --timeout=20 -qO - $url_main/$1/md5sum.txt > /tmp/v2ray/md5sum.txt
|
||||
if [ "$?" != "0" ];then
|
||||
echo_date "md5sum.txt下载失败!"
|
||||
md5sum_ok=0
|
||||
else
|
||||
md5sum_ok=1
|
||||
echo_date "md5sum.txt下载成功..."
|
||||
fi
|
||||
|
||||
echo_date "开始下载v2ray程序"
|
||||
wget --no-check-certificate --timeout=20 --tries=1 $url_main/$1/v2ray
|
||||
#curl -L -H "Cache-Control: no-cache" -o /tmp/v2ray/v2ray $url_main/$1/v2ray
|
||||
if [ "$?" != "0" ];then
|
||||
echo_date "v2ray下载失败!"
|
||||
v2ray_ok=0
|
||||
else
|
||||
v2ray_ok=1
|
||||
echo_date "v2ray程序下载成功..."
|
||||
fi
|
||||
|
||||
echo_date "开始下载v2ctl程序"
|
||||
wget --no-check-certificate --timeout=20 --tries=1 $url_main/$1/v2ctl
|
||||
if [ "$?" != "0" ];then
|
||||
echo_date "v2ctl下载失败!"
|
||||
v2ctl_ok=0
|
||||
else
|
||||
v2ctl_ok=1
|
||||
echo_date "v2ctl程序下载成功..."
|
||||
fi
|
||||
|
||||
if [ "$md5sum_ok=1" ] && [ "$v2ray_ok=1" ] && [ "$v2ctl_ok=1" ];then
|
||||
check_md5sum
|
||||
else
|
||||
echo_date "使用备用服务器下载..."
|
||||
update_now_backup $1
|
||||
fi
|
||||
}
|
||||
|
||||
update_now_backup(){
|
||||
echo_date "下载失败,请检查你的网络!"
|
||||
echo_date "==================================================================="
|
||||
echo XU6J03M6
|
||||
exit 1
|
||||
}
|
||||
|
||||
# update_now_backup(){
|
||||
# rm -rf /tmp/v2ray
|
||||
# mkdir -p /tmp/v2ray && cd /tmp/v2ray
|
||||
#
|
||||
# echo_date "开始下载校验文件:md5sum.txt"
|
||||
# wget --no-check-certificate --timeout=20 -qO - $url_back/$1/md5sum.txt > /tmp/v2ray/md5sum.txt
|
||||
# if [ "$?" != "0" ];then
|
||||
# echo_date "md5sum.txt下载失败!"
|
||||
# md5sum_ok=0
|
||||
# else
|
||||
# md5sum_ok=1
|
||||
# echo_date "md5sum.txt下载成功..."
|
||||
# fi
|
||||
#
|
||||
# echo_date "开始下载v2ray程序"
|
||||
# wget --no-check-certificate --timeout=20 --tries=1 $url_back/$1/v2ray
|
||||
# if [ "$?" != "0" ];then
|
||||
# echo_date "v2ray下载失败!"
|
||||
# v2ray_ok=0
|
||||
# else
|
||||
# v2ray_ok=1
|
||||
# echo_date "v2ray程序下载成功..."
|
||||
# fi
|
||||
#
|
||||
# echo_date "开始下载v2ctl程序"
|
||||
# wget --no-check-certificate --timeout=20 --tries=1 $url_back/$1/v2ctl
|
||||
# if [ "$?" != "0" ];then
|
||||
# echo_date "v2ctl下载失败!"
|
||||
# v2ctl_ok=0
|
||||
# else
|
||||
# v2ctl_ok=1
|
||||
# echo_date "v2ctl程序下载成功..."
|
||||
# fi
|
||||
#
|
||||
# if [ "$md5sum_ok=1" ] && [ "$v2ray_ok=1" ] && [ "$v2ctl_ok=1" ];then
|
||||
# check_md5sum
|
||||
# else
|
||||
# echo_date "下载失败,请检查你的网络!"
|
||||
# echo_date "==================================================================="
|
||||
# echo XU6J03M6
|
||||
# exit 1
|
||||
# fi
|
||||
# }
|
||||
|
||||
check_md5sum(){
|
||||
cd /tmp/v2ray
|
||||
echo_date "校验下载的文件!"
|
||||
V2RAY_LOCAL_MD5=`md5sum v2ray|awk '{print $1}'`
|
||||
V2RAY_ONLINE_MD5=`cat md5sum.txt|grep -w v2ray|awk '{print $1}'`
|
||||
V2CTL_LOCAL_MD5=`md5sum v2ctl|awk '{print $1}'`
|
||||
V2CTL_ONLINE_MD5=`cat md5sum.txt|grep v2ctl|awk '{print $1}'`
|
||||
if [ "$V2RAY_LOCAL_MD5"x = "$V2RAY_ONLINE_MD5"x ] && [ "$V2CTL_LOCAL_MD5"x = "$V2CTL_ONLINE_MD5"x ];then
|
||||
echo_date "文件校验通过!"
|
||||
install_binary
|
||||
else
|
||||
echo_date "校验未通过,可能是下载过程出现了什么问题,请检查你的网络!"
|
||||
echo_date "==================================================================="
|
||||
echo XU6J03M6
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
install_binary(){
|
||||
echo_date "开始覆盖最新二进制!"
|
||||
if [ "`pidof v2ray`" ];then
|
||||
echo_date "为了保证更新正确,先关闭v2ray主进程... "
|
||||
killall v2ray >/dev/null 2>&1
|
||||
move_binary
|
||||
sleep 1
|
||||
start_v2ray
|
||||
else
|
||||
move_binary
|
||||
fi
|
||||
}
|
||||
|
||||
move_binary(){
|
||||
echo_date "开始替换v2ray二进制文件... "
|
||||
mv /tmp/v2ray/v2ray /jffs/softcenter/bin/v2ray
|
||||
mv /tmp/v2ray/v2ctl /jffs/softcenter/bin/
|
||||
chmod +x /jffs/softcenter/bin/v2*
|
||||
V2RAY_LOCAL_VER=`/jffs/softcenter/bin/v2ray -version 2>/dev/null | head -n 1 | cut -d " " -f2`
|
||||
V2RAY_LOCAL_DATE=`/jffs/softcenter/bin/v2ray -version 2>/dev/null | head -n 1 | cut -d " " -f5`
|
||||
[ -n "$V2RAY_LOCAL_VER" ] && dbus set ss_basic_v2ray_version="$V2RAY_LOCAL_VER"
|
||||
[ -n "$V2RAY_LOCAL_DATE" ] && dbus set ss_basic_v2ray_date="$V2RAY_LOCAL_DATE"
|
||||
echo_date "v2ray二进制文件替换成功... "
|
||||
}
|
||||
|
||||
start_v2ray(){
|
||||
echo_date "开启v2ray进程... "
|
||||
cd /jffs/softcenter/bin
|
||||
export GOGC=30
|
||||
v2ray --config=/jffs/softcenter/ss/v2ray.json >/dev/null 2>&1 &
|
||||
|
||||
local i=10
|
||||
until [ -n "$V2PID" ]
|
||||
do
|
||||
i=$(($i-1))
|
||||
V2PID=`pidof v2ray`
|
||||
if [ "$i" -lt 1 ];then
|
||||
echo_date "v2ray进程启动失败!"
|
||||
close_in_five
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
echo_date v2ray启动成功,pid:$V2PID
|
||||
}
|
||||
|
||||
echo_date "==================================================================="
|
||||
echo_date " v2ray程序更新(Shell by sadog)"
|
||||
echo_date "==================================================================="
|
||||
get_latest_version
|
||||
echo_date "==================================================================="
|
@ -1,4 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
source /jffs/softcenter/scripts/base.sh
|
||||
eval `dbus export ssconf_basic`
|
||||
|
||||
@ -11,23 +12,20 @@ if [ ! -z "$webtest" ];then
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
start_webtest(){
|
||||
array1=`dbus get ssconf_basic_server_$nu`
|
||||
array2=`dbus get ssconf_basic_port_$nu`
|
||||
array3=`dbus get ssconf_basic_password_$nu|base64 -d`
|
||||
array3=`dbus get ssconf_basic_password_$nu|base64_decode`
|
||||
array4=`dbus get ssconf_basic_method_$nu`
|
||||
array5=`dbus get ssconf_basic_use_rss_$nu`
|
||||
array6=`dbus get ssconf_basic_onetime_auth_$nu`
|
||||
#array6=`dbus get ssconf_basic_onetime_auth_$nu`
|
||||
array7=`dbus get ssconf_basic_rss_protocol_$nu`
|
||||
array8=`dbus get ssconf_basic_rss_obfs_$nu`
|
||||
array9=`dbus get ssconf_basic_ss_obfs_$nu`
|
||||
array10=`dbus get ssconf_basic_ss_obfs_host_$nu`
|
||||
array11=`dbus get ssconf_basic_mode_$nu`
|
||||
|
||||
[ $array6 -ne 1 ] && ARG_OTA="" || ARG_OTA="-A";
|
||||
#[ "$array6" -ne "1" ] && ARG_OTA="" || ARG_OTA="-A";
|
||||
if [ "$array10" != "" ];then
|
||||
if [ "$array9" == "http" ];then
|
||||
ARG_OBFS="--obfs http --obfs-host $array10"
|
||||
@ -57,24 +55,25 @@ start_webtest(){
|
||||
"timeout":600,
|
||||
"protocol":"$array7",
|
||||
"obfs":"$array8",
|
||||
"obfs_param":"www.baidu.com",
|
||||
"method":"$array4"
|
||||
}
|
||||
EOF
|
||||
rss-local -b 0.0.0.0 -l 23458 -c /tmp/tmp_ss.json -u -f /var/run/sslocal2.pid >/dev/null 2>&1
|
||||
result=`curl -o /dev/null -s -w %{time_total}:%{speed_download} --socks5-hostname 127.0.0.1:23458 $ssconf_basic_test_domain`
|
||||
sleep 2
|
||||
result=`curl -o /dev/null -s -w %{time_total}:%{speed_download} --connect-timeout 15 --socks5-hostname 127.0.0.1:23458 $ssconf_basic_test_domain`
|
||||
# result=`curl -o /dev/null -s -w %{time_connect}:%{time_starttransfer}:%{time_total}:%{speed_download} --socks5-hostname 127.0.0.1:23456 https://www.google.com/`
|
||||
sleep 1
|
||||
dbus set ssconf_basic_webtest_$nu=$result
|
||||
sleep 1
|
||||
kill -9 `ps|grep ss-local|grep 23458|awk '{print $1}'`
|
||||
kill -9 `ps|grep rss-local|grep 23458|awk '{print $1}'` >/dev/null 2>&1
|
||||
rm -rf /tmp/tmp_ss.json
|
||||
else
|
||||
ss-local -b 0.0.0.0 -l 23458 -s $array1 -p $array2 -k $array3 -m $array4 -u $ARG_OTA $ARG_OBFS -f /var/run/sslocal3.pid >/dev/null 2>&1
|
||||
result=`curl -o /dev/null -s -w %{time_total}:%{speed_download} --socks5-hostname 127.0.0.1:23458 $ssconf_basic_test_domain`
|
||||
sleep 2
|
||||
result=`curl -o /dev/null -s -w %{time_total}:%{speed_download} --connect-timeout 15 --socks5-hostname 127.0.0.1:23458 $ssconf_basic_test_domain`
|
||||
sleep 1
|
||||
dbus set ssconf_basic_webtest_$nu=$result
|
||||
sleep 1
|
||||
kill -9 `ps|grep ss-local|grep 23458|awk '{print $1}'`
|
||||
kill -9 `ps|grep ss-local|grep 23458|awk '{print $1}'` >/dev/null 2>&1
|
||||
fi
|
||||
else
|
||||
dbus set ssconf_basic_webtest_$nu="failed"
|
||||
|
@ -1,10 +1,12 @@
|
||||
#!/bin/sh
|
||||
LOGTIME=$(date "+%Y-%m-%d %H:%M:%S")
|
||||
/usr/sbin/wget -4 --spider --quiet --tries=2 --timeout=2 www.baidu.com
|
||||
|
||||
if [ "$?" == "0" ]; then
|
||||
log='[ '$LOGTIME' ] working...'
|
||||
log='<font color='#fc0'>国内连接 - [ '$LOGTIME' ] ✓</font>'
|
||||
#log='国内连接 - [ '$LOGTIME' ] ✓'
|
||||
else
|
||||
log='[ '$LOGTIME' ] Problem detected!'
|
||||
log='<font color='#FF5722'>国内连接 - [ '$LOGTIME' ] X</font>'
|
||||
fi
|
||||
|
||||
nvram set ss_china_state="$log"
|
||||
#dbus ram ss_basic_state_china="$log"
|
||||
|
@ -1,12 +1,11 @@
|
||||
#!/bin/sh
|
||||
LOGTIME=$(date "+%Y-%m-%d %H:%M:%S")
|
||||
server_ip=`nslookup "facebook.com" 127.0.0.1 | sed '1,4d' | awk '{print $3}' | grep -v :|awk 'NR==1{print}'`
|
||||
/usr/sbin/wget -4 --spider --quiet --tries=2 --timeout=2 $server_ip
|
||||
/usr/sbin/wget -4 --spider --quiet --tries=2 --timeout=2 www.google.com.tw
|
||||
|
||||
if [ "$?" == "0" ]; then
|
||||
log='[ '$LOGTIME' ] working...'
|
||||
log='<font color='#fc0'>国外连接 - [ '$LOGTIME' ] ✓</font>'
|
||||
else
|
||||
log='[ '$LOGTIME' ] Problem detected!'
|
||||
log='<font color='#FF5722'>国外连接 - [ '$LOGTIME' ] X</font>'
|
||||
fi
|
||||
|
||||
nvram set ss_foreign_state="$log"
|
||||
|
@ -1,4 +0,0 @@
|
||||
2016-08-21-2 # dce75ad554bf8bcec63da1d92f5a6a00 gfwlist
|
||||
2016-08-21 # 5e91c37d2a2dd2d9f88555413af6faa0 chnroute
|
||||
2016-02-26 # 7c8569e96bc6893a146d5e093a3b0434 adblock
|
||||
2016-04-27 # 2bdbabfedb7cd8bdee596525079c8b0b cdn
|
@ -1,275 +0,0 @@
|
||||
#!/bin/sh
|
||||
eval `dbus export ss`
|
||||
lan_ipaddr=$(nvram get lan_ipaddr)
|
||||
alias echo_date='echo $(date +%Y年%m月%d日\ %X):'
|
||||
|
||||
flush_nat(){
|
||||
echo_date 尝试先清除已存在的iptables规则,防止重复添加
|
||||
# flush rules and set if any
|
||||
iptables -t nat -D PREROUTING -p tcp -j SHADOWSOCKS >/dev/null 2>&1
|
||||
sleep 1
|
||||
iptables -t nat -F SHADOWSOCKS > /dev/null 2>&1 && iptables -t nat -X SHADOWSOCKS > /dev/null 2>&1
|
||||
iptables -t nat -F SHADOWSOCKS_GFW > /dev/null 2>&1 && iptables -t nat -X SHADOWSOCKS_GFW > /dev/null 2>&1
|
||||
iptables -t nat -F SHADOWSOCKS_CHN > /dev/null 2>&1 && iptables -t nat -X SHADOWSOCKS_CHN > /dev/null 2>&1
|
||||
iptables -t nat -F SHADOWSOCKS_GLO > /dev/null 2>&1 && iptables -t nat -X SHADOWSOCKS_GLO > /dev/null 2>&1
|
||||
iptables -t nat -F SHADOWSOCKS_HOM > /dev/null 2>&1 && iptables -t nat -X SHADOWSOCKS_HOM > /dev/null 2>&1
|
||||
iptables -t nat -D OUTPUT -p tcp -m set --set router dst -j REDIRECT --to-ports 3333 >/dev/null 2>&1
|
||||
iptables -t nat -D PREROUTING -p udp --dport 53 -j DNAT --to $lan_ipaddr >/dev/null 2>&1
|
||||
}
|
||||
|
||||
flush_ipset(){
|
||||
echo_date 先清空已存在的ipset名单,防止重复添加
|
||||
ipset -F chnroute >/dev/null 2>&1 && ipset -X chnroute >/dev/null 2>&1
|
||||
ipset -F white_ip >/dev/null 2>&1 && ipset -X white_ip >/dev/null 2>&1
|
||||
ipset -F white_cidr >/dev/null 2>&1 && ipset -X white_cidr >/dev/null 2>&1
|
||||
ipset -F black_ip >/dev/null 2>&1 && ipset -X black_ip >/dev/null 2>&1
|
||||
ipset -F black_cidr >/dev/null 2>&1 && ipset -X black_cidr >/dev/null 2>&1
|
||||
ipset -F gfwlist >/dev/null 2>&1 && ipset -X gfwlist >/dev/null 2>&1
|
||||
ipset -F router >/dev/null 2>&1 && ipset -X router >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# creat ipset rules
|
||||
creat_ipset(){
|
||||
echo_date 创建ipset名单
|
||||
ipset -N white_ip iphash
|
||||
ipset -N white_cidr nethash
|
||||
ipset -N black_ip iphash
|
||||
ipset -N black_cidr nethash
|
||||
ipset -N gfwlist iphash
|
||||
ipset -N router iphash
|
||||
#ipset -N chnroute nethash
|
||||
sed -e "s/^/-A chnroute &/g" -e "1 i\-N chnroute nethash --hashsize 81920" /jffs/softcenter/ss/rules/chnroute.txt | awk '{print $0} END{print "COMMIT"}' | ipset -R
|
||||
}
|
||||
|
||||
add_white_black_ip(){
|
||||
# black cidr for telegram
|
||||
ip_tg="149.154.0.0/16 91.108.4.0/22 91.108.56.0/24 109.239.140.0/24 67.198.55.0/24"
|
||||
for ip in $ip_tg
|
||||
do
|
||||
ipset -A black_cidr $ip >/dev/null 2>&1
|
||||
done
|
||||
# black ip/cidr for user defined in the web
|
||||
if [ -n "$ss_wan_black_ip" ];then
|
||||
#ss_wan_black_ip=`dbus get ss_wan_black_ip|base64 -d|sed '/\#/d'`
|
||||
ip_format=`echo $ss_wan_black_ip|base64 -d|sed '/\#/d'|grep -v "/"`
|
||||
cidr_format=`echo $ss_wan_black_ip|base64 -d|sed '/\#/d'|grep "/"`
|
||||
|
||||
if [ -n "$ip_format" ];then
|
||||
echo_date 应用IP黑名单
|
||||
for ip in "$ip_format"
|
||||
do
|
||||
ipset -A black_ip "$ip" >/dev/null 2>&1
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -n "$cidr_format" ];then
|
||||
echo_date 应用CIDR黑名单
|
||||
for cidr in "$cidr_format"
|
||||
do
|
||||
ipset -A black_cidr "$cidr" >/dev/null 2>&1
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
# white ip/cidr
|
||||
ip1=$(nvram get wan0_ipaddr | cut -d"." -f1,2)
|
||||
[ -n "$ss_basic_server_ip" ] && SERVER_IP=$ss_basic_server_ip || SERVER_IP=""
|
||||
ISP_DNS1=$(nvram get wan0_dns|sed 's/ /\n/g'|grep -v 0.0.0.0|grep -v 127.0.0.1|sed -n 1p)
|
||||
ISP_DNS2=$(nvram get wan0_dns|sed 's/ /\n/g'|grep -v 0.0.0.0|grep -v 127.0.0.1|sed -n 2p)
|
||||
|
||||
cidr_lan="0.0.0.0/8 10.0.0.0/8 100.64.0.0/10 127.0.0.0/8 169.254.0.0/16 172.16.0.0/12 192.168.0.0/16 224.0.0.0/4 240.0.0.0/4 $ip1.0.0/16"
|
||||
ip_lan="$SERVER_IP 223.5.5.5 223.6.6.6 114.114.114.114 114.114.115.115 1.2.4.8 210.2.4.8 112.124.47.27 114.215.126.16 180.76.76.76 119.29.29.29 $ISP_DNS1 $ISP_DNS2"
|
||||
for ip in $ip_lan
|
||||
do
|
||||
ipset -A white_ip $ip >/dev/null 2>&1
|
||||
done
|
||||
|
||||
for cidr in $cidr_lan
|
||||
do
|
||||
ipset -A white_cidr $cidr >/dev/null 2>&1
|
||||
done
|
||||
|
||||
# white ip/cidr for user defined in the web
|
||||
if [ -n "$ss_wan_white_ip" ];then
|
||||
ip_format=`echo $ss_wan_white_ip|base64 -d|sed '/\#/d'|grep -v "/"`
|
||||
cidr_format=`echo $ss_wan_white_ip|base64 -d|sed '/\#/d'|grep "/"`
|
||||
|
||||
if [ -n "$ip_format" ];then
|
||||
echo_date 应用IP白名单
|
||||
for ip in "$ip_format"
|
||||
do
|
||||
ipset -A white_ip "$ip" >/dev/null 2>&1
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -n "$cidr_format" ];then
|
||||
echo_date 应用CIDR白名单
|
||||
for cidr in "$cidr_format"
|
||||
do
|
||||
ipset -A white_cidr "$cidr" >/dev/null 2>&1
|
||||
done
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
get_action_chain() {
|
||||
case "$1" in
|
||||
0)
|
||||
echo "RETURN"
|
||||
;;
|
||||
1)
|
||||
echo "SHADOWSOCKS_GFW"
|
||||
;;
|
||||
2)
|
||||
echo "SHADOWSOCKS_CHN"
|
||||
;;
|
||||
5)
|
||||
echo "SHADOWSOCKS_GLO"
|
||||
;;
|
||||
6)
|
||||
echo "SHADOWSOCKS_HOM"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
get_mode_name() {
|
||||
case "$1" in
|
||||
0)
|
||||
echo "不通过SS"
|
||||
;;
|
||||
1)
|
||||
echo "gfwlist模式"
|
||||
;;
|
||||
2)
|
||||
echo "大陆白名单模式"
|
||||
;;
|
||||
5)
|
||||
echo "全局模式"
|
||||
;;
|
||||
6)
|
||||
echo "回国模式"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
factor(){
|
||||
if [ -z "$1" ] || [ -z "$2" ]; then
|
||||
echo ""
|
||||
else
|
||||
echo "$2 $1"
|
||||
fi
|
||||
}
|
||||
|
||||
get_jump_mode(){
|
||||
case "$1" in
|
||||
0)
|
||||
echo "j"
|
||||
;;
|
||||
*)
|
||||
echo "g"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
lan_acess_control(){
|
||||
# lan access control
|
||||
acl_nu=`dbus list ss_acl_mode|sed 1d|sort -n -t "=" -k 2|cut -d "=" -f 1 | cut -d "_" -f 4`
|
||||
if [ -n "$acl_nu" ]; then
|
||||
for acl in $acl_nu
|
||||
do
|
||||
ipaddr=`dbus get ss_acl_ip_$acl`
|
||||
ports=`dbus get ss_acl_port_$acl`
|
||||
[ "$ports" == "all" ] && ports=""
|
||||
proxy_mode=`dbus get ss_acl_mode_$acl`
|
||||
proxy_name=`dbus get ss_acl_name_$acl`
|
||||
[ "$ports" == "" ] && echo_date 加载ACL规则:$ipaddr:all模式为:$(get_mode_name $proxy_mode) || echo_date 加载ACL规则:$ipaddr:$ports模式为:$(get_mode_name $proxy_mode)
|
||||
iptables -t nat -A SHADOWSOCKS $(factor $ipaddr "-s") -p tcp $(factor $ports "-m multiport --dport") -$(get_jump_mode $proxy_mode) $(get_action_chain $proxy_mode)
|
||||
[ "$proxy_mode" == "3" ] || [ "$proxy_mode" == "4" ] && \
|
||||
iptables -t mangle -A SHADOWSOCKS $(factor $ipaddr "-s") -p udp $(factor $ports "-m multiport --dport") -$(get_jump_mode $proxy_mode) $(get_action_chain $proxy_mode)
|
||||
done
|
||||
|
||||
if [ -n "ss_acl_default_mode=" ];then
|
||||
echo_date 加载ACL规则:其余主机模式为:$(get_mode_name $ss_acl_default_mode)
|
||||
else
|
||||
echo_date 加载ACL规则:其余主机模式为:$(get_mode_name $ss_basic_mode)
|
||||
dbus set ss_acl_default_mode="$ss_basic_mode"
|
||||
fi
|
||||
else
|
||||
ss_acl_default_mode=$ss_basic_mode
|
||||
echo_date 加载ACL规则:所有模式为:$(get_mode_name $ss_basic_mode)
|
||||
fi
|
||||
}
|
||||
|
||||
apply_nat_rules(){
|
||||
#----------------------BASIC RULES---------------------
|
||||
echo_date 写入iptables规则到nat表中...
|
||||
iptables -t nat -N SHADOWSOCKS
|
||||
iptables -t nat -A SHADOWSOCKS -p tcp -m set --set white_ip dst -j RETURN
|
||||
iptables -t nat -A SHADOWSOCKS -p tcp -m set --set white_cidr dst -j RETURN
|
||||
#-----------------------FOR GLOABLE---------------------
|
||||
iptables -t nat -N SHADOWSOCKS_GLO
|
||||
iptables -t nat -A SHADOWSOCKS_GLO -p tcp -j REDIRECT --to-ports 3333
|
||||
#-----------------------FOR GFWLIST---------------------
|
||||
iptables -t nat -N SHADOWSOCKS_GFW
|
||||
iptables -t nat -A SHADOWSOCKS_GFW -p tcp -m set --set black_ip dst -j REDIRECT --to-ports 3333
|
||||
iptables -t nat -A SHADOWSOCKS_GFW -p tcp -m set --set black_cidr dst -j REDIRECT --to-ports 3333
|
||||
iptables -t nat -A SHADOWSOCKS_GFW -p tcp -m set --set gfwlist dst -j REDIRECT --to-ports 3333
|
||||
#-----------------------FOR CHNMODE---------------------
|
||||
iptables -t nat -N SHADOWSOCKS_CHN
|
||||
iptables -t nat -A SHADOWSOCKS_CHN -p tcp -m set --set black_ip dst -j REDIRECT --to-ports 3333
|
||||
iptables -t nat -A SHADOWSOCKS_CHN -p tcp -m set --set black_cidr dst -j REDIRECT --to-ports 3333
|
||||
iptables -t nat -A SHADOWSOCKS_CHN -p tcp -m set ! --set chnroute dst -j REDIRECT --to-ports 3333
|
||||
#-----------------------FOR HOMEMODE---------------------
|
||||
iptables -t nat -N SHADOWSOCKS_HOM
|
||||
iptables -t nat -A SHADOWSOCKS_HOM -p tcp -m set --set black_ip dst -j REDIRECT --to-ports 3333
|
||||
iptables -t nat -A SHADOWSOCKS_HOM -p tcp -m set --set black_cidr dst -j REDIRECT --to-ports 3333
|
||||
iptables -t nat -A SHADOWSOCKS_HOM -p tcp -m set --set chnroute dst -j REDIRECT --to-ports 3333
|
||||
#-----------------------FOR ROUTER---------------------
|
||||
[ "$ss_basic_mode" != "6" ] && iptables -t nat -A OUTPUT -p tcp -m set --set router dst -j REDIRECT --to-ports 3333
|
||||
#-------------------------------------------------------
|
||||
# 局域网黑名单(不走ss)/局域网黑名单(走ss)
|
||||
lan_acess_control
|
||||
# 把最后剩余流量重定向到相应模式的nat表中对对应的主模式的链
|
||||
[ "$ss_acl_default_port" == "all" ] && ss_acl_default_port=""
|
||||
iptables -t nat -A SHADOWSOCKS -p tcp $(factor $ss_acl_default_port "-m multiport --dport") -j $(get_action_chain $ss_acl_default_mode)
|
||||
# 重定所有流量到 SHADOWSOCKS
|
||||
iptables -t nat -I PREROUTING 1 -p tcp -j SHADOWSOCKS
|
||||
}
|
||||
|
||||
chromecast(){
|
||||
LOG1=开启chromecast功能(DNS劫持功能)
|
||||
LOG2=chromecast功能未开启,建议开启~
|
||||
if [ "$ss_basic_chromecast" == "1" ];then
|
||||
IPT_ACTION="-A"
|
||||
echo_date $LOG1
|
||||
else
|
||||
IPT_ACTION="-D"
|
||||
echo_date $LOG2
|
||||
fi
|
||||
iptables -t nat $IPT_ACTION PREROUTING -p udp --dport 53 -j DNAT --to $lan_ipaddr >/dev/null 2>&1
|
||||
}
|
||||
|
||||
|
||||
case $1 in
|
||||
start_all)
|
||||
flush_nat
|
||||
flush_ipset
|
||||
creat_ipset
|
||||
add_white_black_ip
|
||||
apply_nat_rules
|
||||
chromecast
|
||||
;;
|
||||
add_new_ip)
|
||||
add_white_black_ip
|
||||
;;
|
||||
start_part_for_addon)
|
||||
#ss_basic_action=4
|
||||
flush_nat
|
||||
chromecast
|
||||
apply_nat_rules
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 (start_all|restart_wb_list)"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
32
shadowsocks/shadowsocks/ss/postscripts/change_my_name.sh
Executable file
@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
# 此脚本是一个示例,实际写法按照自己的方法来做
|
||||
# 更改此脚本的名字,保证此脚本的名字格式是: P+数字+名字.sh
|
||||
# 例如在/jffs/softcenter/ss/postscripts下放入两个脚本:P01V2ray.sh, P99Brook.sh
|
||||
# SS插件运行后货自动按照数字从小到大顺序运行 P01V2ray.sh start, P99Brook.sh start
|
||||
# SS插件关闭前会自动按照数字从大到小顺序运行 P99Brook.sh stop, P01V2ray.sh stop
|
||||
#------------------------------------------
|
||||
source /jffs/softcenter/scripts/base.sh
|
||||
# 读取SS配置
|
||||
eval `dbus export ss`
|
||||
# 保持打印日志时间格式和ss插件一致
|
||||
alias echo_date='echo 【$(TZ=UTC-8 date -R +%Y年%m月%d日\ %X)】:'
|
||||
#------------------------------------------
|
||||
start_v2ray(){
|
||||
echo_date :"启动v2ray"
|
||||
# do something here
|
||||
}
|
||||
|
||||
stop_v2ray(){
|
||||
echo_date :"停止v2ray"
|
||||
# do something here
|
||||
}
|
||||
#------------------------------------------
|
||||
case $1 in
|
||||
start)
|
||||
start_v2ray
|
||||
;;
|
||||
stop)
|
||||
stop_v2ray
|
||||
;;
|
||||
esac
|
27
shadowsocks/shadowsocks/ss/rules/cdns.json
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"global": {
|
||||
"daemon": true,
|
||||
"log": "syslog:daemon",
|
||||
"pidfile": "/var/run/cdns.pid",
|
||||
"log_debug": false
|
||||
},
|
||||
"cdns": {
|
||||
"listen_ip": "127.0.0.1",
|
||||
"listen_port": 7913,
|
||||
"timeout": 2,
|
||||
"servers": [
|
||||
{
|
||||
"ip_port": "203.80.96.10"
|
||||
},
|
||||
{
|
||||
"ip_port": "208.67.222.222"
|
||||
},
|
||||
{
|
||||
"ip_port": "8.8.8.8"
|
||||
},
|
||||
{
|
||||
"ip_port": "9.9.9.9"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
0
shadowsocks/shadowsocks/ss/rules/chnroute.txt
Executable file → Normal file
129
shadowsocks/shadowsocks/ss/rules/dnsmasq.postconf
Normal file → Executable file
@ -1,38 +1,123 @@
|
||||
#!/bin/sh
|
||||
|
||||
CONFIG=$1
|
||||
# shadowsocks script for AM380 merlin firmware
|
||||
# by sadog (sadoneli@gmail.com) from koolshare.cn
|
||||
|
||||
source /usr/sbin/helper.sh
|
||||
CONFIG=$1
|
||||
|
||||
ss_basic_mode=`dbus get ss_basic_mode`
|
||||
ss_dns_china=`dbus get ss_dns_china`
|
||||
ss_dns_china_user=`dbus get ss_dns_china_user`
|
||||
ss_dns_plan=`dbus get ss_dns_plan`
|
||||
|
||||
gfw_on=`dbus list ss_acl_mode_|cut -d "=" -f 2 | grep 1`
|
||||
chn_on=`dbus list ss_acl_mode_|cut -d "=" -f 2 | grep -E "2|3|4"`
|
||||
all_on=`dbus list ss_acl_mode_|cut -d "=" -f 2 | grep -E "5"`
|
||||
ISP_DNS1=$(nvram get wan0_dns|sed 's/ /\n/g'|grep -v 0.0.0.0|grep -v 127.0.0.1|sed -n 1p)
|
||||
ISP_DNS2=$(nvram get wan0_dns|sed 's/ /\n/g'|grep -v 0.0.0.0|grep -v 127.0.0.1|sed -n 2p)
|
||||
if [ "$ss_dns_china" == "1" ];then
|
||||
[ -n "$ISP_DNS1" ] && CDN1="$ISP_DNS1" || CDN1="114.114.114.114"
|
||||
[ -n "$ISP_DNS2" ] && CDN2="$ISP_DNS2" || CDN2="114.114.115.115"
|
||||
fi
|
||||
[ "$ss_dns_china" == "2" ] && CDN="223.5.5.5"
|
||||
[ "$ss_dns_china" == "3" ] && CDN="223.6.6.6"
|
||||
[ "$ss_dns_china" == "4" ] && CDN="114.114.114.114"
|
||||
[ "$ss_dns_china" == "5" ] && CDN="114.114.115.115"
|
||||
[ "$ss_dns_china" == "6" ] && CDN="1.2.4.8"
|
||||
[ "$ss_dns_china" == "7" ] && CDN="210.2.4.8"
|
||||
[ "$ss_dns_china" == "8" ] && CDN="112.124.47.27"
|
||||
[ "$ss_dns_china" == "9" ] && CDN="114.215.126.16"
|
||||
[ "$ss_dns_china" == "10" ] && CDN="180.76.76.76"
|
||||
[ "$ss_dns_china" == "11" ] && CDN="119.29.29.29"
|
||||
[ "$ss_dns_china" == "12" ] && CDN="$ss_dns_china_user"
|
||||
IFIP_DNS1=`echo $ISP_DNS1|grep -E "([0-9]{1,3}[\.]){3}[0-9]{1,3}|:"`
|
||||
IFIP_DNS2=`echo $ISP_DNS2|grep -E "([0-9]{1,3}[\.]){3}[0-9]{1,3}|:"`
|
||||
|
||||
if [ "$ss_dns_plan" == "1" ] || [ -z "$ss_dns_china" ];then
|
||||
perpare(){
|
||||
if [ "$ss_dns_china" == "1" ];then
|
||||
if [ "$ss_basic_mode" == "6" ];then
|
||||
# 使用回国模式的时候,ISP dns是国外的,所以这里直接用114取代
|
||||
CDN1="114.114.114.114"
|
||||
else
|
||||
if [ -n "$IFIP_DNS1" ];then
|
||||
# 运营商DNS1:ISP_DNS1是ip格式
|
||||
FO=`awk -F'[./]' -v ip=$IFIP_DNS1 ' {for (i=1;i<=int($NF/8);i++){a=a$i"."} if (index(ip, a)==1){split( ip, A, ".");b=int($NF/8);if (A[b+1]<($(NF+b-4)+2^(8-$NF%8))&&A[b+1]>=$(NF+b-4)) print ip,"belongs to",$0} a=""}' /koolshare/ss/rules/chnroute.txt`
|
||||
if [ -n "$FO" ];then
|
||||
# 运营商DNS1:ISP_DNS1是国内IP
|
||||
CDN1="$IFIP_DNS1"
|
||||
else
|
||||
# 运营商DNS1:ISP_DNS1是国外IP或者局域网IP
|
||||
CDN1="114.114.114.114"
|
||||
fi
|
||||
else
|
||||
# 运营商DNS1:ISP_DNS1不是ip格式
|
||||
CDN1="114.114.114.114"
|
||||
fi
|
||||
fi
|
||||
if [ "$ss_basic_mode" == "6" ];then
|
||||
# 使用回国模式的时候,ISP dns是国外的,所以这里直接用114取代
|
||||
CDN2="114.114.115.115"
|
||||
else
|
||||
if [ -n "$IFIP_DNS2" ];then
|
||||
# 运营商DNS1:ISP_DNS1是ip格式
|
||||
FO=`awk -F'[./]' -v ip=$IFIP_DNS2 ' {for (i=1;i<=int($NF/8);i++){a=a$i"."} if (index(ip, a)==1){split( ip, A, ".");b=int($NF/8);if (A[b+1]<($(NF+b-4)+2^(8-$NF%8))&&A[b+1]>=$(NF+b-4)) print ip,"belongs to",$0} a=""}' /koolshare/ss/rules/chnroute.txt`
|
||||
if [ -n "$FO" ];then
|
||||
# 运营商DNS1:ISP_DNS1是国内IP
|
||||
CDN2="$IFIP_DNS2"
|
||||
else
|
||||
# 运营商DNS1:ISP_DNS1是国外IP或者局域网IP
|
||||
CDN2="114.114.115.115"
|
||||
fi
|
||||
else
|
||||
# 运营商DNS1:ISP_DNS1不是ip格式
|
||||
CDN2="114.114.115.115"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
[ "$ss_dns_china" == "2" ] && CDN="223.5.5.5"
|
||||
[ "$ss_dns_china" == "3" ] && CDN="223.6.6.6"
|
||||
[ "$ss_dns_china" == "4" ] && CDN="114.114.114.114"
|
||||
[ "$ss_dns_china" == "5" ] && CDN="114.114.115.115"
|
||||
[ "$ss_dns_china" == "6" ] && CDN="1.2.4.8"
|
||||
[ "$ss_dns_china" == "7" ] && CDN="210.2.4.8"
|
||||
[ "$ss_dns_china" == "8" ] && CDN="112.124.47.27"
|
||||
[ "$ss_dns_china" == "9" ] && CDN="114.215.126.16"
|
||||
[ "$ss_dns_china" == "10" ] && CDN="180.76.76.76"
|
||||
[ "$ss_dns_china" == "11" ] && CDN="119.29.29.29"
|
||||
[ "$ss_dns_china" == "12" ] && {
|
||||
[ -n "$ss_dns_china_user" ] && CDN="$ss_dns_china_user" || CDN="114.114.114.114"
|
||||
}
|
||||
[ -n "`cat /etc/dnsmasq.conf|grep no-resolv`" ] && sed -i '/no-resolv/d' /etc/dnsmasq.conf
|
||||
[ -n "`cat /etc/dnsmasq.conf|grep servers-file`" ] && sed -i '/servers-file/d' /etc/dnsmasq.conf
|
||||
[ -n "`cat /etc/dnsmasq.conf|grep resolv-file`" ] && sed -i '/resolv-file/d' /etc/dnsmasq.conf
|
||||
}
|
||||
|
||||
use_chn_plan(){
|
||||
# DNS方案,国内优先,因此dnsmasq的server默认为国内地址,国外解析由gfwlist.conf提供,路由的开销比较小,国内cdn很好,但是国外cdn较弱
|
||||
pc_replace "cache-size=1500" "cache-size=9999" $CONFIG
|
||||
if [ "$ss_dns_china" == "1" ];then
|
||||
# 选择运营商DNS时候,如果有两个DNS,则都使用
|
||||
pc_insert "no-poll" "server=$CDN2#53" "/etc/dnsmasq.conf"
|
||||
pc_insert "no-poll" "server=$CDN1#53" "/etc/dnsmasq.conf"
|
||||
pc_insert "no-poll" "all-servers" "/etc/dnsmasq.conf"
|
||||
else
|
||||
# 选择其它国内DNS时候
|
||||
pc_insert "no-poll" "server=$CDN#53" "/etc/dnsmasq.conf"
|
||||
fi
|
||||
elif [ "$ss_dns_plan" == "2" ];then
|
||||
pc_insert "no-poll" "server=127.0.0.1#7913" "/etc/dnsmasq.conf"
|
||||
pc_insert "no-poll" "no-resolv" "/etc/dnsmasq.conf"
|
||||
}
|
||||
|
||||
use_for_plan(){
|
||||
# DNS方案,国外优先,因此dnsmasq的server默认为国外地址,国内的解析由cdn.txt提供,路由的开销比较大,国内cdn较好,但是国外cdn很好
|
||||
if [ "$ss_basic_mode" == "6" ];then
|
||||
if [ -n "`echo $ss_direct_user|grep :`" ];then
|
||||
echo_date 国外直连dns设定格式错误,将自动更正为8.8.8.8#53.
|
||||
ss_direct_user="8.8.8.8#53"
|
||||
dbus set ss_direct_user="8.8.8.8#53"
|
||||
fi
|
||||
[ -z "$ss_direct_user" ] && ss_direct_user="8.8.8.8#53"
|
||||
|
||||
pc_replace "cache-size=1500" "cache-size=9999" $CONFIG
|
||||
pc_insert "no-poll" "server=$ss_direct_user" "/etc/dnsmasq.conf"
|
||||
pc_insert "no-poll" "no-resolv" "/etc/dnsmasq.conf"
|
||||
else
|
||||
pc_replace "cache-size=1500" "cache-size=9999" $CONFIG
|
||||
pc_insert "no-poll" "server=127.0.0.1#7913" "/etc/dnsmasq.conf"
|
||||
pc_insert "no-poll" "no-resolv" "/etc/dnsmasq.conf"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$ss_basic_mode" == "1" -a -z "$chn_on" -a -z "$all_on" ] || [ "$ss_basic_mode" == "6" ];then
|
||||
# gfwlist模式的时候,且访问控制主机中不存在 大陆白名单模式 游戏模式 全局模式,则使用国内优先模式
|
||||
# 回国模式下自动判断使用国内优先
|
||||
perpare
|
||||
use_chn_plan
|
||||
else
|
||||
# 其它情况,均使用国外优先模式
|
||||
perpare
|
||||
use_for_plan
|
||||
fi
|
||||
pc_insert "no-poll" "no-resolv" "/etc/dnsmasq.conf"
|
||||
|
0
shadowsocks/shadowsocks/ss/rules/gfwlist.conf
Executable file → Normal file
@ -2,3 +2,6 @@
|
||||
2018-11-25 # f8b2d91949aa7b78da6dd44bd23fdcc3 chnroute
|
||||
2016-02-26 # 7c8569e96bc6893a146d5e093a3b0434 adblock
|
||||
2018-11-25 # b04f1816699f304134994ebc64d29325 cdn
|
||||
2018-11-25 # fa8f6eb971e3c1179cd972754c7f7744 Routing
|
||||
2018-11-25 # 2667513bf02e900cc970afbfbdc3c04e WhiteList
|
||||
2018-11-25 # 07111d7470a4d79c6b38f85a7e272d83 WhiteList_new
|
||||
|
@ -1,70 +0,0 @@
|
||||
#!/bin/sh
|
||||
eval `dbus export shadowsocks`
|
||||
eval `dbus export ss`
|
||||
source /jffs/softcenter/scripts/base.sh
|
||||
alias echo_date='echo $(date +%Y年%m月%d日\ %X):'
|
||||
|
||||
kill_socks5(){
|
||||
kill `ps | grep ss-local | grep -v "grep" | grep -v "23456"|awk '{print $1}'` >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# Start ss-local
|
||||
start_socks5(){
|
||||
if [ "$ss_local_obfs_host" != "" ];then
|
||||
if [ "$ss_local_obfs" == "http" ];then
|
||||
ARG_OBFS="obfs=http;obfs-host=$ss_basic_ss_obfs_host"
|
||||
elif [ "$ss_local_obfs" == "tls" ];then
|
||||
ARG_OBFS="obfs=tls;obfs-host=$ss_basic_ss_obfs_host"
|
||||
else
|
||||
ARG_OBFS=""
|
||||
fi
|
||||
else
|
||||
if [ "$ss_local_obfs" == "http" ];then
|
||||
ARG_OBFS="obfs=http"
|
||||
elif [ "$ss_local_obfs" == "tls" ];then
|
||||
ARG_OBFS="obfs=tls"
|
||||
else
|
||||
ARG_OBFS=""
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [ "$ss_local_acl" == "0" ];then
|
||||
ARG_ACL=""
|
||||
elif [ "$ss_local_acl" == "1" ];then
|
||||
ARG_ACL="--acl /jffs/softcenter/ss/socks5/gfwlist.acl"
|
||||
elif [ "$ss_local_acl" == "2" ];then
|
||||
ARG_ACL="--acl /jffs/softcenter/ss/socks5/chn.acl"
|
||||
fi
|
||||
|
||||
echo_date enable ss_local...
|
||||
if [ "$ss_local_obfs" == "0" ];then
|
||||
ss-local -b 0.0.0.0 -s "$ss_local_server" -p "$ss_local_port" -l "$ss_local_proxyport" -k "$ss_local_password" -m "$ss_local_method" -u $ARG_ACL -f /var/run/ss_local.pid
|
||||
else
|
||||
ss-local -b 0.0.0.0 -s "$ss_local_server" -p "$ss_local_port" -l "$ss_local_proxyport" -k "$ss_local_password" -m "$ss_local_method" -u $ARG_ACL --plugin obfs-local --plugin-opts "$ARG_OBFS" -f /var/run/ss_local.pid
|
||||
fi
|
||||
}
|
||||
|
||||
case $ACTION in
|
||||
start)
|
||||
if [ "$ss_local_enable" == "1" ];then
|
||||
start_socks5
|
||||
fi
|
||||
;;
|
||||
stop | kill )
|
||||
kill_socks5
|
||||
;;
|
||||
restart)
|
||||
kill_socks5
|
||||
if [ "$ss_local_enable" == "1" ];then
|
||||
start_socks5
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 (start|stop|restart)"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
|
@ -1,640 +0,0 @@
|
||||
#!/bin/sh
|
||||
#--------------------------------------------------------------------------------------
|
||||
# Variable definitions
|
||||
eval `dbus export ss`
|
||||
source /jffs/softcenter/scripts/base.sh
|
||||
source helper.sh
|
||||
ss_basic_password=`echo $ss_basic_password|base64 -d`
|
||||
CONFIG_FILE=/jffs/softcenter/ss/ss.json
|
||||
DNS_PORT=7913
|
||||
alias echo_date='echo $(date +%Y年%m月%d日\ %X):'
|
||||
ISP_DNS=$(nvram get wan0_dns|sed 's/ /\n/g'|grep -v 0.0.0.0|grep -v 127.0.0.1|sed -n 1p)
|
||||
[ "$ss_dns_china" == "1" ] && [ ! -z "$ISP_DNS" ] && CDN="$ISP_DNS"
|
||||
[ "$ss_dns_china" == "1" ] && [ -z "$ISP_DNS" ] && CDN="114.114.114.114"
|
||||
[ "$ss_dns_china" == "2" ] && CDN="223.5.5.5"
|
||||
[ "$ss_dns_china" == "3" ] && CDN="223.6.6.6"
|
||||
[ "$ss_dns_china" == "4" ] && CDN="114.114.114.114"
|
||||
[ "$ss_dns_china" == "5" ] && CDN="114.114.115.115"
|
||||
[ "$ss_dns_china" == "6" ] && CDN="1.2.4.8"
|
||||
[ "$ss_dns_china" == "7" ] && CDN="210.2.4.8"
|
||||
[ "$ss_dns_china" == "8" ] && CDN="112.124.47.27"
|
||||
[ "$ss_dns_china" == "9" ] && CDN="114.215.126.16"
|
||||
[ "$ss_dns_china" == "10" ] && CDN="180.76.76.76"
|
||||
[ "$ss_dns_china" == "11" ] && CDN="119.29.29.29"
|
||||
[ "$ss_dns_china" == "12" ] && CDN="$ss_dns_china_user"
|
||||
|
||||
# try to resolv the ss server ip if it is domain...
|
||||
resolv_server_ip(){
|
||||
IFIP=`echo $ss_basic_server|grep -E "([0-9]{1,3}[\.]){3}[0-9]{1,3}|:"`
|
||||
if [ -z "$IFIP" ];then
|
||||
echo_date 使用nslookup方式解析SS服务器的ip地址,解析dns:$ss_basic_dnslookup_server
|
||||
if [ "$ss_basic_dnslookup" == "1" ];then
|
||||
server_ip=`nslookup "$ss_basic_server" $ss_basic_dnslookup_server | sed '1,4d' | awk '{print $3}' | grep -v :|awk 'NR==1{print}'`
|
||||
if [ "$?" == "0" ]; then
|
||||
echo_date SS服务器的ip地址解析成功:$server_ip.
|
||||
else
|
||||
echo_date SS服务器域名解析失败!
|
||||
echo_date 尝试用resolveip方式解析...
|
||||
server_ip=`resolveip -4 -t 2 $ss_basic_server|awk 'NR==1{print}'`
|
||||
if [ "$?" == "0" ]; then
|
||||
echo_date SS服务器的ip地址解析成功:$server_ip.
|
||||
else
|
||||
echo_date 使用resolveip方式SS服务器域名解析失败!请更换nslookup解析方式的DNS地址后重试!
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo_date 使用resolveip方式解析SS服务器的ip地址.
|
||||
server_ip=`resolveip -4 -t 2 $ss_basic_server|awk 'NR==1{print}'`
|
||||
fi
|
||||
|
||||
if [ ! -z "$server_ip" ];then
|
||||
ss_basic_server="$server_ip"
|
||||
dbus set ss_basic_server_ip="$server_ip"
|
||||
dbus set ss_basic_dns_success="1"
|
||||
else
|
||||
dbus remvoe ss_basic_server_ip
|
||||
echo_date SS服务器的ip地址解析失败,将由ss-redir自己解析.
|
||||
dbus set ss_basic_dns_success="0"
|
||||
fi
|
||||
else
|
||||
dbus set ss_basic_server_ip=$ss_basic_server
|
||||
echo_date 检测到你的SS服务器已经是IP格式:$ss_basic_server,跳过解析...
|
||||
dbus set ss_basic_dns_success="1"
|
||||
fi
|
||||
}
|
||||
# create shadowsocks config file...
|
||||
creat_ss_json(){
|
||||
if [ "$ss_basic_ss_obfs_host" != "" ];then
|
||||
if [ "$ss_basic_ss_obfs" == "http" ];then
|
||||
ARG_OBFS="obfs=http;obfs-host=$ss_basic_ss_obfs_host"
|
||||
elif [ "$ss_basic_ss_obfs" == "tls" ];then
|
||||
ARG_OBFS="obfs=tls;obfs-host=$ss_basic_ss_obfs_host"
|
||||
else
|
||||
ARG_OBFS=""
|
||||
fi
|
||||
else
|
||||
if [ "$ss_basic_ss_obfs" == "http" ];then
|
||||
ARG_OBFS="obfs=http"
|
||||
elif [ "$ss_basic_ss_obfs" == "tls" ];then
|
||||
ARG_OBFS="obfs=tls"
|
||||
else
|
||||
ARG_OBFS=""
|
||||
fi
|
||||
fi
|
||||
echo_date 创建SS配置文件到$CONFIG_FILE
|
||||
if [ "$ss_basic_use_rss" == "0" ];then
|
||||
cat > $CONFIG_FILE <<-EOF
|
||||
{
|
||||
"server":"$ss_basic_server",
|
||||
"server_port":$ss_basic_port,
|
||||
"local_port":3333,
|
||||
"password":"$ss_basic_password",
|
||||
"timeout":600,
|
||||
"method":"$ss_basic_method"
|
||||
}
|
||||
EOF
|
||||
elif [ "$ss_basic_use_rss" == "1" ];then
|
||||
cat > $CONFIG_FILE <<-EOF
|
||||
{
|
||||
"server":"$ss_basic_server",
|
||||
"server_port":$ss_basic_port,
|
||||
"local_port":3333,
|
||||
"password":"$ss_basic_password",
|
||||
"timeout":600,
|
||||
"protocol":"$ss_basic_rss_protocol",
|
||||
"protocol_param":"$ss_basic_rss_protocol_para",
|
||||
"obfs":"$ss_basic_rss_obfs",
|
||||
"obfs_param":"$ss_basic_rss_obfs_param",
|
||||
"method":"$ss_basic_method"
|
||||
}
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
start_sslocal(){
|
||||
echo_date ┣开启ss-local,为dns2socks提供socks5端口:23456
|
||||
if [ "$ss_basic_use_rss" == "1" ];then
|
||||
rss-local -b 0.0.0.0 -l 23456 -c $CONFIG_FILE -u -f /var/run/sslocal1.pid >/dev/null 2>&1
|
||||
elif [ "$ss_basic_use_rss" == "0" ];then
|
||||
if [ "$ss_basic_ss_obfs" == "0" ];then
|
||||
ss-local -b 0.0.0.0 -l 23456 -c $CONFIG_FILE -u -f /var/run/sslocal1.pid >/dev/null 2>&1
|
||||
else
|
||||
ss-local -b 0.0.0.0 -l 23456 -c $CONFIG_FILE -u --plugin obfs-local --plugin-opts "$ARG_OBFS" -f /var/run/sslocal1.pid >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
start_dns(){
|
||||
# Start DNS2SOCKS
|
||||
if [ "1" == "$ss_dns_foreign" ] || [ -z "$ss_dns_foreign" ]; then
|
||||
# start ss-local on port 23456
|
||||
start_sslocal
|
||||
echo_date 开启dns2socks,监听端口:23456
|
||||
dns2socks 127.0.0.1:23456 "$ss_dns2socks_user" 127.0.0.1:$DNS_PORT > /dev/null 2>&1 &
|
||||
fi
|
||||
|
||||
# Start ss-tunnel
|
||||
[ "$ss_sstunnel" == "1" ] && gs="208.67.220.220:53"
|
||||
[ "$ss_sstunnel" == "2" ] && gs="8.8.8.8:53"
|
||||
[ "$ss_sstunnel" == "3" ] && gs="8.8.4.4:53"
|
||||
[ "$ss_sstunnel" == "4" ] && gs="$ss_sstunnel_user"
|
||||
if [ "2" == "$ss_dns_foreign" ];then
|
||||
if [ "$ss_basic_use_rss" == "1" ];then
|
||||
echo_date 开启ssr-tunnel...
|
||||
rss-tunnel -b 0.0.0.0 -c /jffs/softcenter/ss/ss.json -l $DNS_PORT -L "$gs" -u -f /var/run/sstunnel.pid >/dev/null 2>&1
|
||||
elif [ "$ss_basic_use_rss" == "0" ];then
|
||||
echo_date 开启ss-tunnel...
|
||||
if [ "$ss_basic_ss_obfs" == "0" ];then
|
||||
ss-tunnel -b 0.0.0.0 -s $ss_basic_server -p $ss_basic_port -m $ss_basic_method -k $ss_basic_password -l $DNS_PORT -L "$gs" -u -f /var/run/sstunnel.pid >/dev/null 2>&1
|
||||
else
|
||||
ss-tunnel -b 0.0.0.0 -s $ss_basic_server -p $ss_basic_port -m $ss_basic_method -k $ss_basic_password -l $DNS_PORT -L "$gs" -u --plugin obfs-local --plugin-opts "$ARG_OBFS" -f /var/run/sstunnel.pid >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Start dnscrypt-proxy
|
||||
if [ "3" == "$ss_dns_foreign" ];then
|
||||
echo_date 开启 dnscrypt-proxy,你选择了"$ss_opendns"节点.
|
||||
dnscrypt-proxy --local-address=127.0.0.1:$DNS_PORT --daemonize -L /jffs/softcenter/ss/rules/dnscrypt-resolvers.csv -R $ss_opendns >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
# Start pdnsd
|
||||
if [ "4" == "$ss_dns_foreign" ]; then
|
||||
echo_date 开启 pdnsd,pdnsd进程可能会不稳定,请自己斟酌.
|
||||
echo_date 创建/jffs/softcenter/ss/pdnsd文件夹.
|
||||
mkdir -p /jffs/softcenter/ss/pdnsd
|
||||
if [ "$ss_pdnsd_method" == "1" ];then
|
||||
echo_date 创建pdnsd配置文件到/tmp/var/etc/pdnsd.conf
|
||||
echo_date 你选择了-仅udp查询-,需要开启上游dns服务,以防止dns污染.
|
||||
cat > /tmp/var/etc/pdnsd.conf <<-EOF
|
||||
global {
|
||||
perm_cache=2048;
|
||||
cache_dir="/tmp/var/etc/";
|
||||
run_as="nobody";
|
||||
server_port = $DNS_PORT;
|
||||
server_ip = 127.0.0.1;
|
||||
status_ctl = on;
|
||||
query_method=udp_only;
|
||||
min_ttl=$ss_pdnsd_server_cache_min;
|
||||
max_ttl=$ss_pdnsd_server_cache_max;
|
||||
timeout=10;
|
||||
}
|
||||
|
||||
server {
|
||||
label= "BLUECAVE";
|
||||
ip = 127.0.0.1;
|
||||
port = 1099;
|
||||
root_server = on;
|
||||
uptest = none;
|
||||
}
|
||||
EOF
|
||||
if [ "$ss_pdnsd_udp_server" == "1" ];then
|
||||
echo_date 开启dns2socks作为pdnsd的上游服务器.
|
||||
start_sslocal
|
||||
dns2socks 127.0.0.1:23456 "$ss_pdnsd_udp_server_dns2socks" 127.0.0.1:1099 > /dev/null 2>&1 &
|
||||
elif [ "$ss_pdnsd_udp_server" == "2" ];then
|
||||
echo_date 开启dnscrypt-proxy作为pdnsd的上游服务器.
|
||||
dnscrypt-proxy --local-address=127.0.0.1:1099 --daemonize -L /jffs/softcenter/ss/rules/dnscrypt-resolvers.csv -R "$ss_pdnsd_udp_server_dnscrypt"
|
||||
elif [ "$ss_pdnsd_udp_server" == "3" ];then
|
||||
[ "$ss_pdnsd_udp_server_ss_tunnel" == "1" ] && dns1="208.67.220.220:53"
|
||||
[ "$ss_pdnsd_udp_server_ss_tunnel" == "2" ] && dns1="8.8.8.8:53"
|
||||
[ "$ss_pdnsd_udp_server_ss_tunnel" == "3" ] && dns1="8.8.4.4:53"
|
||||
[ "$ss_pdnsd_udp_server_ss_tunnel" == "4" ] && dns1="$ss_pdnsd_udp_server_ss_tunnel_user"
|
||||
if [ "$ss_basic_use_rss" == "1" ];then
|
||||
echo_date 开启ssr-tunnel作为pdnsd的上游服务器.
|
||||
rss-tunnel -b 0.0.0.0 -c /jffs/softcenter/ss/ss.json -l 1099 -L "$dns1" -u -f /var/run/sstunnel.pid >/dev/null 2>&1
|
||||
elif [ "$ss_basic_use_rss" == "0" ];then
|
||||
echo_date 开启ss-tunnel作为pdnsd的上游服务器.
|
||||
if [ "$ss_basic_ss_obfs" == "0" ];then
|
||||
ss-tunnel -b 0.0.0.0 -s $ss_basic_server -p $ss_basic_port -m $ss_basic_method -k $ss_basic_password -l $DNS_PORT -L "$dns1" -u -f /var/run/sstunnel.pid >/dev/null 2>&1
|
||||
else
|
||||
ss-tunnel -b 0.0.0.0 -s $ss_basic_server -p $ss_basic_port -m $ss_basic_method -k $ss_basic_password -l $DNS_PORT -L "$dns1" -u --plugin obfs-local --plugin-opts "$ARG_OBFS" -f /var/run/sstunnel.pid >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
elif [ "$ss_pdnsd_method" == "2" ];then
|
||||
echo_date 创建pdnsd配置文件到/tmp/var/etc/pdnsd.conf
|
||||
echo_date 你选择了-仅tcp查询-,使用"$ss_pdnsd_server_ip":"$ss_pdnsd_server_port"进行tcp查询.
|
||||
cat > /tmp/var/etc/pdnsd.conf <<-EOF
|
||||
global {
|
||||
perm_cache=2048;
|
||||
cache_dir="/tmp/var/etc/";
|
||||
run_as="nobody";
|
||||
server_port = $DNS_PORT;
|
||||
server_ip = 127.0.0.1;
|
||||
status_ctl = on;
|
||||
query_method=tcp_only;
|
||||
min_ttl=$ss_pdnsd_server_cache_min;
|
||||
max_ttl=$ss_pdnsd_server_cache_max;
|
||||
timeout=10;
|
||||
}
|
||||
|
||||
server {
|
||||
label= "BLUECAVE";
|
||||
ip = $ss_pdnsd_server_ip;
|
||||
port = $ss_pdnsd_server_port;
|
||||
root_server = on;
|
||||
uptest = none;
|
||||
}
|
||||
EOF
|
||||
fi
|
||||
|
||||
chmod 644 /tmp/var/etc/pdnsd.conf
|
||||
CACHEDIR=/tmp/var/etc
|
||||
CACHE=/tmp/var/etc/pdnsd.cache
|
||||
USER=nobody
|
||||
GROUP=nogroup
|
||||
|
||||
if ! test -f "$CACHE"; then
|
||||
echo_date 创建pdnsd缓存文件.
|
||||
dd if=/dev/zero of=/tmp/var/etc/pdnsd.cache bs=1 count=4 2> /dev/null
|
||||
chown -R $USER.$GROUP $CACHEDIR 2> /dev/null
|
||||
fi
|
||||
|
||||
echo_date 启动pdnsd进程...
|
||||
pdnsd --daemon -c /tmp/var/etc/pdnsd.conf -p /var/run/pdnsd.pid
|
||||
fi
|
||||
|
||||
# Start chinadns
|
||||
if [ "5" == "$ss_dns_foreign" ];then
|
||||
echo_date ┏你选择了chinaDNS作为解析方案!
|
||||
[ "$ss_chinadns_china" == "1" ] && rcc="223.5.5.5"
|
||||
[ "$ss_chinadns_china" == "2" ] && rcc="223.6.6.6"
|
||||
[ "$ss_chinadns_china" == "3" ] && rcc="114.114.114.114"
|
||||
[ "$ss_chinadns_china" == "4" ] && rcc="114.114.115.115"
|
||||
[ "$ss_chinadns_china" == "5" ] && rcc="1.2.4.8"
|
||||
[ "$ss_chinadns_china" == "6" ] && rcc="210.2.4.8"
|
||||
[ "$ss_chinadns_china" == "7" ] && rcc="112.124.47.27"
|
||||
[ "$ss_chinadns_china" == "8" ] && rcc="114.215.126.16"
|
||||
[ "$ss_chinadns_china" == "9" ] && rcc="180.76.76.76"
|
||||
[ "$ss_chinadns_china" == "10" ] && rcc="119.29.29.29"
|
||||
[ "$ss_chinadns_china" == "11" ] && rcc="$ss_chinadns_china_user"
|
||||
|
||||
if [ "$ss_chinadns_foreign_method" == "1" ];then
|
||||
[ "$ss_chinadns_foreign_dns2socks" == "1" ] && rcfd="208.67.220.220:53"
|
||||
[ "$ss_chinadns_foreign_dns2socks" == "2" ] && rcfd="8.8.8.8:53"
|
||||
[ "$ss_chinadns_foreign_dns2socks" == "3" ] && rcfd="8.8.4.4:53"
|
||||
[ "$ss_chinadns_foreign_dns2socks" == "4" ] && rcfd="$ss_chinadns_foreign_dns2socks_user"
|
||||
|
||||
start_sslocal
|
||||
echo_date ┣开启dns2socks,作为chinaDNS上游国外dns,转发dns:$rcfd
|
||||
dns2socks 127.0.0.1:23456 "$rcfd" 127.0.0.1:1055 > /dev/null 2>&1 &
|
||||
elif [ "$ss_chinadns_foreign_method" == "2" ];then
|
||||
echo_date ┣开启 dnscrypt-proxy,作为chinaDNS上游国外dns,你选择了"$ss_chinadns_foreign_dnscrypt"节点.
|
||||
dnscrypt-proxy --local-address=127.0.0.1:1055 --daemonize -L /jffs/softcenter/ss/rules/dnscrypt-resolvers.csv -R $ss_chinadns_foreign_dnscrypt >/dev/null 2>&1
|
||||
elif [ "$ss_chinadns_foreign_method" == "3" ];then
|
||||
[ "$ss_chinadns_foreign_sstunnel" == "1" ] && rcfs="208.67.220.220:53"
|
||||
[ "$ss_chinadns_foreign_sstunnel" == "2" ] && rcfs="8.8.8.8:53"
|
||||
[ "$ss_chinadns_foreign_sstunnel" == "3" ] && rcfs="8.8.4.4:53"
|
||||
[ "$ss_chinadns_foreign_sstunnel" == "4" ] && rcfs="$ss_chinadns_foreign_sstunnel_user"
|
||||
if [ "$ss_basic_use_rss" == "1" ];then
|
||||
echo_date ┣开启ssr-tunnel,作为chinaDNS上游国外dns,转发dns:$rcfs
|
||||
rss-tunnel -b 127.0.0.1 -c /jffs/softcenter/ss/ss.json -l 1055 -L "$rcfs" -u -f /var/run/sstunnel.pid >/dev/null 2>&1
|
||||
elif [ "$ss_basic_use_rss" == "0" ];then
|
||||
echo_date ┣开启ss-tunnel,作为chinaDNS上游国外dns,转发dns:$rcfs
|
||||
if [ "$ss_basic_ss_obfs" == "0" ];then
|
||||
ss-tunnel -b 0.0.0.0 -s $ss_basic_server -p $ss_basic_port -m $ss_basic_method -k $ss_basic_password -l 1055 -L "$rcfs" -u -f /var/run/sstunnel.pid
|
||||
else
|
||||
ss-tunnel -b 0.0.0.0 -s $ss_basic_server -p $ss_basic_port -m $ss_basic_method -k $ss_basic_password -l 1055 -L "$rcfs" -u --plugin obfs-local --plugin-opts "$ARG_OBFS" -f /var/run/sstunnel.pid >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
elif [ "$ss_chinadns_foreign_method" == "4" ];then
|
||||
echo_date ┣你选择了自定义chinadns国外dns!dns:$ss_chinadns_foreign_method_user
|
||||
fi
|
||||
echo_date ┗开启chinadns进程!
|
||||
chinadns -p $DNS_PORT -s "$rcc",127.0.0.1:1055 -m -d -c /jffs/softcenter/ss/rules/chnroute.txt >/dev/null 2>&1 &
|
||||
fi
|
||||
}
|
||||
#--------------------------------------------------------------------------------------
|
||||
load_cdn_site(){
|
||||
# append china site
|
||||
rm -rf /tmp/etc/dnsmasq.user/sscdn.conf
|
||||
|
||||
|
||||
if [ "$ss_dns_plan" == "2" ] && [ "$ss_dns_foreign" != "5" ] && [ "$ss_dns_foreign" != "6" ];then
|
||||
echo_date 生成cdn加速列表到/tmp/etc/dnsmasq.user/sscdn.conf,加速用的dns:$CDN
|
||||
echo "#for china site CDN acclerate" >> /tmp/etc/dnsmasq.user/sscdn.conf
|
||||
cat /jffs/softcenter/ss/rules/cdn.txt | sed "s/^/server=&\/./g" | sed "s/$/\/&$CDN/g" | sort | awk '{if ($0!=line) print;line=$0}' >>/tmp/etc/dnsmasq.user/sscdn.conf
|
||||
fi
|
||||
|
||||
# append user defined china site
|
||||
if [ ! -z "$ss_isp_website_web" ];then
|
||||
cdnsites=$(echo $ss_isp_website_web | base64 -d)
|
||||
echo_date 生成自定义cdn加速域名到/tmp/etc/dnsmasq.user/sscdn.conf
|
||||
echo "#for user defined china site CDN acclerate" >> /tmp/etc/dnsmasq.user/sscdn.conf
|
||||
for cdnsite in $cdnsites
|
||||
do
|
||||
echo "$cdnsite" | sed "s/^/server=&\/./g" | sed "s/$/\/&$CDN/g" >> /tmp/etc/dnsmasq.user/sscdn.conf
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
custom_dnsmasq(){
|
||||
rm -rf /tmp/etc/dnsmasq.user/custom.conf
|
||||
if [ ! -z "$ss_dnsmasq" ];then
|
||||
echo_date 添加自定义dnsmasq设置到/tmp/etc/dnsmasq.user/custom.conf
|
||||
echo "$ss_dnsmasq" | base64 -d | sort -u >> /tmp/etc/dnsmasq.user/custom.conf
|
||||
fi
|
||||
}
|
||||
|
||||
append_white_black_conf(){
|
||||
# append white domain list, bypass ss
|
||||
rm -rf /tmp/etc/dnsmasq.user/wblist.conf
|
||||
# github need to go ss
|
||||
if [ "$ss_basic_mode" != "6" ];then
|
||||
echo "#for router itself" >> /tmp/etc/dnsmasq.user/wblist.conf
|
||||
echo "server=/.google.com.tw/127.0.0.1#7913" >> /tmp/etc/dnsmasq.user/wblist.conf
|
||||
echo "ipset=/.google.com.tw/router" >> /tmp/etc/dnsmasq.user/wblist.conf
|
||||
echo "server=/.github.com/127.0.0.1#7913" >> /tmp/etc/dnsmasq.user/wblist.conf
|
||||
echo "ipset=/.github.com/router" >> /tmp/etc/dnsmasq.user/wblist.conf
|
||||
echo "server=/.github.io/127.0.0.1#7913" >> /tmp/etc/dnsmasq.user/wblist.conf
|
||||
echo "ipset=/.github.io/router" >> /tmp/etc/dnsmasq.user/wblist.conf
|
||||
echo "server=/.raw.githubusercontent.com/127.0.0.1#7913" >> /tmp/etc/dnsmasq.user/wblist.conf
|
||||
echo "ipset=/.raw.githubusercontent.com/router" >> /tmp/etc/dnsmasq.user/wblist.conf
|
||||
echo "server=/.adblockplus.org/127.0.0.1#7913" >> /tmp/etc/dnsmasq.user/wblist.conf
|
||||
echo "ipset=/.adblockplus.org/router" >> /tmp/etc/dnsmasq.user/wblist.conf
|
||||
fi
|
||||
# append white domain list,not through ss
|
||||
wanwhitedomain=$(echo $ss_wan_white_domain | base64 -d)
|
||||
if [ ! -z $ss_wan_white_domain ];then
|
||||
echo_date 应用域名白名单
|
||||
echo "#for white_domain" >> /tmp/etc/dnsmasq.user/wblist.conf
|
||||
for wan_white_domain in $wanwhitedomain
|
||||
do
|
||||
echo "$wan_white_domain" | sed "s/^/server=&\/./g" | sed "s/$/\/127.0.0.1#7913/g" >> /tmp/etc/dnsmasq.user/wblist.conf
|
||||
echo "$wan_white_domain" | sed "s/^/ipset=&\/./g" | sed "s/$/\/white_ip/g" >> /tmp/etc/dnsmasq.user/wblist.conf
|
||||
done
|
||||
fi
|
||||
|
||||
# apple 和microsoft不能走ss
|
||||
echo "#for special site" >> /tmp/etc/dnsmasq.user/wblist.conf
|
||||
for wan_white_domain2 in "apple.com" "microsoft.com"
|
||||
do
|
||||
echo "$wan_white_domain2" | sed "s/^/server=&\/./g" | sed "s/$/\/$CDN#53/g" >> /tmp/etc/dnsmasq.user/wblist.conf
|
||||
echo "$wan_white_domain2" | sed "s/^/ipset=&\/./g" | sed "s/$/\/white_ip/g" >> /tmp/etc/dnsmasq.user/wblist.conf
|
||||
done
|
||||
|
||||
# append black domain list,through ss
|
||||
wanblackdomain=$(echo $ss_wan_black_domain | base64 -d)
|
||||
if [ ! -z $ss_wan_black_domain ];then
|
||||
echo_date 应用域名黑名单
|
||||
echo "#for black_domain" >> /tmp/etc/dnsmasq.user/wblist.conf
|
||||
for wan_black_domain in $wanblackdomain
|
||||
do
|
||||
echo "$wan_black_domain" | sed "s/^/server=&\/./g" | sed "s/$/\/127.0.0.1#7913/g" >> /tmp/etc/dnsmasq.user/wblist.conf
|
||||
echo "$wan_black_domain" | sed "s/^/ipset=&\/./g" | sed "s/$/\/black_ip/g" >> /tmp/etc/dnsmasq.user/wblist.conf
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
ln_conf(){
|
||||
|
||||
gfw_on=`dbus list ss_acl_mode_|cut -d "=" -f 2 | grep 1`
|
||||
rm -rf /tmp/etc/dnsmasq.user/gfwlist.conf
|
||||
if [ "$ss_basic_mode" == "1" ];then
|
||||
echo_date 创建gfwlist的软连接到/jffs/etc/dnsmasq.d/文件夹.
|
||||
ln -sf /jffs/softcenter/ss/rules/gfwlist.conf /tmp/etc/dnsmasq.user/gfwlist.conf
|
||||
elif [ "$ss_basic_mode" == "2" ] || [ "$ss_basic_mode" == "3" ];then
|
||||
if [ ! -f /tmp/etc/dnsmasq.user/gfwlist.conf ] && [ "$ss_dns_plan" == "1" ] || [ -n "$gfw_on" ];then
|
||||
echo_date 创建gfwlist的软连接到/tmp/etc/dnsmasq.user/文件夹.
|
||||
ln -sf /jffs/softcenter/ss/rules/gfwlist.conf /tmp/etc/dnsmasq.user/gfwlist.conf
|
||||
fi
|
||||
fi
|
||||
#echo_date 创建dnsmasq.postconf软连接到/jffs/scripts/文件夹.
|
||||
rm -rf /jffs/scripts/dnsmasq.postconf
|
||||
ln -sf /koolshare/ss/rules/dnsmasq.postconf /jffs/scripts/dnsmasq.postconf
|
||||
}
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------------
|
||||
nat_auto_start(){
|
||||
mkdir -p /jffs/scripts
|
||||
# creating iptables rules to nat-start
|
||||
if [ ! -f /jffs/scripts/nat-start ]; then
|
||||
cat > /jffs/scripts/nat-start <<-EOF
|
||||
#!/bin/sh
|
||||
dbus fire onnatstart
|
||||
|
||||
EOF
|
||||
fi
|
||||
|
||||
writenat=$(cat /jffs/scripts/nat-start | grep "nat-start")
|
||||
if [ -z "$writenat" ];then
|
||||
echo_date 添加nat-start触发事件...用于ss的nat规则重启后或网络恢复后的加载.
|
||||
[ $ss_basic_sleep -ne 0 ] && \
|
||||
sed -i "2a sleep $ss_basic_sleep" /jffs/scripts/nat-start
|
||||
[ $ss_basic_sleep -ne 0 ] && \
|
||||
sed -i '3a sh /jffs/softcenter/ss/nat-start.sh start_all' /jffs/scripts/nat-start || \
|
||||
sed -i '2a sh /jffs/softcenter/ss/nat-start.sh start_all' /jffs/scripts/nat-start
|
||||
chmod +x /jffs/scripts/nat-start
|
||||
fi
|
||||
}
|
||||
#--------------------------------------------------------------------------------------
|
||||
wan_auto_start(){
|
||||
# Add service to auto start
|
||||
if [ ! -f /jffs/scripts/wan-start ]; then
|
||||
cat > /jffs/scripts/wan-start <<-EOF
|
||||
#!/bin/sh
|
||||
dbus fire onwanstart
|
||||
|
||||
EOF
|
||||
fi
|
||||
|
||||
startss=$(cat /jffs/scripts/wan-start | grep "/jffs/softcenter/scripts/ss_config.sh")
|
||||
if [ -z "$startss" ];then
|
||||
echo_date 添加wan-start触发事件...用于ss的各种程序的开机启动,启动延迟$ss_basic_sleep
|
||||
[ $ss_basic_sleep -ne 0 ] && \
|
||||
sed -i "2a sleep $ss_basic_sleep" /jffs/scripts/wan-start
|
||||
[ $ss_basic_sleep -ne 0 ] && \
|
||||
sed -i '3a sh /jffs/softcenter/scripts/ss_config.sh' /jffs/scripts/wan-start || \
|
||||
sed -i '2a sh /jffs/softcenter/scripts/ss_config.sh' /jffs/scripts/wan-start
|
||||
fi
|
||||
chmod +x /jffs/scripts/wan-start
|
||||
}
|
||||
|
||||
#=======================================================================================
|
||||
|
||||
start_ss_redir(){
|
||||
# Start ss-redir
|
||||
if [ "$ss_basic_use_rss" == "1" ];then
|
||||
echo_date 开启ssr-redir进程,用于透明代理.
|
||||
rss-redir -b 0.0.0.0 -c $CONFIG_FILE -f /var/run/shadowsocks.pid >/dev/null 2>&1
|
||||
elif [ "$ss_basic_use_rss" == "0" ];then
|
||||
echo_date 开启ss-redir进程,用于透明代理.
|
||||
if [ "$ss_basic_ss_obfs" == "0" ];then
|
||||
ss-redir -b 0.0.0.0 -c $CONFIG_FILE -f /var/run/shadowsocks.pid >/dev/null 2>&1
|
||||
else
|
||||
ss-redir -b 0.0.0.0 -c $CONFIG_FILE --plugin obfs-local --plugin-opts "$ARG_OBFS" -f /var/run/shadowsocks.pid >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
write_cron_job(){
|
||||
if [ "1" == "$ss_basic_rule_update" ]; then
|
||||
echo_date 添加ss规则定时更新任务,每天"$ss_basic_rule_update_time"自动检测更新规则.
|
||||
cru a ssupdate "0 $ss_basic_rule_update_time * * * /bin/sh /jffs/softcenter/scripts/ss_rule_update.sh"
|
||||
else
|
||||
echo_date ss规则定时更新任务未启用!
|
||||
fi
|
||||
}
|
||||
|
||||
kill_cron_job(){
|
||||
jobexist=`cru l|grep ssupdate`
|
||||
if [ ! -z "$jobexist" ];then
|
||||
echo_date 删除ss规则定时更新任务.
|
||||
sed -i '/ssupdate/d' /var/spool/cron/crontabs/* >/dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
stop_dns(){
|
||||
dnscrypt=$(ps | grep "dnscrypt-proxy" | grep -v "grep")
|
||||
pdnsd=$(ps | grep "pdnsd" | grep -v "grep")
|
||||
chinadns=$(ps | grep "chinadns" | grep -v "grep")
|
||||
DNS2SOCK=$(ps | grep "dns2socks" | grep -v "grep")
|
||||
Pcap_DNSProxy=$(ps | grep "Pcap_DNSProxy" | grep -v "grep")
|
||||
PID_DNS_SH=$(ps |grep "/jffs/softcenter/ss/dns/dns.sh" | grep -v "grep" |awk '{print $1}')
|
||||
sstunnel=$(ps | grep "ss-tunnel" | grep -v "grep" | grep -vw "rss-tunnel")
|
||||
rsstunnel=$(ps | grep "rss-tunnel" | grep -v "grep" | grep -vw "ss-tunnel")
|
||||
# kill dnscrypt-proxy
|
||||
if [ ! -z "$dnscrypt" ]; then
|
||||
echo_date 关闭dnscrypt-proxy进程...
|
||||
killall dnscrypt-proxy
|
||||
fi
|
||||
# kill ss-tunnel
|
||||
if [ ! -z "$sstunnel" ]; then
|
||||
echo_date 关闭ss-tunnel进程...
|
||||
killall ss-tunnel >/dev/null 2>&1
|
||||
fi
|
||||
if [ ! -z "$rsstunnel" ]; then
|
||||
echo_date 关闭rss-tunnel进程...
|
||||
killall rss-tunnel >/dev/null 2>&1
|
||||
fi
|
||||
# kill pdnsd
|
||||
if [ ! -z "$pdnsd" ]; then
|
||||
echo_date 关闭pdnsd进程...
|
||||
killall pdnsd
|
||||
fi
|
||||
# kill chinadns
|
||||
if [ ! -z "$chinadns" ]; then
|
||||
echo_date 关闭chinadns进程...
|
||||
killall chinadns
|
||||
fi
|
||||
# kill dns2socks
|
||||
if [ ! -z "$DNS2SOCK" ]; then
|
||||
echo_date 关闭dns2socks进程...
|
||||
killall dns2socks
|
||||
fi
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------------------------------------
|
||||
|
||||
load_nat(){
|
||||
nat_ready=$(iptables -t nat -L PREROUTING -v -n --line-numbers|grep -v PREROUTING|grep -v destination)
|
||||
i=120
|
||||
until [ -n "$nat_ready" ]
|
||||
do
|
||||
i=$(($i-1))
|
||||
if [ "$i" -lt 1 ];then
|
||||
echo_date "错误:不能正确加载nat规则!"
|
||||
sh /jffs/softcenter/ss/stop.sh stop_all
|
||||
exit
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
echo_date "加载nat规则!"
|
||||
sh /jffs/softcenter/ss/nat-start.sh start_all
|
||||
}
|
||||
|
||||
restart_dnsmasq(){
|
||||
# Restart dnsmasq
|
||||
echo_date 重启dnsmasq服务...
|
||||
/sbin/service restart_dnsmasq >/dev/null 2>&1
|
||||
}
|
||||
|
||||
remove_status(){
|
||||
nvram set ss_foreign_state=""
|
||||
nvram set ss_china_state=""
|
||||
}
|
||||
|
||||
main_portal(){
|
||||
if [ "$ss_main_portal" == "1" ];then
|
||||
nvram set enable_ss=1
|
||||
nvram commit
|
||||
else
|
||||
nvram set enable_ss=0
|
||||
nvram commit
|
||||
fi
|
||||
}
|
||||
|
||||
load_module(){
|
||||
xt=`lsmod | grep xt_set`
|
||||
OS=$(uname -r)
|
||||
if [ -f /lib/modules/${OS}/kernel/net/netfilter/xt_set.ko ] && [ -z "$xt" ];then
|
||||
echo_date "加载xt_set.ko内核模块!"
|
||||
insmod /lib/modules/${OS}/kernel/net/netfilter/xt_set.ko
|
||||
fi
|
||||
}
|
||||
|
||||
restart_addon(){
|
||||
#ss_basic_action=4
|
||||
echo_date ----------------------------- 重启附加功能 -----------------------------
|
||||
# for sleep walue in start up files
|
||||
old_sleep=`cat /jffs/scripts/nat-start | grep sleep | awk '{print $2}'`
|
||||
new_sleep="$ss_basic_sleep"
|
||||
if [ "$old_sleep" = "$new_sleep" ];then
|
||||
echo_date 开机延迟时间未改变,仍然是"$ss_basic_sleep"秒.
|
||||
else
|
||||
echo_date 设置"$ss_basic_sleep"秒开机延迟...
|
||||
# delete boot delay in nat-start and wan-start
|
||||
sed -i '/jffs/softcenter/d' /jffs/scripts/nat-start >/dev/null 2>&1
|
||||
sed -i '/sleep/d' /jffs/scripts/nat-start >/dev/null 2>&1
|
||||
sed -i '/jffs/softcenter/d' /jffs/scripts/wan-start >/dev/null 2>&1
|
||||
sed -i '/sleep/d' /jffs/scripts/wan-start >/dev/null 2>&1
|
||||
# re add delay in nat-start and wan-start
|
||||
nat_auto_start >/dev/null 2>&1
|
||||
wan_auto_start >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
#remove_status
|
||||
remove_status
|
||||
main_portal
|
||||
|
||||
if [ "$ss_basic_dnslookup" == "1" ];then
|
||||
echo_date 设置使用nslookup方式解析SS服务器的ip地址.
|
||||
else
|
||||
echo_date 设置使用resolveip方式解析SS服务器的ip地址.
|
||||
fi
|
||||
echo_date -------------------------- 附加功能重启完毕! ---------------------------
|
||||
}
|
||||
|
||||
|
||||
case $1 in
|
||||
start_all)
|
||||
#ss_basic_action=1
|
||||
echo_date ------------------------- 梅林固件 shadowsocks --------------------------
|
||||
resolv_server_ip
|
||||
creat_ss_json
|
||||
#creat_dnsmasq_basic_conf
|
||||
load_cdn_site
|
||||
custom_dnsmasq
|
||||
append_white_black_conf && ln_conf
|
||||
nat_auto_start
|
||||
wan_auto_start
|
||||
write_cron_job
|
||||
start_dns
|
||||
start_ss_redir
|
||||
load_module
|
||||
load_nat
|
||||
restart_dnsmasq
|
||||
remove_status
|
||||
nvram set ss_mode=2
|
||||
nvram commit
|
||||
echo_date ------------------------- shadowsocks 启动完毕 -------------------------
|
||||
[ "$ss_basic_action" == "4" ] && restart_addon
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 (start_all)"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
@ -1,241 +0,0 @@
|
||||
#!/bin/sh
|
||||
#--------------------------------------------------------------------------
|
||||
# Variable definitions
|
||||
# source /jffs/softcenter/configs/ss.sh
|
||||
eval `dbus export shadowsocks`
|
||||
eval `dbus export ss`
|
||||
alias echo_date='echo $(date +%Y年%m月%d日\ %X):'
|
||||
redsocks2=$(ps | grep "redsocks2" | grep -v "grep")
|
||||
dnscrypt=$(ps | grep "dnscrypt-proxy" | grep -v "grep")
|
||||
sokcs5=$(ps|grep ss-local|grep -vw rss-local|grep -v 23456|cut -d " " -f 1)
|
||||
ssredir=$(ps | grep "ss-redir" | grep -v "grep" | grep -vw "rss-redir")
|
||||
rssredir=$(ps | grep "rss-redir" | grep -v "grep" | grep -vw "ss-redir")
|
||||
sstunnel=$(ps | grep "ss-tunnel" | grep -v "grep" | grep -vw "rss-tunnel")
|
||||
rsstunnel=$(ps | grep "rss-tunnel" | grep -v "grep" | grep -vw "ss-tunnel")
|
||||
pdnsd=$(ps | grep "pdnsd" | grep -v "grep")
|
||||
chinadns=$(ps | grep "chinadns" | grep -v "grep")
|
||||
DNS2SOCK=$(ps | grep "dns2socks" | grep -v "grep")
|
||||
client_linux_mips=$(ps | grep "client_linux_mips" | grep -v "grep")
|
||||
haproxy=$(ps | grep "haproxy" | grep -v "grep")
|
||||
obfsLocal=$(ps | grep "obfs-local" | grep -v "grep")
|
||||
lan_ipaddr=$(nvram get lan_ipaddr)
|
||||
ip_rule_exist=`/usr/sbin/ip rule show | grep "fwmark 0x1/0x1 lookup 310" | grep -c 310`
|
||||
nvram set ss_mode=0
|
||||
dbus set dns2socks=0
|
||||
nvram commit
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
|
||||
restore_conf(){
|
||||
# delete dnsmasq postconf file
|
||||
if [ -f /jffs/scripts/dnsmasq.postconf ]; then
|
||||
echo_date 删除/jffs/scripts/dnsmasq.postconf
|
||||
rm -f /jffs/scripts/dnsmasq.postconf
|
||||
fi
|
||||
# delete custom.conf
|
||||
if [ -f /tmp/etc/dnsmasq.user/custom.conf ];then
|
||||
echo_date 删除 /tmp/etc/dnsmasq.user/custom.conf
|
||||
rm -rf /tmp/etc/dnsmasq.user/custom.conf
|
||||
fi
|
||||
}
|
||||
|
||||
bring_up_dnsmasq(){
|
||||
# Bring up dnsmasq
|
||||
echo_date 重启dnsmasq服务...
|
||||
service restart_dnsmasq >/dev/null 2>&1
|
||||
}
|
||||
|
||||
restore_nat(){
|
||||
echo_date 尝试先清除已存在的iptables规则,防止重复添加
|
||||
# flush rules and set if any
|
||||
iptables -t nat -D PREROUTING -p tcp -j SHADOWSOCKS >/dev/null 2>&1
|
||||
sleep 1
|
||||
iptables -t nat -F SHADOWSOCKS > /dev/null 2>&1 && iptables -t nat -X SHADOWSOCKS > /dev/null 2>&1
|
||||
iptables -t nat -F SHADOWSOCKS_GFW > /dev/null 2>&1 && iptables -t nat -X SHADOWSOCKS_GFW > /dev/null 2>&1
|
||||
iptables -t nat -F SHADOWSOCKS_CHN > /dev/null 2>&1 && iptables -t nat -X SHADOWSOCKS_CHN > /dev/null 2>&1
|
||||
iptables -t nat -F SHADOWSOCKS_GLO > /dev/null 2>&1 && iptables -t nat -X SHADOWSOCKS_GLO > /dev/null 2>&1
|
||||
iptables -t nat -F SHADOWSOCKS_HOM > /dev/null 2>&1 && iptables -t nat -X SHADOWSOCKS_HOM > /dev/null 2>&1
|
||||
iptables -t nat -D OUTPUT -p tcp -m set --set router dst -j REDIRECT --to-ports 3333 >/dev/null 2>&1
|
||||
iptables -t nat -D PREROUTING -p udp --dport 53 -j DNAT --to $lan_ipaddr >/dev/null 2>&1
|
||||
|
||||
#ip route del local 0.0.0.0/0 dev lo table 300 >/dev/null 2>&1
|
||||
/usr/sbin/ip route del local 0.0.0.0/0 dev lo table 310 >/dev/null 2>&1
|
||||
|
||||
|
||||
|
||||
if [ ! -z "ip_rule_exist" ];then
|
||||
until [ "$ip_rule_exist" = 0 ]
|
||||
do
|
||||
#ip rule del fwmark 0x01/0x01 table 310
|
||||
/usr/sbin/ip rule del fwmark 0x01/0x01 table 310 pref 789
|
||||
ip_rule_exist=`expr $ip_rule_exist - 1`
|
||||
done
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
destory_ipset(){
|
||||
# flush and destory ipset
|
||||
ipset -F router >/dev/null 2>&1
|
||||
ipset -F chnroute >/dev/null 2>&1
|
||||
ipset -F white_ip >/dev/null 2>&1
|
||||
ipset -F white_cidr >/dev/null 2>&1
|
||||
ipset -F black_ip >/dev/null 2>&1
|
||||
ipset -F black_cidr >/dev/null 2>&1
|
||||
ipset -F gfwlist >/dev/null 2>&1
|
||||
|
||||
ipset -X router >/dev/null 2>&1
|
||||
ipset -X chnroute >/dev/null 2>&1
|
||||
ipset -X white_ip >/dev/null 2>&1
|
||||
ipset -X white_cidr >/dev/null 2>&1
|
||||
ipset -X black_ip >/dev/null 2>&1
|
||||
ipset -X black_cidr >/dev/null 2>&1
|
||||
ipset -X gfwlist >/dev/null 2>&1
|
||||
}
|
||||
|
||||
restore_start_file(){
|
||||
echo_date 清除nat-start, wan-start中相关的SS启动命令...
|
||||
|
||||
# restore nat-start file if any
|
||||
sed -i '/source/,/warning/d' /jffs/scripts/nat-start >/dev/null 2>&1
|
||||
sed -i '/nat-start/d' /jffs/scripts/nat-start >/dev/null 2>&1
|
||||
sed -i '/jffs/softcenter/d' /jffs/scripts/nat-start >/dev/null 2>&1
|
||||
sed -i '/sleep 5/d' /jffs/scripts/nat-start >/dev/null 2>&1
|
||||
|
||||
# clear start up command line in wan-start
|
||||
sed -i '/start.sh/d' /jffs/scripts/wan-start >/dev/null 2>&1
|
||||
sed -i '/ssconfig/d' /jffs/scripts/wan-start >/dev/null 2>&1
|
||||
sed -i '/jffs/softcenter/d' /jffs/scripts/wan-start >/dev/null 2>&1
|
||||
sed -i '/sleep/d' /jffs/scripts/wan-start >/dev/null 2>&1
|
||||
sed -i '/sleep/d' /jffs/scripts/nat-start >/dev/null 2>&1
|
||||
}
|
||||
|
||||
kill_process(){
|
||||
#--------------------------------------------------------------------------
|
||||
# kill dnscrypt-proxy
|
||||
if [ ! -z "$dnscrypt" ]; then
|
||||
echo_date 关闭dnscrypt-proxy进程...
|
||||
killall dnscrypt-proxy
|
||||
fi
|
||||
#--------------------------------------------------------------------------
|
||||
# kill redsocks2
|
||||
if [ ! -z "$redsocks2" ]; then
|
||||
echo_date 关闭redsocks2进程...
|
||||
killall redsocks2
|
||||
fi
|
||||
#--------------------------------------------------------------------------
|
||||
# kill ss-redir
|
||||
if [ ! -z "$ssredir" ];then
|
||||
echo_date 关闭ss-redir进程...
|
||||
killall ss-redir
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -z "$rssredir" ];then
|
||||
echo_date 关闭ssr-redir进程...
|
||||
killall rss-redir
|
||||
fi
|
||||
#--------------------------------------------------------------------------
|
||||
# kill ss-local
|
||||
sslocal=`ps | grep ss-local | grep -v "grep" | grep -w "23456" | awk '{print $1}'`
|
||||
if [ ! -z "$sslocal" ];then
|
||||
echo_date 关闭ss-local进程:23456端口...
|
||||
kill $sslocal >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
|
||||
ssrlocal=`ps | grep rss-local | grep -v "grep" | grep -w "23456" | awk '{print $1}'`
|
||||
if [ ! -z "$ssrlocal" ];then
|
||||
echo_date 关闭ssr-local进程:23456端口...
|
||||
kill $ssrlocal >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# kill ss-tunnel
|
||||
if [ ! -z "$sstunnel" ];then
|
||||
echo_date 关闭ss-tunnel进程...
|
||||
killall ss-tunnel
|
||||
fi
|
||||
|
||||
if [ ! -z "$rsstunnel" ];then
|
||||
echo_date 关闭rss-tunnel进程...
|
||||
killall rss-tunnel
|
||||
fi
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# kill pdnsd
|
||||
if [ ! -z "$pdnsd" ];then
|
||||
echo_date 关闭pdnsd进程...
|
||||
killall pdnsd
|
||||
fi
|
||||
#--------------------------------------------------------------------------
|
||||
# kill chinadns
|
||||
if [ ! -z "$chinadns" ];then
|
||||
echo_date 关闭chinadns进程...
|
||||
killall chinadns
|
||||
fi
|
||||
#--------------------------------------------------------------------------
|
||||
# kill dns2socks
|
||||
if [ ! -z "$DNS2SOCK" ];then
|
||||
echo_date 关闭dns2socks进程...
|
||||
killall dns2socks
|
||||
fi
|
||||
|
||||
if [ ! -z "$client_linux_mips" ];then
|
||||
echo_date 关闭kcp协议进程...
|
||||
killall client_linux_mips >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
if [ ! -z "$haproxy" ];then
|
||||
echo_date 关闭haproxy进程...
|
||||
killall haproxy >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
[ -n "$obfsLocal" ] && echo_date 关闭obfs-local进程... && killall obfs-local >/dev/null 2>&1
|
||||
}
|
||||
|
||||
kill_cron_job(){
|
||||
# kill crontab job
|
||||
echo_date 删除ss规则更新计划任务.
|
||||
sed -i '/ssupdate/d' /var/spool/cron/crontabs/* >/dev/null 2>&1
|
||||
}
|
||||
|
||||
|
||||
remove_conf_and_settings(){
|
||||
echo_date 删除ss相关的名单配置文件.
|
||||
# remove conf under /jffs/configs/dnsmasq.d
|
||||
rm -rf /tmp/etc/dnsmasq.user/gfwlist.conf
|
||||
rm -rf /tmp/etc/dnsmasq.user/cdn.conf
|
||||
rm -rf /tmp/etc/dnsmasq.user/custom.conf
|
||||
rm -rf /tmp/etc/dnsmasq.user/wblist.conf
|
||||
rm -rf /tmp/etc/dnsmasq.user/sscdn.conf
|
||||
rm -rf /tmp/etc/dnsmasq.user/custom.conf
|
||||
rm -rf /tmp/etc/dnsmasq.user/wblist.conf
|
||||
|
||||
# remove ss state
|
||||
dbus remove ss_basic_state_china
|
||||
dbus remove ss_basic_state_foreign
|
||||
}
|
||||
|
||||
case $1 in
|
||||
stop_all)
|
||||
#KCP_basic_action=0 应用所有设置
|
||||
echo_date =============== 梅林固件 - shadowsocks by sadoneli\&Xiaobao ===============
|
||||
echo_date
|
||||
echo_date -------------------------- 关闭Shadowsocks ------------------------------
|
||||
restore_conf
|
||||
remove_conf_and_settings
|
||||
bring_up_dnsmasq
|
||||
restore_nat
|
||||
destory_ipset
|
||||
restore_start_file
|
||||
kill_process
|
||||
kill_cron_job
|
||||
echo_date -------------------------- Shadowsocks已关闭 -----------------------------
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: $0 (stop_all|stop_part)"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
@ -1 +1 @@
|
||||
3.0.5
|
||||
4.1.7
|
||||
|
@ -1,27 +1,58 @@
|
||||
#! /bin/sh
|
||||
|
||||
# shadowsocks script for AM380 merlin firmware
|
||||
# by sadog (sadoneli@gmail.com) from jffs/softcenter.cn
|
||||
|
||||
sh /jffs/softcenter/ss/ssconfig.sh stop
|
||||
sh /jffs/softcenter/scripts/ss_conf_remove.sh
|
||||
sleep 1
|
||||
|
||||
rm -rf /jffs/softcenter/ss/*
|
||||
rm -rf /jffs/softcenter/scripts/ss_*
|
||||
rm -rf /jffs/softcenter/webs/Main_Ss*
|
||||
rm -rf /jffs/softcenter/bin/ss-redir
|
||||
rm -rf /jffs/softcenter/bin/ss-tunnel
|
||||
rm -rf /jffs/softcenter/bin/ss-local
|
||||
rm -rf /jffs/softcenter/bin/ss-server
|
||||
rm -rf /jffs/softcenter/bin/ss-redir
|
||||
rm -rf /jffs/softcenter/bin/rss*
|
||||
rm -rf /jffs/softcenter/bin/obfs*
|
||||
rm -rf /jffs/softcenter/bin/rss-redir
|
||||
rm -rf /jffs/softcenter/bin/rss-tunnel
|
||||
rm -rf /jffs/softcenter/bin/rss-local
|
||||
rm -rf /jffs/softcenter/bin/obfs-local
|
||||
rm -rf /jffs/softcenter/bin/koolgame
|
||||
rm -rf /jffs/softcenter/bin/pdu
|
||||
rm -rf /jffs/softcenter/bin/haproxy
|
||||
rm -rf /jffs/softcenter/bin/redsocks2
|
||||
rm -rf /jffs/softcenter/bin/pdnsd
|
||||
#rm -rf /jffs/softcenter/bin/Pcap_DNSProxy
|
||||
rm -rf /jffs/softcenter/bin/Pcap_DNSProxy
|
||||
rm -rf /jffs/softcenter/bin/dnscrypt-proxy
|
||||
rm -rf /jffs/softcenter/bin/dns2socks
|
||||
rm -rf /jffs/softcenter/bin/cdns
|
||||
rm -rf /jffs/softcenter/bin/client_linux_mips
|
||||
rm -rf /jffs/softcenter/bin/chinadns
|
||||
rm -rf /jffs/softcenter/bin/chinadns1
|
||||
rm -rf /jffs/softcenter/bin/resolveip
|
||||
rm -rf /jffs/softcenter/bin/udp2raw
|
||||
rm -rf /jffs/softcenter/bin/speeder*
|
||||
rm -rf /jffs/softcenter/bin/v2ray
|
||||
rm -rf /jffs/softcenter/bin/v2ctl
|
||||
rm -rf /jffs/softcenter/bin/jitterentropy-rngd
|
||||
rm -rf /jffs/softcenter/bin/haveged
|
||||
rm -rf /jffs/softcenter/bin/https_dns_proxy
|
||||
rm -rf /jffs/softcenter/bin/dnsmasq
|
||||
rm -rf /jffs/softcenter/res/layer
|
||||
rm -rf /jffs/softcenter/res/shadowsocks.css
|
||||
rm -rf /jffs/softcenter/res/icon-shadowsocks.png
|
||||
rm -rf /jffs/softcenter/res/ss-menu.js
|
||||
rm -rf /jffs/softcenter/res/all.png
|
||||
rm -rf /jffs/softcenter/res/gfwlist.png
|
||||
rm -rf /jffs/softcenter/res/chn.png
|
||||
rm -rf /jffs/softcenter/res/game.png
|
||||
rm -rf /jffs/softcenter/res/shadowsocks.css
|
||||
rm -rf /jffs/softcenter/res/gameV2.png
|
||||
rm -rf /jffs/softcenter/res/ss_proc_status.htm
|
||||
rm -rf /jffs/softcenter/init.d/S89Socks5.sh
|
||||
|
||||
# remove start up command
|
||||
sed -i '/ssconfig.sh/d' /jffs/softcenter/scripts/wan-start >/dev/null 2>&1
|
||||
sed -i '/ssconfig.sh/d' /jffs/softcenter/scripts/nat-start >/dev/null 2>&1
|
||||
|
||||
dbus remove softcenter_module_shadowsocks_home_url
|
||||
dbus remove softcenter_module_shadowsocks_install
|
||||
|
283
shadowsocks/shadowsocks/webs/Main_SsLocal_Content.asp
Executable file → Normal file
@ -11,169 +11,144 @@
|
||||
<link rel="stylesheet" type="text/css" href="index_style.css">
|
||||
<link rel="stylesheet" type="text/css" href="form_style.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/element.css">
|
||||
<script language="JavaScript" type="text/javascript" src="/state.js"></script>
|
||||
<script language="JavaScript" type="text/javascript" src="/help.js"></script>
|
||||
<script language="JavaScript" type="text/javascript" src="/general.js"></script>
|
||||
<script language="JavaScript" type="text/javascript" src="/popup.js"></script>
|
||||
<script language="JavaScript" type="text/javascript" src="/client_function.js"></script>
|
||||
<script language="JavaScript" type="text/javascript" src="/validator.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/res/shadowsocks.css">
|
||||
<script type="text/javascript" src="/state.js"></script>
|
||||
<script type="text/javascript" src="/popup.js"></script>
|
||||
<script type="text/javascript" src="/help.js"></script>
|
||||
<script type="text/javascript" src="/validator.js"></script>
|
||||
<script type="text/javascript" src="/js/jquery.js"></script>
|
||||
<script type="text/javascript" src="/general.js"></script>
|
||||
<script type="text/javascript" src="/switcherplugin/jquery.iphone-switch.js"></script>
|
||||
<script type="text/javascript" src="/dbconf?p=ss&v=<% uptime(); %>"></script>
|
||||
<script language="JavaScript" type="text/javascript" src="/client_function.js"></script>
|
||||
<script type="text/javascript" src="/res/ss-menu.js"></script>
|
||||
<style>
|
||||
.Bar_container{
|
||||
width:85%;
|
||||
height:20px;
|
||||
border:1px inset #999;
|
||||
margin:0 auto;
|
||||
margin-top:20px \9;
|
||||
background-color:#FFFFFF;
|
||||
z-index:100;
|
||||
}
|
||||
#proceeding_img_text{
|
||||
position:absolute;
|
||||
z-index:101;
|
||||
font-size:11px; color:#000000;
|
||||
line-height:21px;
|
||||
width: 83%;
|
||||
}
|
||||
#proceeding_img{
|
||||
height:21px;
|
||||
background:#C0D1D3 url(/images/ss_proceding.gif);
|
||||
}
|
||||
#ClientList_Block_PC {
|
||||
border: 1px outset #999;
|
||||
background-color: #576D73;
|
||||
position: absolute;
|
||||
*margin-top:26px;
|
||||
margin-left: 3px;
|
||||
*margin-left:-129px;
|
||||
width: 255px;
|
||||
text-align: left;
|
||||
height: auto;
|
||||
overflow-y: auto;
|
||||
z-index: 200;
|
||||
padding: 1px;
|
||||
display: none;
|
||||
}
|
||||
#ClientList_Block_PC div {
|
||||
background-color: #576D73;
|
||||
height: auto;
|
||||
*height:20px;
|
||||
line-height: 20px;
|
||||
text-decoration: none;
|
||||
font-family: Lucida Console;
|
||||
padding-left: 2px;
|
||||
}
|
||||
#ClientList_Block_PC a {
|
||||
background-color: #EFEFEF;
|
||||
color: #FFF;
|
||||
font-size: 12px;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
text-decoration: none;
|
||||
}
|
||||
#ClientList_Block_PC div:hover, #ClientList_Block a:hover {
|
||||
background-color: #3366FF;
|
||||
color: #FFFFFF;
|
||||
cursor: default;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var socks5 = 1
|
||||
var $j = jQuery.noConflict();
|
||||
var $G = function (id) {
|
||||
return document.getElementById(id);
|
||||
};
|
||||
var x = 5;
|
||||
var noChange = 0;
|
||||
var _responseLen;
|
||||
var params = ["ss_local_server", "ss_local_port", "ss_local_password", "ss_local_method", "ss_local_timeout", "ss_local_proxyport", "ss_local_obfs", "ss_local_acl"];
|
||||
|
||||
function init(){
|
||||
function init() {
|
||||
show_menu(menu_hook);
|
||||
conf_to_obj();
|
||||
buildswitch();
|
||||
toggle_switch();
|
||||
update_visibility();
|
||||
conf2obj();
|
||||
update_visibility();
|
||||
}
|
||||
|
||||
function toggle_switch(){
|
||||
var rrt = document.getElementById("switch");
|
||||
if (document.form.ss_local_enable.value != "1") {
|
||||
rrt.checked = false;
|
||||
} else {
|
||||
rrt.checked = true;
|
||||
}
|
||||
}
|
||||
|
||||
function buildswitch(){
|
||||
$j("#switch").click(
|
||||
function(){
|
||||
if(document.getElementById('switch').checked){
|
||||
document.form.ss_local_enable.value = 1;
|
||||
|
||||
}else{
|
||||
document.form.ss_local_enable.value = 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function conf_to_obj(){
|
||||
if(typeof db_ss != "undefined") {
|
||||
for(var field in db_ss) {
|
||||
var el = document.getElementById(field);
|
||||
if(el != null) {
|
||||
el.value = db_ss[field];
|
||||
}
|
||||
function save() {
|
||||
var dbus = {};
|
||||
for (var i = 0; i < params.length; i++) {
|
||||
if (E(params[i])) {
|
||||
dbus[params[i]] = E(params[i]).value;
|
||||
}
|
||||
}
|
||||
dbus["action_script"] = "ss_socks5.sh";
|
||||
dbus["action_mode"] = " Refresh ";
|
||||
dbus["current_page"] = "Main_SsLocal_Content.asp";
|
||||
dbus["ss_local_enable"] = E("ss_local_enable").checked ? '1' : '0';;
|
||||
db_ss["ss_basic_action"] = "14";
|
||||
push_data(dbus);
|
||||
}
|
||||
|
||||
function push_data(obj) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/applydb.cgi?p=ss',
|
||||
contentType: "application/x-www-form-urlencoded",
|
||||
dataType: 'text',
|
||||
data: $.param(obj),
|
||||
success: function(response) {
|
||||
showSSLoadingBar();
|
||||
noChange = 0;
|
||||
get_realtime_log();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function conf2obj(){
|
||||
E("ss_local_enable").checked = db_ss["ss_local_enable"] == "1";
|
||||
for (var i = 0; i < params.length; i++) {
|
||||
if(db_ss[params[i]]){
|
||||
E(params[i]).value = db_ss[params[i]];
|
||||
}
|
||||
} else {
|
||||
document.getElementById("logArea").innerHTML = "无法读取配置,jffs为空或配置文件不存在?";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function onSubmitCtrl(o, s) {
|
||||
if(validForm()){
|
||||
showSSLoadingBar(5);
|
||||
document.form.action_mode.value = s;
|
||||
document.form.enctype = "";
|
||||
document.form.encoding = "";
|
||||
document.form.action_script.value = "ss_socks5.sh";
|
||||
document.form.submit();
|
||||
function update_visibility() {
|
||||
showhide("ss_obfs_host", (E("ss_local_obfs").value !== "0"));
|
||||
}
|
||||
|
||||
function get_realtime_log() {
|
||||
$.ajax({
|
||||
url: '/cmdRet_check.htm',
|
||||
dataType: 'html',
|
||||
error: function(xhr) {
|
||||
setTimeout("checkCmdRe2t();", 1000);
|
||||
},
|
||||
success: function(response) {
|
||||
var retArea = E("log_content3");
|
||||
if (response.search("XU6J03M6") != -1) {
|
||||
retArea.value = response.replace("XU6J03M6", " ");
|
||||
E("ok_button").style.display = "";
|
||||
retArea.scrollTop = retArea.scrollHeight;
|
||||
x = 6;
|
||||
count_down_close();
|
||||
return true;
|
||||
} else {
|
||||
E("ok_button").style.display = "none";
|
||||
}
|
||||
|
||||
if (_responseLen == response.length) {
|
||||
noChange++;
|
||||
} else {
|
||||
noChange = 0;
|
||||
}
|
||||
|
||||
if (noChange > 100) {
|
||||
return false;
|
||||
} else {
|
||||
setTimeout("get_realtime_log();", 1000);
|
||||
}
|
||||
retArea.value = response;
|
||||
retArea.scrollTop = retArea.scrollHeight;
|
||||
_responseLen = response.length;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function count_down_close() {
|
||||
if (x == "0") {
|
||||
hideSSLoadingBar();
|
||||
}
|
||||
if (x < 0) {
|
||||
E("ok_button1").value = "手动关闭"
|
||||
return false;
|
||||
}
|
||||
E("ok_button1").value = "自动关闭(" + x + ")"
|
||||
--x;
|
||||
setTimeout("count_down_close();", 1000);
|
||||
}
|
||||
|
||||
function done_validating(action){
|
||||
return true;
|
||||
}
|
||||
|
||||
function validForm(){
|
||||
var is_ok = true;
|
||||
return is_ok;
|
||||
}
|
||||
|
||||
function update_visibility(){
|
||||
showhide("ss_obfs_host", (document.form.ss_local_obfs.value !== "0" ));
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init();">
|
||||
<div id="TopBanner"></div>
|
||||
<div id="Loading" class="popup_bg"></div>
|
||||
<div id="LoadingBar" class="popup_bar_bg">
|
||||
<table cellpadding="5" cellspacing="0" id="loadingBarBlock" class="loadingBarBlock" align="center">
|
||||
<table cellpadding="5" cellspacing="0" id="loadingBarBlock" class="loadingBarBlock" align="center">
|
||||
<tr>
|
||||
<td height="100">
|
||||
<div id="loading_block3" style="margin:10px auto;width:85%; font-size:12pt;"></div>
|
||||
<div id="loading_block1" class="Bar_container">
|
||||
<span id="proceeding_img_text"></span>
|
||||
<div id="proceeding_img"></div>
|
||||
</div>
|
||||
<div id="loading_block2" style="margin:10px auto; width:85%;">此期间请勿访问屏蔽网址,以免污染DNS进入缓存</div>
|
||||
<div id="loading_block3" style="margin:10px auto;margin-left:10px;width:85%; font-size:12pt;"></div>
|
||||
<div id="loading_block2" style="margin:10px auto;width:95%;"></div>
|
||||
<div id="log_content2" style="margin-left:15px;margin-right:15px;margin-top:10px;">
|
||||
<textarea cols="63" rows="21" wrap="on" readonly="readonly" id="log_content3" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" style="border:1px solid #000;width:99%; font-family:'Lucida Console'; font-size:11px;background:#000;color:#FFFFFF;outline: none;padding-left:3px;padding-right:22px;overflow-x:hidden"></textarea>
|
||||
</div>
|
||||
<div id="ok_button" class="apply_gen" style="background: #000;display: none;">
|
||||
<input id="ok_button1" class="button_gen" type="button" onclick="hideSSLoadingBar()" value="确定">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<iframe name="hidden_frame" id="hidden_frame" src="" width="0" height="0" frameborder="0"></iframe>
|
||||
<form method="post" name="form" action="/applydb.cgi?p=ss_local_" target="hidden_frame">
|
||||
<input type="hidden" name="current_page" value="Main_SsLocal_Content.asp">
|
||||
<input type="hidden" name="next_page" value="Main_SsLocal_Content.asp">
|
||||
<input type="hidden" name="group_id" value="">
|
||||
@ -183,8 +158,8 @@ function update_visibility(){
|
||||
<input type="hidden" name="action_wait" value="8">
|
||||
<input type="hidden" name="first_time" value="">
|
||||
<input type="hidden" name="preferred_lang" id="preferred_lang" value="<% nvram_get("preferred_lang"); %>">
|
||||
<input type="hidden" name="SystemCmd" value="">
|
||||
<input type="hidden" name="firmver" value="<% nvram_get("firmver"); %>">
|
||||
<input type="hidden" id="ss_local_enable" name="ss_local_enable" value='<% dbus_get_def("ss_local_enable", "0"); %>'/>
|
||||
<table class="content" align="center" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td width="17"> </td>
|
||||
@ -202,8 +177,7 @@ function update_visibility(){
|
||||
<div class="formfonttitle">Shadowsocks - Socks5代理设置</div>
|
||||
<div style="margin-left:5px;margin-top:10px;margin-bottom:10px"><img src="/images/New_ui/export/line_export.png"></div>
|
||||
<div class="SimpleNote">
|
||||
<li><i>说明:</i>此页面允许配置第二个shadosocks账号,功能仅限于在路由器上打开一个连接到shadowsocks服务器的socks5端口。如果你使用chrome浏览器,你可以使用SwitchyOmega插件去连接这个socks5代理。</li></br>
|
||||
<li><i>此页面功能独立于ss,单独开关:</i></li>
|
||||
<li><i>说明:</i>此页面允许配置第二个shadosocks账号,功能仅限于在路由器上打开一个连接到shadowsocks服务器的socks5端口。如果你使用chrome浏览器,你可以使用SwitchyOmega插件去连接这个socks5代理。</li>
|
||||
</div>
|
||||
<div style="margin-left:5px;margin-top:10px;margin-bottom:10px"><img src="/images/New_ui/export/line_export.png"></div>
|
||||
<table width="100%" border="1" align="center" cellpadding="4" cellspacing="0" bordercolor="#6b8fa3" class="FormTable">
|
||||
@ -212,14 +186,14 @@ function update_visibility(){
|
||||
<td colspan="2">Shadowsocks - ss-local - 高级设置</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr id="switch_tr">
|
||||
<tr>
|
||||
<th>
|
||||
<label>开关</label>
|
||||
</th>
|
||||
<td colspan="2">
|
||||
<div class="switch_field" style="display:table-cell;float: left;">
|
||||
<label for="switch">
|
||||
<input id="switch" class="switch" type="checkbox" style="display: none;">
|
||||
<label for="ss_local_enable">
|
||||
<input id="ss_local_enable" class="switch" type="checkbox" style="display: none;">
|
||||
<div class="switch_container" >
|
||||
<div class="switch_bar"></div>
|
||||
<div class="switch_circle transition_style">
|
||||
@ -233,19 +207,19 @@ function update_visibility(){
|
||||
<tr>
|
||||
<th width="20%">服务器(建议填写IP地址)</th>
|
||||
<td>
|
||||
<input style="background-image: none;background-color: #576d73;border:1px solid gray" type="text" class="ssconfig input_ss_table" id="ss_local_server" name="ss_local_server" maxlength="100" value="">
|
||||
<input style="background-image: none;background-color: #576d73;border:1px solid gray" type="text" class="input_ss_table" id="ss_local_server" name="ss_local_server" maxlength="100" value="">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th width="20%">服务器端口</th>
|
||||
<td>
|
||||
<input type="text" class="ssconfig input_ss_table" id="ss_local_port" name="ss_local_port" maxlength="100" value="">
|
||||
<input type="text" class="input_ss_table" id="ss_local_port" name="ss_local_port" maxlength="100" value="">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th width="20%">密码</th>
|
||||
<td>
|
||||
<input type="password" class="ssconfig input_ss_table" id="ss_local_password" name="ss_local_password" maxlength="100" value="" onBlur="switchType(this, false);" onFocus="switchType(this, true);">
|
||||
<input type="password" class="input_ss_table" id="ss_local_password" name="ss_local_password" maxlength="100" value="" onBlur="switchType(this, false);" onFocus="switchType(this, true);">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -277,13 +251,13 @@ function update_visibility(){
|
||||
<tr>
|
||||
<th width="20%">超时时间</th>
|
||||
<td>
|
||||
<input type="text" class="ssconfig input_ss_table" id="ss_local_timeout" name="ss_local_timeout" maxlength="100" value="600">
|
||||
<input type="text" class="input_ss_table" id="ss_local_timeout" name="ss_local_timeout" maxlength="100" value="600">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th width="20%">本地代理端口</th>
|
||||
<td>
|
||||
<input type="text" class="ssconfig input_ss_table" id="ss_local_proxyport" name="ss_local_proxyport" maxlength="100" value="1082">
|
||||
<input type="text" class="input_ss_table" id="ss_local_proxyport" name="ss_local_proxyport" maxlength="100" value="1082">
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="ss_obfs">
|
||||
@ -299,7 +273,7 @@ function update_visibility(){
|
||||
<tr id="ss_obfs_host">
|
||||
<th width="35%">混淆主机名 (obfs_host)</th>
|
||||
<td>
|
||||
<input type="text" name="ss_local_obfs_host" id="ss_local_obfs_host" placeholder="bing.com" class="ssconfig input_ss_table" maxlength="100" value=""></input>
|
||||
<input type="text" name="ss_local_obfs_host" id="ss_local_obfs_host" placeholder="bing.com" class="input_ss_table" maxlength="100" value=""></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="acl_support">
|
||||
@ -315,13 +289,9 @@ function update_visibility(){
|
||||
</table>
|
||||
<div id="warning" style="font-size:14px;margin:20px auto;"></div>
|
||||
<div class="apply_gen">
|
||||
<input class="button_gen" id="cmdBtn" onClick="onSubmitCtrl(this, ' Refresh ')" type="button" value="提交" />
|
||||
<input class="button_gen" id="cmdBtn" onClick="save()" type="button" value="提交" />
|
||||
</div>
|
||||
<div style="margin-left:5px;margin-top:10px;margin-bottom:10px"><img src="/images/New_ui/export/line_export.png"></div>
|
||||
<div class="KoolshareBottom">论坛技术支持: <a href="http://www.koolshare.cn" target="_blank"> <i><u>www.koolshare.cn</u></i> </a> <br/>
|
||||
博客技术支持: <a href="http://www.mjy211.com" target="_blank"> <i><u>www.mjy211.com</u></i> </a> <br/>
|
||||
Github项目: <a href="https://github.com/koolshare/koolshare.github.io" target="_blank"> <i><u>github.com/koolshare</u></i> </a> <br/>
|
||||
Shell by: <a href="mailto:sadoneli@gmail.com"> <i>sadoneli</i> </a>, Web by: <i>Xiaobao</i> </div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@ -332,16 +302,7 @@ function update_visibility(){
|
||||
<td width="10" align="center" valign="top"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<div id="footer"></div>
|
||||
</body>
|
||||
<script type="text/javascript">
|
||||
<!--[if !IE]>-->
|
||||
jQuery.noConflict();
|
||||
(function($){
|
||||
var i = 0;
|
||||
})(jQuery);
|
||||
<!--<![endif]-->
|
||||
</script>
|
||||
</html>
|
||||
|
||||
|
924
shadowsocks/shadowsocks/webs/Main_Ss_LoadBlance.asp
Executable file → Normal file
@ -1,2 +1,2 @@
|
||||
3.0.5
|
||||
becf4b1e5191c63c7958c115e521b197
|
||||
4.1.7
|
||||
f8b25718146bccb438bd70d111f222fa
|
||||
|
@ -11,14 +11,14 @@
|
||||
"version": "0.2.3"
|
||||
},
|
||||
{
|
||||
"build_date": "2019-01-23_20:45:50",
|
||||
"description": "shadowsocks",
|
||||
"build_date": "2019-01-25_00:00:12",
|
||||
"description": "科学上网",
|
||||
"home_url": "Main_Ss_Content.asp",
|
||||
"md5": "becf4b1e5191c63c7958c115e521b197",
|
||||
"md5": "f8b25718146bccb438bd70d111f222fa",
|
||||
"name": "shadowsocks",
|
||||
"tar_url": "shadowsocks/shadowsocks.tar.gz",
|
||||
"title": "shadowsocks",
|
||||
"version": "3.0.5"
|
||||
"title": "科学上网",
|
||||
"version": "4.1.7"
|
||||
},
|
||||
{
|
||||
"build_date": "2019-01-13_23:00:27",
|
||||
|
@ -31,7 +31,7 @@ def work_paths_by_walk():
|
||||
print os.path.join(root,sub)
|
||||
|
||||
def work_parent():
|
||||
ignore_paths = frozenset(["maintain_files", "softcenter", "v2ray", "adbyby", "gdddns", "mdial"])
|
||||
ignore_paths = frozenset(["maintain_files", "softcenter", "v2ray", "adbyby", "gdddns", "mdial", "rules", "v2ray_binary"])
|
||||
for fname in os.listdir(parent_path):
|
||||
|
||||
if fname[0] == "." or fname in ignore_paths:
|
||||
|
6
v2ray_binary/README.md
Normal file
@ -0,0 +1,6 @@
|
||||
### V2RAY arm二进制存放
|
||||
***
|
||||
##### 由于路由器jffs空间有限,此处存放经过UPX压缩的v2ray二进制,以节约空间<br/>
|
||||
##### 此处存放的v2ray二进制来源于[v2ray官方项目](https://github.com/v2ray/v2ray-core)的[releases页面](https://github.com/v2ray/v2ray-core/releases),仅使用UPX处理,用于路由器下的v2ray二进制更新<br/>
|
||||
|
||||
压缩命令:```upx --lzma --ultra-brute v2ray v2ray_arm v2ctl```
|
1
v2ray_binary/latest.txt
Normal file
@ -0,0 +1 @@
|
||||
v4.13.0
|
2
v2ray_binary/v4.13.0/md5sum.txt
Normal file
@ -0,0 +1,2 @@
|
||||
0e4db29b5148e41e19049d5d1ba4ebf1 v2ctl
|
||||
eb3c15df5635d8461266f9fdbe62437c v2ray
|