package lienol: merge upsteam update

This commit is contained in:
CN_SZTL 2019-12-14 18:01:26 +08:00
parent c34c5d2989
commit 7fc0d56e8a
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
23 changed files with 2942 additions and 2371 deletions

View File

@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-passwall
PKG_VERSION:=3.0
PKG_RELEASE:=120-20191207
PKG_RELEASE:=127-20191214
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PO2LMO:=./po2lmo
@ -17,8 +17,8 @@ include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)/config
menu "Configuration"
config PACKAGE_$(PKG_NAME)_INCLUDE_redsocks2
bool "Include RedSocks2"
config PACKAGE_$(PKG_NAME)_INCLUDE_ipt2socks
bool "Include ipt2socks"
default n
config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks
@ -77,13 +77,13 @@ endmenu
endef
define Package/$(PKG_NAME)
CATEGORY:=LuCI
CATEGORY:=LuCI for Lienol
SUBMENU:=3. Applications
TITLE:=LuCI support for PassWall By Lienol
PKGARCH:=all
DEPENDS:=+curl +libcurl +libmbedtls +ca-bundle +ca-certificates +resolveip +iptables-mod-tproxy +kmod-ipt-tproxy +iptables-mod-ipopt +kmod-ipt-ipopt +ip +ipset +coreutils +coreutils-base64 +coreutils-nohup +luci-lib-jsonc +unzip \
+dnsmasq-full +tcping \
+PACKAGE_$(PKG_NAME)_INCLUDE_redsocks2:redsocks2 \
DEPENDS:=+curl +wget +libcurl +libmbedtls +ca-bundle +ca-certificates +resolveip +iptables-mod-tproxy +kmod-ipt-tproxy +iptables-mod-ipopt +kmod-ipt-ipopt +ip +ipset +coreutils +coreutils-base64 +coreutils-nohup +luci-lib-jsonc +unzip \
+dnsmasq-full +tcping +bash \
+PACKAGE_$(PKG_NAME)_INCLUDE_ipt2socks:ipt2socks \
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks:shadowsocks-libev-ss-redir \
+PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR:shadowsocksr-libev-alt \
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_socks:shadowsocks-libev-ss-local \

View File

@ -167,11 +167,11 @@ function connect_status()
local e = {}
if luci.http.formvalue("type") == "google" then
e.status = luci.sys.call(
"echo `curl -I -o /dev/null -s -m 10 --connect-timeout 5 -w %{http_code} 'https://www.google.com'` | grep 200 >/dev/null") ==
"echo `/usr/share/passwall/test.sh test_url 'https://www.google.com'` | grep 200 >/dev/null") ==
0
else
e.status = luci.sys.call(
"echo `curl -I -o /dev/null -s -m 10 --connect-timeout 2 -w %{http_code} 'http://www.baidu.com'` | grep 200 >/dev/null") ==
"echo `/usr/share/passwall/test.sh test_url 'https://www.baidu.com'` | grep 200 >/dev/null") ==
0
end
luci.http.prepare_content("application/json")
@ -184,13 +184,16 @@ function auto_ping_node()
local port = luci.http.formvalue("port")
local e = {}
e.index = index
if luci.sys.exec("echo -n `command -v tcping`") ~= "" then
e.ping = luci.sys.exec("tcping -q -c 1 -i 3 -p " .. port .. " " ..
address ..
" 2>&1 | grep -o 'time=[0-9]*' | awk -F '=' '{print$2}'")
if luci.sys.exec("echo -n `uci -q get %s.@global_other[0].use_tcping`" %
appname) == "1" and
luci.sys.exec("echo -n `command -v tcping`") ~= "" then
e.ping = luci.sys.exec(
"echo -n `tcping -q -c 1 -i 3 -p " .. port .. " " ..
address ..
" 2>&1 | grep -o 'time=[0-9]*' | awk -F '=' '{print$2}'`")
else
e.ping = luci.sys.exec(
"ping -c 1 -W 1 %q 2>&1 | grep -o 'time=[0-9]*' | awk -F '=' '{print$2}'" %
"echo -n `ping -c 1 -W 1 %q 2>&1 | grep -o 'time=[0-9]*' | awk -F '=' '{print$2}'`" %
address)
end
luci.http.prepare_content("application/json")
@ -201,10 +204,13 @@ function ping_node()
local e = {}
local address = luci.http.formvalue("address")
local port = luci.http.formvalue("port")
if luci.sys.exec("echo -n `command -v tcping`") ~= "" then
e.ping = luci.sys.exec("tcping -q -c 1 -i 3 -p " .. port .. " " ..
address ..
" 2>&1 | grep -o 'time=[0-9]*' | awk -F '=' '{print$2}'")
if luci.sys.exec("echo -n `uci -q get %s.@global_other[0].use_tcping`" %
appname) == "1" and
luci.sys.exec("echo -n `command -v tcping`") ~= "" then
e.ping = luci.sys.exec(
"echo -n `tcping -q -c 1 -i 3 -p " .. port .. " " ..
address ..
" 2>&1 | grep -o 'time=[0-9]*' | awk -F '=' '{print$2}'`")
else
e.ping = luci.sys.exec(
"echo -n `ping -c 1 -W 1 %q 2>&1 | grep -o 'time=[0-9]*' | awk -F '=' '{print$2}'`" %
@ -253,7 +259,9 @@ function check_port()
retstring = retstring ..
"<font color='red'>暂时不支持UDP检测</font><br />"
if luci.sys.exec("echo -n `command -v tcping`") ~= "" then
if luci.sys.exec("echo -n `uci -q get %s.@global_other[0].use_tcping`" %
appname) == "1" and
luci.sys.exec("echo -n `command -v tcping`") ~= "" then
retstring = retstring ..
"<font color='green'>使用tcping检测端口延迟</font><br />"
uci:foreach("passwall", "nodes", function(s)
@ -263,13 +271,12 @@ function check_port()
(s.v2ray_transport and s.v2ray_transport == "mkcp" and s.port) then
else
if s.type and s.address and s.port and s.remarks then
node_name = "[%s] [%s:%s]" %
{s.remarks, s.address, s.port}
node_name = "[%s] [%s:%s]" % {s.remarks, s.address, s.port}
end
result = luci.sys.exec("tcping -q -c 1 -i 3 -p " .. s.port ..
" " .. s.address ..
" 2>&1 | grep -o 'time=[0-9]*' | awk -F '=' '{print$2}'")
result = luci.sys.exec("echo -n `tcping -q -c 1 -i 3 -p " ..
s.port .. " " .. s.address ..
" 2>&1 | grep -o 'time=[0-9]*' | awk -F '=' '{print$2}'`")
if result and result ~= "" then
retstring =
retstring .. "<font color='green'>" .. node_name ..
@ -291,15 +298,6 @@ function check_port()
local udp_socket
if (s.use_kcp and s.use_kcp == "1" and s.kcp_port) or
(s.v2ray_transport and s.v2ray_transport == "mkcp" and s.port) then
--[[local port = (s.use_kcp == "1" and s.kcp_port) and s.kcp_port or (s.v2ray_transport == "mkcp" and s.port) and s.port or nil
if port then
udp_socket = nixio.socket("inet", "dgram")
udp_socket:setopt("socket", "rcvtimeo", 3)
udp_socket:setopt("socket", "sndtimeo", 3)
udp_socket:sendto("test", s.address, port)
r,c,d=udp_socket:recvfrom(10)
ret=""
end--]]
else
if s.type and s.address and s.port and s.remarks then
node_name = "%s[%s] %s:%s" %

View File

@ -11,6 +11,11 @@ m = Map(appname)
s = m:section(TypedSection, "global_other")
s.anonymous = true
---- Use TCPing
o = s:option(Flag, "use_tcping", translate("Use TCPing"),
translate("This will use tcping replace ping detection of node"))
o.default = 1
---- Auto Ping
o = s:option(Flag, "auto_ping", translate("Auto Ping"),
translate("This will automatically ping the node for latency"))

View File

@ -221,7 +221,7 @@ https://github.com/pure-css/pure/blob/master/LICENSE.md
<div class="pure-u-1-2 check" onclick="check_port(this)">
<div class="block pure-g">
<div class="pure-u-4-5">
<h4 id="status_servers_check"><%:Server Check%><br /><span id="_check_nodes_status" class="red"><%:Touch Check%></span></h4>
<h4><%:Node Check%><br /><span id="_check_nodes_status" class="red"><%:Touch Check%></span></h4>
<input id="clear_check_port_btn" type="button" class="cbi-button cbi-button-remove" style="display:none" value="<%:Clear%>" />
</div>
<div class="pure-u-1-5">

View File

@ -49,7 +49,7 @@ local socks5_node_num = api.uci_get_type("global_other", "socks5_node_num", 1)
padding-top: unset;
}
#_server_status > font {
#_node_status > font {
display: block;
}
}
@ -148,11 +148,11 @@ local socks5_node_num = api.uci_get_type("global_other", "socks5_node_num", 1)
</div>
<div class="cbi-value">
<label class="cbi-value-title">
<%:Server Check%>
<%:Node Check%>
</label>
<div class="cbi-value-field">
<input type="button" class="cbi-button cbi-input-apply" value="<%:Check%>" onclick="return check_port(this)" />
<font id="_server_status"></font>
<font id="_node_status"></font>
<input id="clear_check_port_btn" type="button" class="cbi-button cbi-button-remove" style="display:none" value="<%:Clear%>" onclick="return clear_check_port(this)" />
</div>
</div>
@ -258,7 +258,7 @@ local socks5_node_num = api.uci_get_type("global_other", "socks5_node_num", 1)
btn.value = '<%:Check...%>';
XHR.get('<%=dsp.build_url("admin/vpn/passwall/check_port")%>', null,
function(x, rv) {
var s = document.getElementById('_server_status');
var s = document.getElementById('_node_status');
if(s) {
s.innerHTML = rv.ret;
var clear_btn = document.getElementById('clear_check_port_btn');
@ -273,7 +273,7 @@ local socks5_node_num = api.uci_get_type("global_other", "socks5_node_num", 1)
function clear_check_port(btn) {
btn.style.display = 'none';
var s = document.getElementById('_server_status');
var s = document.getElementById('_node_status');
s.innerHTML = "";
return false;
}

View File

@ -59,7 +59,6 @@ local dsp = require "luci.dispatcher"
}
}
else {
alert("<%:Please Enter The Link%>");
document.getElementById("nodes_link").focus();
}
}
@ -75,7 +74,7 @@ local dsp = require "luci.dispatcher"
<div id="add_link_div">
<div class="cbi-value">
<label class="cbi-value-title"><%:Please Enter The SS/SSR/V2ray/Trojan Link%></label>
<label class="cbi-value-title"><%:SS/SSR/V2ray/Trojan Link%></label>
<div class="cbi-value-field">
<textarea id="nodes_link" rows="5" cols="50"></textarea>
</div>

View File

@ -19,7 +19,7 @@ table td, .table .td {
#set_node_div{
display: none;
width: 30rem;
position: absolute;
position: fixed;
left:50%;
top:50%;
transform: translate(-50%, -50%);
@ -37,10 +37,13 @@ table td, .table .td {
function open_set_node_div(cbi_id) {
section = cbi_id;
document.getElementById("set_node_div").style.display="block";
var node_name = document.getElementById("cbid.passwall." + cbi_id + ".remarks").value;
document.getElementById("set_node_name").innerHTML = node_name;
}
function close_set_node_div() {
document.getElementById("set_node_div").style.display="none";
document.getElementById("set_node_name").innerHTML = "";
}
@ -65,10 +68,11 @@ table td, .table .td {
XHR.get('<%=dsp.build_url("admin/vpn/passwall/set_node")%>', { "protocol" : protocol , "number" : number , "section" : section },
function(x, result) {
if(x && x.status == 200) {
window.location.href = '<%=dsp.build_url("admin/vpn/passwall/log")%>'
//window.location.href = '<%=dsp.build_url("admin/vpn/passwall/log")%>'
}
}
);
window.location.href = '<%=dsp.build_url("admin/vpn/passwall/log")%>'
}
}
@ -93,6 +97,7 @@ table td, .table .td {
</script>
<div id="set_node_div">
<div class="cbi-value">您选择的服务器是:<span id="set_node_name"></span></div>
<div class="cbi-value">
<% if tcp_node_num and tonumber(tcp_node_num) >= 1 then %>
<% for i = 1, tcp_node_num, 1 do %>

View File

@ -151,7 +151,6 @@ local brook_version = luci.sys.exec("[ -f '" .. brook_path .. "' ] && " .. brook
</label>
<div class="cbi-value-field">
<div class="cbi-value-description">
<img src="/luci-static/resources/cbi/help.gif">
<span><%=brook_version%>】</span>
<input class="cbi-button cbi-input-apply" type="submit" id="_brook-check_btn" onclick="onBtnClick_brook(this);" value="<%:Manually update%>">
<span id="_brook-check_btn-detail"></span>

View File

@ -167,7 +167,6 @@ local kcptun_version = luci.sys.exec("[ -f '" .. kcptun_path .. "' ] && " .. kcp
</label>
<div class="cbi-value-field">
<div class="cbi-value-description">
<img src="/luci-static/resources/cbi/help.gif">
<span><%=kcptun_version%>】</span>
<input class="cbi-button cbi-input-apply" type="submit" id="_kcptun-check_btn" onclick="onBtnClick_kcptun(this);" value="<%:Manually update%>">
<span id="_kcptun-check_btn-detail"></span>

View File

@ -49,7 +49,6 @@ local chnroute_update = api.uci_get_type("global_rules", "chnroute_update", "1")
</label>
<div class="cbi-value-field">
<div class="cbi-value-description">
<img src="/luci-static/resources/cbi/help.gif">
<span><%=gfwlist_version%> 】</span>
<input type="checkbox" name="gfwlist_update" value="1" <%=gfwlist_update%> />
</div>
@ -62,7 +61,6 @@ local chnroute_update = api.uci_get_type("global_rules", "chnroute_update", "1")
</label>
<div class="cbi-value-field">
<div class="cbi-value-description">
<img src="/luci-static/resources/cbi/help.gif">
<span><%=chnroute_version%> 】</span>
<input type="checkbox" name="chnroute_update" value="1" <%=chnroute_update%> />
</div>

View File

@ -167,7 +167,6 @@ local V2ray_version = luci.sys.exec("[ -f '" .. V2ray_path .. "/v2ray' ] && " ..
</label>
<div class="cbi-value-field">
<div class="cbi-value-description">
<img src="/luci-static/resources/cbi/help.gif">
<span><%=V2ray_version%>】</span>
<input class="cbi-button cbi-input-apply" type="submit" id="_v2ray-check_btn" onclick="onBtnClick_v2ray(this);" value="<%:Manually update%>">
<span id="_v2ray-check_btn-detail"></span>

View File

@ -109,8 +109,8 @@ msgstr "百度连接"
msgid "Google Connection"
msgstr "谷歌连接"
msgid "Server Check"
msgstr "服务器检测"
msgid "Node Check"
msgstr "节点检测"
msgid "Check..."
msgstr "检测中..."
@ -220,8 +220,8 @@ msgstr "添加节点"
msgid "Add the node via the link"
msgstr "通过链接添加节点"
msgid "Please Enter The SS/SSR/V2ray/Trojan Link"
msgstr "请输入SS/SSR/V2ray/Trojan链接"
msgid "SS/SSR/V2ray/Trojan Link"
msgstr "SS/SSR/V2ray/Trojan链接"
msgid "Please enter the correct link, ss:// ssr:// vmess:// trojan://"
msgstr "请输入正确的链接ss:// ssr:// vmess:// trojan://"
@ -268,11 +268,17 @@ msgstr "Ping延迟"
msgid "Ping Value"
msgstr "Ping值"
msgid "Use TCPing"
msgstr "使用TCPing"
msgid "This will use tcping replace ping detection of node"
msgstr "选中后保存应用后即使用tcping替换ping检测节点"
msgid "Auto Ping"
msgstr "自动Ping"
msgid "This will automatically ping the node for latency"
msgstr "选中后保存应用后刷新即可自动Ping节点"
msgstr "选中后保存应用后即自动Ping节点"
msgid "Apply"
msgstr "应用"

View File

@ -37,6 +37,7 @@ config global_proxy
option proxy_ipv6 '0'
config global_other
option use_tcping '1'
option auto_ping '0'
option tcp_node_num '1'
option udp_node_num '1'
@ -47,7 +48,7 @@ config global_rules
option auto_update '0'
option gfwlist_update '1'
option chnroute_update '1'
option gfwlist_version '2019-12-01'
option gfwlist_version '2019-12-10'
option chnroute_version '2019-12-05'
config global_app

View File

@ -1,4 +1,5 @@
google.com
youtube.com
github.com
raw.githubusercontent.com
github-production-release-asset-2e65be.s3.amazonaws.com

View File

@ -158,7 +158,7 @@ PROXY_MODE=$(config_t_get global proxy_mode gfwlist)
load_config() {
[ "$TCP_NODE1" == "nil" -a "$UDP_NODE1" == "nil" -a "$SOCKS5_NODE1" == "nil" ] && {
echolog "没有选择服务器"
echolog "没有选择节点"
return 1
}
DNS_MODE=$(config_t_get global dns_mode ChinaDNS)
@ -236,6 +236,7 @@ gen_config_file() {
local_port=$2
redir_type=$3
config_file_path=$4
remarks=$(config_n_get $node remarks)
server_host=$(config_n_get $node address)
use_ipv6=$(config_n_get $node use_ipv6)
network_type="ipv4"
@ -243,7 +244,8 @@ gen_config_file() {
server_ip=$(get_host_ip $network_type $server_host)
port=$(config_n_get $node port)
type=$(echo $(config_n_get $node type) | tr 'A-Z' 'a-z')
echolog "$redir_type服务器IP地址:$server_ip"
echolog "$redir_type节点$remarks"
echolog "$redir_type节点IP$server_ip"
if [ "$redir_type" == "Socks5" ]; then
if [ "$network_type" == "ipv6" ]; then
@ -330,7 +332,7 @@ gen_config_file() {
network_type="ipv4"
[ "$kcptun_use_ipv6" == "1" ] && network_type="ipv6"
kcptun_server_ip=$(get_host_ip $network_type $kcptun_server_host)
echolog "KCP服务器IP地址:$kcptun_server_ip"
echolog "KCP节点IP地址:$kcptun_server_ip"
TCP_NODE1_IP=$kcptun_server_ip
start_kcptun "$kcptun_path" $kcptun_server_ip $kcptun_port "$kcptun_config"
fi
@ -396,16 +398,16 @@ start_tcp_redir() {
local port=$(config_n_get $temp_server port)
local server_username=$(config_n_get $temp_server username)
local server_password=$(config_n_get $temp_server password)
#ipt2socks_bin=$(find_bin ipt2socks)
#[ -n "$ipt2socks_bin" ] && {
# $ipt2socks_bin -T -l $port -b 0.0.0.0 -s $address -p $port -R >/dev/null &
#}
redsocks_bin=$(find_bin redsocks2)
[ -n "$redsocks_bin" ] && {
local redsocks_config_file=$CONFIG_PATH/TCP_$i.conf
gen_redsocks_config $redsocks_config_file tcp $port $address $port $server_username $server_password
$redsocks_bin -c $redsocks_config_file >/dev/null &
ipt2socks_bin=$(find_bin ipt2socks)
[ -n "$ipt2socks_bin" ] && {
$ipt2socks_bin -T -l $port -b 0.0.0.0 -s $address -p $port -R >/dev/null &
}
#redsocks_bin=$(find_bin redsocks2)
#[ -n "$redsocks_bin" ] && {
# local redsocks_config_file=$CONFIG_PATH/TCP_$i.conf
# gen_redsocks_config $redsocks_config_file tcp $port $address $port $server_username $server_password
# $redsocks_bin -c $redsocks_config_file >/dev/null &
#}
elif [ "$TYPE" == "ss" -o "$TYPE" == "ssr" ]; then
ss_bin=$(find_bin "$TYPE"-redir)
[ -n "$ss_bin" ] && {
@ -452,33 +454,33 @@ start_udp_redir() {
local port=$(config_n_get $temp_server port)
local server_username=$(config_n_get $temp_server username)
local server_password=$(config_n_get $temp_server password)
#ipt2socks_bin=$(find_bin ipt2socks)
#[ -n "$ipt2socks_bin" ] && {
# $ipt2socks_bin -U -l $port -b 0.0.0.0 -s 127.0.0.1 -p $socks5_port -R >/dev/null &
#}
redsocks_bin=$(find_bin redsocks2)
[ -n "$redsocks_bin" ] && {
local redsocks_config_file=$CONFIG_PATH/redsocks_UDP_$i.conf
gen_redsocks_config $redsocks_config_file udp $port "127.0.0.1" $socks5_port
$redsocks_bin -c $redsocks_config_file >/dev/null &
ipt2socks_bin=$(find_bin ipt2socks)
[ -n "$ipt2socks_bin" ] && {
$ipt2socks_bin -U -l $port -b 0.0.0.0 -s 127.0.0.1 -p $socks5_port -R >/dev/null &
}
#redsocks_bin=$(find_bin redsocks2)
#[ -n "$redsocks_bin" ] && {
# local redsocks_config_file=$CONFIG_PATH/redsocks_UDP_$i.conf
# gen_redsocks_config $redsocks_config_file udp $port "127.0.0.1" $socks5_port
# $redsocks_bin -c $redsocks_config_file >/dev/null &
#}
elif [ "$TYPE" == "socks5" ]; then
local address=$(config_n_get $temp_server address)
local port=$(config_n_get $temp_server port)
local server_username=$(config_n_get $temp_server username)
local server_password=$(config_n_get $temp_server password)
#ipt2socks_bin=$(find_bin ipt2socks)
#[ -n "$ipt2socks_bin" ] && {
# $ipt2socks_bin -U -l $port -b 0.0.0.0 -s $address -p $port -R >/dev/null &
#}
redsocks_bin=$(find_bin redsocks2)
[ -n "$redsocks_bin" ] && {
local redsocks_config_file=$CONFIG_PATH/UDP_$i.conf
gen_redsocks_config $redsocks_config_file udp $port $address $port $server_username $server_password
$redsocks_bin -c $redsocks_config_file >/dev/null &
ipt2socks_bin=$(find_bin ipt2socks)
[ -n "$ipt2socks_bin" ] && {
$ipt2socks_bin -U -l $port -b 0.0.0.0 -s $address -p $port -R >/dev/null &
}
#redsocks_bin=$(find_bin redsocks2)
#[ -n "$redsocks_bin" ] && {
# local redsocks_config_file=$CONFIG_PATH/UDP_$i.conf
# gen_redsocks_config $redsocks_config_file udp $port $address $port $server_username $server_password
# $redsocks_bin -c $redsocks_config_file >/dev/null &
#}
elif [ "$TYPE" == "ss" -o "$TYPE" == "ssr" ]; then
ss_bin=$(find_bin "$TYPE"-redir)
[ -n "$ss_bin" ] && {
@ -520,7 +522,7 @@ start_socks5_proxy() {
trojan_bin=$(find_bin trojan)
[ -n "$trojan_bin" ] && $trojan_bin -c $config_file >/dev/null 2>&1 &
elif [ "$TYPE" == "socks5" ]; then
echolog "Socks5服务器不能使用Socks5代理服务器"
echolog "Socks5节点不能使用Socks5代理节点"
elif [ "$TYPE" == "ss" -o "$TYPE" == "ssr" ]; then
ss_bin=$(find_bin "$TYPE"-local)
[ -n "$ss_bin" ] && $ss_bin -c $config_file -b 0.0.0.0 >/dev/null 2>&1 &
@ -560,10 +562,10 @@ set_cru() {
if [ "$autoupdatesubscribe" = "1" ]; then
if [ "$weekupdatesubscribe" = "7" ]; then
echo "0 $dayupdatesubscribe * * * $APP_PATH/subscription.sh" >>/etc/crontabs/root
echolog "设置服务器订阅自动更新规则在每天 $dayupdatesubscribe 点。"
echolog "设置节点订阅自动更新规则在每天 $dayupdatesubscribe 点。"
else
echo "0 $dayupdatesubscribe * * $weekupdate $APP_PATH/subscription.sh" >>/etc/crontabs/root
echolog "设置服务器订阅自动更新规则在星期 $weekupdate$dayupdatesubscribe 点。"
echolog "设置节点订阅自动更新规则在星期 $weekupdate$dayupdatesubscribe 点。"
fi
else
sed -i '/subscription.sh/d' /etc/crontabs/root >/dev/null 2>&1 &
@ -628,7 +630,7 @@ start_dns() {
echolog "运行DNS转发模式dns2socks..."
}
else
echolog "dns2socks模式需要使用Socks5代理服务器,请开启!"
echolog "dns2socks模式需要使用Socks5代理节点,请开启!"
fi
;;
Pcap_DNSProxy)
@ -647,7 +649,7 @@ start_dns() {
}
;;
local_7913)
echolog "运行DNS转发模式使用本机7913端口DNS服务解析域名..."
echolog "运行DNS转发模式使用本机7913端口DNS服务解析域名..."
;;
chinadns)
chinadns_bin=$(find_bin ChinaDNS)
@ -980,7 +982,7 @@ stop_dnsmasq() {
rm -rf $DNSMASQ_PATH/dnsmasq-$CONFIG.conf
rm -rf $TMP_DNSMASQ_PATH
/etc/init.d/dnsmasq restart 2>/dev/null
echolog "没有选择服务器"
echolog "没有选择节点"
fi
}
@ -1033,10 +1035,10 @@ start_haproxy() {
fi
if [ "$bbackup" = "1" ]; then
bbackup=" backup"
echolog "添加故障转移备服务器:$bips"
echolog "添加故障转移备节点:$bips"
else
bbackup=""
echolog "添加负载均衡主服务器:$bips"
echolog "添加负载均衡主节点:$bips"
fi
#si=$(echo $bips | grep -E "([0-9]{1,3}[\.]){3}[0-9]{1,3}")
#if [ -z "$si" ]; then
@ -1081,7 +1083,7 @@ start_haproxy() {
stats admin if TRUE
EOF
nohup $haproxy_bin -f $HAPROXY_FILE 2>&1
echolog "负载均衡服务运行成功!"
echolog "负载均衡运行成功!"
}
}
}
@ -1134,13 +1136,13 @@ boot() {
}
start() {
#防止并发启动
[ -f "$LOCK_FILE" ] && return 3
touch "$LOCK_FILE"
echolog "开始运行脚本!"
! load_config && return 1
add_vps_port
start_haproxy
#防止并发开启服务
[ -f "$LOCK_FILE" ] && return 3
touch "$LOCK_FILE"
start_socks5_proxy
start_tcp_redir
start_udp_redir
@ -1171,7 +1173,7 @@ stop() {
rm -rf $CONFIG_PATH
stop_dnsmasq
stop_crontab
echolog "关闭相关服务,清理相关文件和缓存完成。\n"
echolog "关闭相关程序,清理相关文件和缓存完成。\n"
sleep 1s
}

View File

@ -389,7 +389,7 @@ add_firewall_rule() {
fi
done
else
echolog "主服务器未选择无法转发TCP"
echolog "主节点未选择无法转发TCP"
fi
if [ "$UDP_NODE_NUM" -ge 1 ]; then
@ -428,7 +428,7 @@ add_firewall_rule() {
fi
done
else
echolog "UDP服务器未选择无法转发UDP"
echolog "UDP节点未选择无法转发UDP"
fi
$iptables_mangle -A PREROUTING -j SS

View File

@ -33,16 +33,18 @@ uci_get_by_type() {
# rule update
echo $Date: 开始更新规则,请等待... >$LOG_FILE
#wget -q --no-check-certificate --timeout=15 https://raw.githubusercontent.com/monokoo/koolshare.github.io/acelan_softcenter_ui/maintain_files/version1 -O /tmp/version1
status1=$(curl -w %{http_code} --connect-timeout 10 $url_main/version1 --silent -o /tmp/version1)
if [ -z "$status1" ] || [ "$status1" == "404" ]; then
echo $Date: 无法访问更新接口,请更新接口! >>$LOG_FILE
exit
fi
status=$(/usr/bin/curl -w %{http_code} --connect-timeout 10 $url_main/version1 --silent -o /tmp/version1)
[ "$?" != 0 ] || [ -z "$status" ] || [ "$status" != "200" ] && {
status=$(/usr/bin/wget -q --no-check-certificate --timeout=15 $url_main/version1 -O /tmp/version1)
[ "$?" != 0 ] || [ -z "$status" ] && {
echo $Date: 无法访问更新接口,请更新接口! >>$LOG_FILE
exit
}
}
online_content=$(cat /tmp/version1 2>/dev/null)
if [ -z "$online_content" ]; then
rm -rf /tmp/version1
echo $Date: 没有检测到在线版本可能是访问github有问题,去大陆白名单模式试试吧 >>$LOG_FILE
echo $Date: 没有检测到在线版本可能是访问github有问题 >>$LOG_FILE
exit
fi
@ -57,12 +59,14 @@ if [ "$gfwlist_update" == 1 ]; then
if [ "$version_gfwlist1" != "$version_gfwlist2" -o "$md5sum_gfwlist2" != "$local_md5sum_gfwlist" ]; then
echo $Date: 检测到新版本gfwlist开始更新... >>$LOG_FILE
echo $Date: 下载gfwlist到临时文件... >>$LOG_FILE
#wget --no-check-certificate --timeout=15 -q https://raw.githubusercontent.com/monokoo/koolshare.github.io/acelan_softcenter_ui/maintain_files/gfwlist.conf -O /tmp/gfwlist.conf
status2=$(curl -w %{http_code} --connect-timeout 10 $url_main/gfwlist.conf --silent -o /tmp/gfwlist.conf)
if [ -z "$status2" ] || [ "$status2" == "404" ]; then
echo $Date: 无法访问更新接口,请更新接口! >>$LOG_FILE
exit
fi
status=$(/usr/bin/curl -w %{http_code} --connect-timeout 10 $url_main/gfwlist.conf --silent -o /tmp/gfwlist.conf)
[ "$?" != 0 ] || [ -z "$status" ] || [ "$status" != "200" ] && {
status=$(/usr/bin/wget --no-check-certificate --timeout=15 -q $url_main/gfwlist.conf -O /tmp/gfwlist.conf)
[ "$?" != 0 ] || [ -z "$status" ] && {
echo $Date: 无法访问更新接口,请更新接口! >>$LOG_FILE
exit
}
}
md5sum_gfwlist1=$(md5sum /tmp/gfwlist.conf | sed 's/ /\n/g' | sed -n 1p)
if [ "$md5sum_gfwlist1"x = "$md5sum_gfwlist2"x ]; then
echo $Date: 下载完成校验通过将临时文件覆盖到原始gfwlist文件 >>$LOG_FILE
@ -94,12 +98,14 @@ if [ "$chnroute_update" == 1 ]; then
if [ "$version_chnroute1" != "$version_chnroute2" -o "$md5sum_chnroute2" != "$local_md5sum_chnroute" ]; then
echo $Date: 检测到新版本chnroute开始更新... >>$LOG_FILE
echo $Date: 下载chnroute到临时文件... >>$LOG_FILE
#wget --no-check-certificate --timeout=15 -q https://raw.githubusercontent.com/monokoo/koolshare.github.io/acelan_softcenter_ui/maintain_files/chnroute.txt -O /tmp/chnroute
status3=$(curl -w %{http_code} --connect-timeout 10 $url_main/chnroute.txt --silent -o /tmp/chnroute)
if [ -z "$status3" ] || [ "$status3" == "404" ]; then
echo $Date: 无法访问更新接口,请更新接口! >>$LOG_FILE
exit
fi
status=$(/usr/bin/curl -w %{http_code} --connect-timeout 10 $url_main/chnroute.txt --silent -o /tmp/chnroute)
[ "$?" != 0 ] || [ -z "$status" ] || [ "$status" != "200" ] && {
status=$(/usr/bin/wget --no-check-certificate --timeout=15 -q $url_main/chnroute.txt -O /tmp/chnroute)
[ "$?" != 0 ] || [ -z "$status" ] && {
echo $Date: 无法访问更新接口,请更新接口! >>$LOG_FILE
exit
}
}
md5sum_chnroute1=$(md5sum /tmp/chnroute | sed 's/ /\n/g' | sed -n 1p)
if [ "$md5sum_chnroute1"x = "$md5sum_chnroute2"x ]; then
echo $Date: 下载完成校验通过将临时文件覆盖到原始chnroute文件 >>$LOG_FILE

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
. /usr/share/libubox/jshn.sh
@ -15,6 +15,8 @@ config_t_get() {
echo $ret
}
urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
decode_url_link() {
link=$1
num=$2
@ -23,9 +25,25 @@ decode_url_link() {
if [ "$mod4" -gt 0 ]; then
var="===="
newlink=${link}${var:$mod4}
echo -n "$newlink" | sed 's/-/+/g; s/_/\//g' | /usr/bin/base64 -d -i 2> /dev/null
echo -n "$newlink" | sed 's/-/+/g; s/_/\//g' | base64 -d -i 2> /dev/null
else
echo -n "$link" | sed 's/-/+/g; s/_/\//g' | /usr/bin/base64 -d -i 2> /dev/null
echo -n "$link" | sed 's/-/+/g; s/_/\//g' | base64 -d -i 2> /dev/null
fi
}
ss_decode() {
temp_link=$1
if [[ "$(echo $temp_link | grep "@")" != "" ]]; then
link1=$(decode_url_link $(echo -n "$temp_link" | awk -F '@' '{print $1}') 1)
link2=$(echo -n "$temp_link" | awk -F '@' '{print $2}')
echo -n "${link1}@${link2}"
elif [[ "$(echo $temp_link | grep "#")" != "" ]]; then
link1=$(decode_url_link $(echo -n "$temp_link" | awk -F '#' '{print $1}') 1)
link2=$(echo -n "$temp_link" | awk -F '#' '{print $2}')
echo -n "${link1}#${link2}"
else
link1=$(decode_url_link $(echo -n "$temp_link" ) 1)
echo -n "$link1"
fi
}
@ -58,12 +76,15 @@ get_remote_config(){
group="sub_node"
if [ "$1" == "ss" ]; then
decode_link="$2"
node_address=$(echo "$decode_link" | awk -F ':' '{print $2}' | awk -F '@' '{print $2}')
node_port=$(echo "$decode_link" | awk -F ':' '{print $3}')
ssr_encrypt_method=$(echo "$decode_link" | awk -F ':' '{print $1}')
decode_link=$(ss_decode $decode_link)
ss_encrypt_method=$(echo "$decode_link" | awk -F ':' '{print $1}')
password=$(echo "$decode_link" | awk -F ':' '{print $2}' | awk -F '@' '{print $1}')
node_address=$(echo "$decode_link" | awk -F ':' '{print $2}' | awk -F '@' '{print $2}')
node_port=$(echo "$decode_link" | awk -F '@' '{print $2}' | awk -F '#' '{print $1}' | awk -F ':' '{print $2}')
remarks=$(urldecode $(echo "$decode_link" | awk -F '#' '{print $2}'))
elif [ "$1" == "ssr" ]; then
decode_link="$2"
decode_link=$(decode_url_link $decode_link 1)
node_address=$(echo "$decode_link" | awk -F ':' '{print $1}')
node_address=$(echo $node_address |awk '{print gensub(/[^!-~]/,"","g",$0)}')
[ -z "$node_address" -o "$node_address" == "" ] && isAdd=0
@ -81,7 +102,8 @@ get_remote_config(){
[ -n "$remarks_temp" ] && remarks="$(decode_url_link $remarks_temp 0)"
group_temp=$(echo "$decode_link" |grep -Eo "group.+" |sed 's/group=//g'|awk -F'&' '{print $1}')
elif [ "$1" == "v2ray" ]; then
json_load "$2"
decode_link=$(decode_url_link $2 1)
json_load "$decode_link"
json_get_var json_v v
json_get_var json_ps ps
json_get_var json_node_address add
@ -96,7 +118,7 @@ get_remote_config(){
json_get_var json_host host
json_get_var json_path path
if [ "$json_tls" == "1" ]; then
if [ "$json_tls" == "tls" -o "$json_tls" == "1" ]; then
json_tls="tls"
else
json_tls="none"
@ -112,7 +134,7 @@ get_remote_config(){
remarks="${node_address}:${node_port}"
fi
# 把全部服务器节点写入文件 /usr/share/${CONFIG}/sub/all_onlinenodes
# 把全部节点节点写入文件 /usr/share/${CONFIG}/sub/all_onlinenodes
if [ ! -f "/usr/share/${CONFIG}/sub/all_onlinenodes" ]; then
echo $node_address > /usr/share/${CONFIG}/sub/all_onlinenodes
else
@ -129,12 +151,12 @@ add_nodes(){
if [ "$2" == "ss" ]; then
${uci_set}add_mode="$add_mode"
${uci_set}remarks="$remarks"
${uci_set}type="SSR"
${uci_set}type="SS"
${uci_set}address="$node_address"
${uci_set}use_ipv6=0
${uci_set}port="$node_port"
${uci_set}password="$password"
${uci_set}ssr_encrypt_method="$ssr_encrypt_method"
${uci_set}ss_encrypt_method="$ss_encrypt_method"
${uci_set}timeout=300
${uci_set}tcp_fast_open=false
@ -227,7 +249,7 @@ update_config(){
}
del_config(){
# 删除订阅服务器已经不存在的节点
# 删除订阅节点已经不存在的节点
for localaddress in $(cat /usr/share/${CONFIG}/sub/all_localnodes)
do
[ "`cat /usr/share/${CONFIG}/sub/all_onlinenodes |grep -c "$localaddress"`" -eq 0 ] && {
@ -254,19 +276,64 @@ del_config(){
del_all_config(){
get_node_index
[ "`uci show $CONFIG | grep -c 'sub_node'`" -eq 0 ] && exit 0
current_tcp_node1=$(config_t_get global tcp_node1)
is_sub_node=`uci -q get $CONFIG.$current_tcp_node1.group`
TCP_NODE_NUM=$(uci get $CONFIG.@global_other[0].tcp_node_num)
for i in $(seq 1 $TCP_NODE_NUM); do
eval TCP_NODE$i=$(config_t_get global tcp_node$i)
done
UDP_NODE_NUM=$(uci get $CONFIG.@global_other[0].udp_node_num)
for i in $(seq 1 $UDP_NODE_NUM); do
eval UDP_NODE$i=$(config_t_get global udp_node$i)
done
SOCKS5_NODE_NUM=$(uci get $CONFIG.@global_other[0].socks5_node_num)
for i in $(seq 1 $SOCKS5_NODE_NUM); do
eval SOCKS5_NODE$i=$(config_t_get global socks5_node$i)
done
[ "$UDP_NODE1" == "default" ] && UDP_NODE1=$TCP_NODE1
for i in $(seq 1 $TCP_NODE_NUM); do
eval node=\$TCP_NODE$i
[ -n "$node" -a "$node" != "nil" ] && {
is_sub_node=`uci -q get $CONFIG.$node.group`
[ -n "$is_sub_node" ] && {
uci set $CONFIG.@global[0].tcp_node$i="nil" && uci commit $CONFIG
}
}
done
for i in $(seq 1 $UDP_NODE_NUM); do
eval node=\$UDP_NODE$i
[ "$node" != "nil" ] && {
is_sub_node=`uci -q get $CONFIG.$node.group`
[ -n "$is_sub_node" ] && {
uci set $CONFIG.@global[0].udp_node$i="nil" && uci commit $CONFIG
}
}
done
for i in $(seq 1 $SOCKS5_NODE_NUM); do
eval node=\$SOCKS5_NODE$i
[ "$node" != "nil" ] && {
is_sub_node=`uci -q get $CONFIG.$node.group`
[ -n "$is_sub_node" ] && {
uci set $CONFIG.@global[0].socks5_node$i="nil" && uci commit $CONFIG
}
}
done
for i in `seq $nodes_index -1 1`
do
[ "$(uci show $CONFIG.@nodes[$(($i-1))] | grep -c 'sub_node')" -eq 1 ] && uci delete $CONFIG.@nodes[$(($i-1))] && uci commit $CONFIG
done
[ -n "$is_sub_node" ] && {
uci set $CONFIG.global[0].tcp_node1="nil"
uci commit $CONFIG && /etc/init.d/$CONFIG stop
}
/etc/init.d/$CONFIG stop
}
add() {
base64=$(command -v base64)
[ -z "$base64" ] && echo "$Date: 找不到Base64程序请安装后重试" >> $LOG_FILE && rm -f "$LOCK_FILE" && exit 0
LINKS=$(cat /tmp/links.conf 2>/dev/null)
[ -n "$LINKS" ] && {
[ -f "$LOCK_FILE" ] && return 3
@ -274,10 +341,9 @@ add() {
mkdir -p /usr/share/${CONFIG}/sub && rm -f /usr/share/${CONFIG}/sub/*
for link in $LINKS
do
is_decode=1
if expr "$link" : "ss://";then
link_type="ss"
new_link=$(echo -n "$link" | sed 's/ssr:\/\///g')
new_link=$(echo -n "$link" | sed 's/ss:\/\///g')
elif expr "$link" : "ssr://";then
link_type="ssr"
new_link=$(echo -n "$link" | sed 's/ssr:\/\///g')
@ -287,10 +353,8 @@ add() {
elif expr "$link" : "trojan://";then
link_type="trojan"
new_link=$(echo -n "$link" | sed 's/trojan:\/\///g')
is_decode=0
fi
[ -z "$link_type" ] && continue
[ "$is_decode" == 1 ] && new_link=$(decode_url_link $new_link 1)
get_remote_config "$link_type" "$new_link" 1
update_config
done
@ -305,6 +369,8 @@ start() {
# 防止并发开启服务
[ -f "$LOCK_FILE" ] && return 3
touch "$LOCK_FILE"
base64=$(command -v base64)
[ -z "$base64" ] && echo "$Date: 找不到Base64程序请安装后重试" >> $LOG_FILE && rm -f "$LOCK_FILE" && exit 0
addnum_ss=0
updatenum_ss=0
delnum_ss=0
@ -322,16 +388,25 @@ start() {
echo "$Date: 开始订阅..." >> $LOG_FILE
mkdir -p /var/${CONFIG}_sub && rm -f /var/${CONFIG}_sub/*
#/usr/bin/wget --no-check-certificate --timeout=8 -t 2 $subscribe_url -P /var/${CONFIG}_sub
status=$(curl -w %{http_code} --connect-timeout 10 $subscribe_url --silent -o /var/${CONFIG}_sub/sub)
[ -z "$status" ] || [ "$status" == "404" ] || [ ! -d "/var/${CONFIG}_sub" ] || [ "$(ls /var/${CONFIG}_sub | wc -l)" -eq 0 ] && echo "$Date: 订阅链接下载失败,请重试!" >> $LOG_FILE && rm -f "$LOCK_FILE" && exit 0
index=0
for url in $subscribe_url
do
let index+=1
echo "$Date: 正在订阅:$url" >> $LOG_FILE
result=$(/usr/bin/curl --connect-timeout 10 -sL $url)
[ "$?" != 0 ] || [ -z "$result" ] && {
result=$(/usr/bin/wget --no-check-certificate --timeout=8 -t 1 -O- $url)
[ "$?" != 0 ] || [ -z "$result" ] && echo "$Date: 订阅失败:$url,请检测订阅链接是否正常或使用代理尝试!" >> $LOG_FILE && continue
}
echo "$result" > /var/${CONFIG}_sub/$index
done
[ ! -d "/var/${CONFIG}_sub" ] || [ "$(ls /var/${CONFIG}_sub | wc -l)" -eq 0 ] && echo "$Date: 订阅失败" >> $LOG_FILE && rm -f "$LOCK_FILE" && exit 0
mkdir -p /usr/share/${CONFIG}/sub && rm -f /usr/share/${CONFIG}/sub/*
get_local_nodes
for file in /var/${CONFIG}_sub/*
do
[ -z "$(du -sh $file 2> /dev/null)" ] && echo "$Date: 订阅链接下载 $file 失败,请重试!" >> $LOG_FILE && continue
decode_link=$(cat "$file" | /usr/bin/base64 -d 2> /dev/null)
[ -z "$(du -sh $file 2> /dev/null)" ] && echo "$Date: 订阅失败:$url,解密失败" >> $LOG_FILE && continue
decode_link=$(cat "$file" | base64 -d 2> /dev/null)
maxnum=$(echo -n "$decode_link" | grep "MAX=" | awk -F"=" '{print $2}')
if [ -n "$maxnum" ]; then
decode_link=$(echo -n "$decode_link" | sed '/MAX=/d' | shuf -n${maxnum})
@ -342,10 +417,9 @@ start() {
[ -z "$decode_link" ] && continue
for link in $decode_link
do
is_decode=1
if expr "$link" : "ss://";then
link_type="ss"
new_link=$(echo -n "$link" | sed 's/ssr:\/\///g')
new_link=$(echo -n "$link" | sed 's/ss:\/\///g')
elif expr "$link" : "ssr://";then
link_type="ssr"
new_link=$(echo -n "$link" | sed 's/ssr:\/\///g')
@ -355,19 +429,17 @@ start() {
elif expr "$link" : "trojan://";then
link_type="trojan"
new_link=$(echo -n "$link" | sed 's/trojan:\/\///g')
is_decode=0
fi
[ -z "$link_type" ] && continue
[ "$is_decode" == 1 ] && new_link=$(decode_url_link $new_link 1)
get_remote_config "$link_type" "$new_link"
update_config
done
done
[ -f "/usr/share/${CONFIG}/sub/all_localnodes" ] && del_config
echo "$Date: 本次更新SS新增服务器节点 $addnum_ss 个,修改 $updatenum_ss 个,删除 $delnum_ss 个。" >> $LOG_FILE
echo "$Date: 本次更新SSR新增服务器节点 $addnum_ssr 个,修改 $updatenum_ssr 个,删除 $delnum_ssr 个。" >> $LOG_FILE
echo "$Date: 本次更新V2ray新增服务器节点 $addnum_v2ray 个,修改 $updatenum_v2ray 个,删除 $delnum_v2ray 个。" >> $LOG_FILE
echo "$Date: 本次更新Trojan新增服务器节点 $addnum_trojan 个,修改 $updatenum_trojan 个,删除 $delnum_trojan 个。" >> $LOG_FILE
echo "$Date: 本次更新SS节点新增 $addnum_ss 个,修改 $updatenum_ss 个,删除 $delnum_ss 个。" >> $LOG_FILE
echo "$Date: 本次更新SSR节点新增 $addnum_ssr 个,修改 $updatenum_ssr 个,删除 $delnum_ssr 个。" >> $LOG_FILE
echo "$Date: 本次更新V2ray节点新增 $addnum_v2ray 个,修改 $updatenum_v2ray 个,删除 $delnum_v2ray 个。" >> $LOG_FILE
echo "$Date: 本次更新Trojan节点新增 $addnum_trojan 个,修改 $updatenum_trojan 个,删除 $delnum_trojan 个。" >> $LOG_FILE
echo "$Date: 订阅完毕..." >> $LOG_FILE
rm -f "$LOCK_FILE"
exit 0
@ -375,8 +447,8 @@ start() {
stop() {
[ "`uci show $CONFIG | grep -c 'sub_node'`" -gt 0 ] && {
echo "$Date: 在线订阅节点已全部删除" >> $LOG_FILE
del_all_config
echo "$Date: 在线订阅节点已全部删除" >> $LOG_FILE
}
rm -rf /var/${CONFIG}_sub
rm -rf /usr/share/${CONFIG}/sub
@ -395,3 +467,4 @@ add)
start
;;
esac

View File

@ -8,7 +8,10 @@ get_date() {
}
test_url() {
status=$(curl -I -o /dev/null -s --connect-timeout 5 -w %{http_code} "$1" | grep 200)
status=$(/usr/bin/curl -I -o /dev/null -s --connect-timeout 3 -w %{http_code} "$1" | grep 200)
[ "$?" != 0 ] && {
status=$(/usr/bin/wget --no-check-certificate --spider --timeout=3 "$1")
}
echo $status
}
@ -97,7 +100,7 @@ test_reconnection() {
echo "$(get_date): 掉线重连检测:第$failcount次检测异常" >>/var/log/passwall.log
let "failcount++"
[ "$failcount" -ge 6 ] && {
echo "$(get_date): 掉线重连检测:检测异常,重启服务" >>/var/log/passwall.log
echo "$(get_date): 掉线重连检测:检测异常,重启程序" >>/var/log/passwall.log
rm -f $LOCK_FILE
/etc/init.d/passwall restart
exit 1
@ -110,19 +113,30 @@ test_reconnection() {
done
}
#防止并发执行
if [ -f "$LOCK_FILE" ]; then
exit 1
else
touch $LOCK_FILE
fi
start() {
#防止并发执行
if [ -f "$LOCK_FILE" ]; then
exit 1
else
touch $LOCK_FILE
fi
is_auto_switch=$(uci show $CONFIG.@auto_switch[0] | grep "tcp_node")
if [ -z "$is_auto_switch" ]; then
test_reconnection
else
test_auto_switch
fi
is_auto_switch=$(uci show $CONFIG.@auto_switch[0] | grep "tcp_node")
if [ -z "$is_auto_switch" ]; then
test_reconnection
else
test_auto_switch
fi
rm -f $LOCK_FILE
exit
rm -f $LOCK_FILE
exit
}
case $1 in
test_url)
test_url $2
;;
*)
start
;;
esac

View File

@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
LUCI_TITLE:=Bootstrap Magic Change Theme By Lienol
LUCI_DEPENDS:=
PKG_VERSION:=1.0
PKG_RELEASE:=40-20191207
PKG_RELEASE:=42-20191213
include $(TOPDIR)/feeds/luci/luci.mk