luci-app-vssr: sync with upstream source

This commit is contained in:
CN_SZTL 2020-03-05 19:05:52 +08:00
parent f4ddbc00fe
commit aed8c0e660
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
8 changed files with 59 additions and 13 deletions

View File

@ -1,8 +1,8 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-vssr
PKG_VERSION:=1.17
PKG_RELEASE:=20200304-4
PKG_VERSION:=1.18
PKG_RELEASE:=20200305-4
PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_V2ray \

View File

@ -313,11 +313,7 @@ local set =luci.http.formvalue("set")
local icount =0
if set == "gfw_data" then
if nixio.fs.access("/usr/bin/wget-ssl") then
refresh_cmd="wget-ssl --no-check-certificate https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt -O /tmp/gfw.b64"
else
refresh_cmd="wget -O /tmp/gfw.b64 http://iytc.net/tools/list.b64"
end
sret=luci.sys.call(refresh_cmd .. " 2>/dev/null")
if sret== 0 then
luci.sys.call("/usr/bin/vssr-gfw")
@ -326,6 +322,8 @@ if nixio.fs.access("/usr/bin/wget-ssl") then
oldcount=luci.sys.exec("cat /etc/dnsmasq.ssr/gfw_list.conf | wc -l")
if tonumber(icount) ~= tonumber(oldcount) then
luci.sys.exec("cp -f /tmp/gfwnew.txt /etc/dnsmasq.ssr/gfw_list.conf")
luci.sys.exec("cp -f /etc/dnsmasq.ssr/gfw_list.conf /tmp/dnsmasq.ssr/gfw_list.conf")
luci.sys.call("/etc/init.d/dnsmasq restart")
retstring=tostring(math.ceil(tonumber(icount)/2))
else
retstring ="0"
@ -375,6 +373,7 @@ if sret== 0 then
luci.sys.exec("cp -f /tmp/ad.conf /etc/dnsmasq.ssr/ad.conf")
retstring=tostring(math.ceil(tonumber(icount)))
if oldcount==0 then
luci.sys.exec("cp -f /etc/dnsmasq.ssr/ad.conf /tmp/dnsmasq.ssr/ad.conf")
luci.sys.call("/etc/init.d/dnsmasq restart")
end
else

View File

@ -77,7 +77,7 @@ o = s:option(Flag, "adblock", translate("Enable adblock"))
o.rmempty = false
o = s:option(Value, "adblock_url", translate("adblock_url"))
o.default = "https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt"
o.default = "https://gitee.com/privacy-protection-tools/anti-ad/raw/master/anti-ad-for-dnsmasq.conf"
-- [[ chnroute ]]
s = m:section(TypedSection, "global", translate("Chnroute Setting"))
@ -87,7 +87,7 @@ o = s:option(Flag, "chnroute", translate("Enable custom chnroute"))
o.rmempty = false
o = s:option(Value, "chnroute_url", translate("Update url"))
o.default = "https://cdn.jsdelivr.net/gh/17mon/china_ip_list/china_ip_list.txt"
o.default = "https://ispip.clang.cn/all_cn.txt"
-- [[ haProxy ]]--

View File

@ -76,6 +76,10 @@ o:value("ssr", translate("ShadowsocksR"))
if nixio.fs.access("/usr/bin/ss-redir") then
o:value("ss", translate("Shadowsocks"))
end
if nixio.fs.access("/usr/bin/ipt2socks") then
o:value("socks5", translate("Socks5"))
end
o.description = translate(
"Using incorrect encryption mothod may causes service fail to start")
@ -99,12 +103,23 @@ o.rmempty = false
-- o.default = 60
-- o.rmempty = false
o = s:option(Flag, "auth_enable", translate("Enable Authentication"))
o.rmempty = false
o.default = "0"
o:depends("type", "socks5")
o = s:option(Value, "username", translate("Username"))
o.rmempty = true
o:depends("type", "socks5")
o = s:option(Value, "password", translate("Password"))
o.password = true
o.rmempty = true
o:depends("type", "ssr")
o:depends("type", "ss")
o:depends("type", "trojan")
o:depends("type", "socks5")
o = s:option(ListValue, "encrypt_method", translate("Encrypt Method"))

View File

@ -1,7 +1,7 @@
-- Copyright (C) 2017 yushi studio <ywb94@qq.com>
-- Licensed to the public under the GNU General Public License v3.
local IPK_Version="20200304.1.17"
local IPK_Version="20200305.1.18"
local m, s, o
local redir_run=0
local reudp_run=0

View File

@ -866,3 +866,5 @@ msgstr "进程详情:"
msgid "File Viewer"
msgstr "文件查看器"
msgid "Enable Authentication"
msgstr "启用 用户名/密码 认证"

View File

@ -617,9 +617,11 @@ start_redir() {
sscmd="/usr/bin/v2ray/v2ray"
elif [ "$stype" == "trojan" ] ;then
sscmd="/usr/sbin/trojan"
elif [ "$stype" == "socks5" ]; then
sscmd="/usr/bin/ipt2socks"
fi
local utype=$(uci_get_by_name $UDP_RELAY_SERVER type)
local utype=$(uci_get_by_name $UDP_RELAY_SERVER type)
if [ "$utype" == "ss" ] ;then
ucmd="/usr/bin/ss-redir"
elif [ "$utype" == "ssr" ] ;then
@ -628,6 +630,8 @@ start_redir() {
ucmd="/usr/bin/v2ray/v2ray"
elif [ "$utype" == "trojan" ] ;then
ucmd="/usr/sbin/trojan"
elif [ "$stype" == "socks5" ]; then
ucmd="/usr/bin/ipt2socks"
fi
if [ "$(uci_get_by_type global threads 0)" = "0" ] ;then
@ -658,6 +662,17 @@ start_redir() {
done
echo "$(date "+%Y-%m-%d %H:%M:%S") $($sscmd --version 2>&1 | head -1) $threads 线程 已启动!" >> /tmp/vssr.log
elif [ "$stype" == "socks5" ]; then
for i in $(seq 1 $threads); do
if [ "$(uci_get_by_name $GLOBAL_SERVER auth_enable 0)" == "0" ]; then
$sscmd -T -4 -b 0.0.0.0 -s $(uci_get_by_name $GLOBAL_SERVER server) -p $(uci_get_by_name $GLOBAL_SERVER server_port) -l $(uci_get_by_name $GLOBAL_SERVER local_port) -R ssr-retcp >/dev/null 2>&1 &
else
$sscmd -T -4 -b 0.0.0.0 -s $(uci_get_by_name $GLOBAL_SERVER server) -p $(uci_get_by_name $GLOBAL_SERVER server_port) -a $(uci_get_by_name $GLOBAL_SERVER username) \
-k $(uci_get_by_name $GLOBAL_SERVER password) -l $(uci_get_by_name $GLOBAL_SERVER local_port) -R ssr-retcp >/dev/null 2>&1 &
fi
done
echo "$(date "+%Y-%m-%d %H:%M:%S") Socks5 REDIRECT/TPROXY, $threads 线程 已启动!" >>/tmp/vssr.log
fi
#转发UDP
@ -681,8 +696,16 @@ start_redir() {
sed -i 's/\\//g' /var/etc/trojan-ssr-reudp.json
$ucmd --config /var/etc/trojan-ssr-reudp.json >/dev/null 2>&1 &
ipt2socks -U -4 -b 0.0.0.0 -s 127.0.0.1 -p 10801 -l $(uci_get_by_name $UDP_RELAY_SERVER local_port) >/dev/null 2>&1 &
elif [ "$utype" == "socks5" ]; then
if [ "$(uci_get_by_name $GLOBAL_SERVER auth_enable 0)" == "0" ]; then
$ucmd -4 -b 0.0.0.0 -s $(uci_get_by_name $UDP_RELAY_SERVER server) -p $(uci_get_by_name $UDP_RELAY_SERVER server_port) -l $(uci_get_by_name $UDP_RELAY_SERVER local_port) -U ssr-reudp >/dev/null 2>&1 &
else
$ucmd -4 -b 0.0.0.0 -s $(uci_get_by_name $UDP_RELAY_SERVER server) -p $(uci_get_by_name $UDP_RELAY_SERVER server_port) -a $(uci_get_by_name $GLOBAL_SERVER username) \
-k $(uci_get_by_name $GLOBAL_SERVER password) -l $(uci_get_by_name $UDP_RELAY_SERVER local_port) -U ssr-reudp >/dev/null 2>&1 &
fi
fi
fi
#deal with dns
if [ "$(uci_get_by_type global pdnsd_enable)" -ne "0" ] ;then
@ -928,6 +951,7 @@ start_local() {
sed -i 's/\\//g' /var/etc/v2-ssr-local.json
/usr/bin/v2ray/v2ray -config /var/etc/v2-ssr-local.json >/dev/null 2>&1 &
local_enable=3
fi
if [ "$http_enable" -eq 1 ] ;then
@ -1068,6 +1092,7 @@ stop() {
killall -q -9 ss-local
killall -q -9 haproxy
killall -q -9 privoxy
killall -q -9 ipt2socks
killall -q -9 v2ray-plugin
killall -q -9 gq-client
killall -q -9 gq-server
@ -1108,3 +1133,5 @@ stop() {
del_cron
}

View File

@ -1,6 +1,9 @@
#!/bin/sh -e
if [ -f /tmp/adnew.conf ]; then
cat /tmp/adnew.conf | grep ^\|\|[^\*]*\^$ | sed -e 's:||:address\=\/:' -e 's:\^:/0\.0\.0\.0:' > /tmp/ad.conf
if (grep -wq "address=" /tmp/adnew.conf) ; then
cp /tmp/adnew.conf /tmp/ad.conf
else
cat /tmp/adnew.conf | grep ^\|\|[^\*]*\^$ | sed -e 's:||:address\=\/:' -e 's:\^:/0\.0\.0\.0:' > /tmp/ad.conf
fi
fi
rm -f /tmp/adnew.conf