luci-app-passwall: sync with upstream source
This commit is contained in:
parent
c383af3c3a
commit
3a3aab545f
@ -7,8 +7,8 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-passwall
|
||||
PKG_VERSION:=3.6
|
||||
PKG_RELEASE:=5
|
||||
PKG_DATE:=20200227
|
||||
PKG_RELEASE:=6
|
||||
PKG_DATE:=20200228
|
||||
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
|
||||
@ -120,14 +120,14 @@ function status()
|
||||
e.haproxy_status = luci.sys.call(string.format(
|
||||
"ps -w | grep -v grep | grep '%s/bin/' | grep haproxy >/dev/null",
|
||||
appname)) == 0
|
||||
e.kcptun_status = luci.sys.call(
|
||||
"ps -w | grep -v grep | grep -i 'log /var/etc/" ..
|
||||
appname .. "/kcptun' >/dev/null") == 0
|
||||
|
||||
local tcp_node_num = luci.sys.exec(
|
||||
"echo -n `uci -q get %s.@global_other[0].tcp_node_num`" %
|
||||
appname)
|
||||
for i = 1, tcp_node_num, 1 do
|
||||
e["kcptun_tcp_node%s_status" % i] =
|
||||
luci.sys.call(string.format(
|
||||
"ps -w | grep -v grep | grep '%s/bin/' | grep 'kcptun_tcp_%s' >/dev/null",
|
||||
appname, i)) == 0
|
||||
e["tcp_node%s_status" % i] = luci.sys.call(
|
||||
string.format(
|
||||
"ps -w | grep -v grep | grep '%s/bin/' | grep -i -E 'TCP_%s|brook_tcp_%s|ipt2socks_tcp_%s' >/dev/null",
|
||||
@ -148,6 +148,10 @@ function status()
|
||||
"echo -n `uci -q get %s.@global_other[0].socks5_node_num`" %
|
||||
appname)
|
||||
for i = 1, socks5_node_num, 1 do
|
||||
e["kcptun_socks_node%s_status" % i] =
|
||||
luci.sys.call(string.format(
|
||||
"ps -w | grep -v grep | grep '%s/bin/' | grep 'kcptun_socks_%s' >/dev/null",
|
||||
appname, i)) == 0
|
||||
e["socks5_node%s_status" % i] = luci.sys.call(
|
||||
string.format(
|
||||
"ps -w | grep -v grep | grep '%s/bin/' | grep -i -E 'SOCKS5_%s|brook_socks_%s' >/dev/null",
|
||||
@ -185,6 +189,9 @@ function ping_node()
|
||||
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
|
||||
luci.sys.call(string.format(
|
||||
"ps -w | grep 'tcping -q -c 1 -i 1 -p %s %s' | grep -v grep | awk '{print $1}' | xargs kill -9 > /dev/null",
|
||||
port, address))
|
||||
e.ping = luci.sys.exec(string.format(
|
||||
"echo -n $(tcping -q -c 1 -i 1 -p %s %s 2>&1 | grep -o 'time=[0-9]*' | awk -F '=' '{print$2}')",
|
||||
port, address))
|
||||
|
||||
@ -283,6 +283,25 @@ https://github.com/pure-css/pure/blob/master/LICENSE.md
|
||||
}
|
||||
status_tcp_node.innerHTML = text;
|
||||
}
|
||||
var status_kcptun = document.getElementById('status_kcptun');
|
||||
if (status_kcptun) {
|
||||
var text = 'Kcptun<br />';
|
||||
if (tcp_node_num == 1) {
|
||||
if (data["kcptun_tcp_node1_status"])
|
||||
text += '<span class="green"><%:RUNNING%></span>';
|
||||
else
|
||||
text += '<span class="red"><%:NOT RUNNING%></span>';
|
||||
} else {
|
||||
for(var i = 0; i < tcp_node_num; i++) {
|
||||
var k = i + 1;
|
||||
if (data["kcptun_tcp_node" + k + "_status"])
|
||||
text += '<span class="green"> ✓</span>';
|
||||
else
|
||||
text += '<span class="red"> X</span>';
|
||||
}
|
||||
}
|
||||
status_kcptun.innerHTML = text;
|
||||
}
|
||||
}
|
||||
|
||||
var udp_node_num = <%=udp_node_num%>;
|
||||
@ -343,13 +362,6 @@ https://github.com/pure-css/pure/blob/master/LICENSE.md
|
||||
status_haproxy.innerHTML = '<%:Load Balancing%><br /><span class="red"><%:NOT RUNNING%></span>'
|
||||
}
|
||||
}
|
||||
if (status_kcptun) {
|
||||
if (data.kcptun_status) {
|
||||
status_kcptun.innerHTML = 'Kcptun<br /><span class="green"><%:RUNNING%></span>'
|
||||
} else {
|
||||
status_kcptun.innerHTML = 'Kcptun<br /><span class="red"><%:NOT RUNNING%></span>'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -64,53 +64,44 @@ local status_show_ip111 = api.uci_get_type("global_other", "status_show_ip111",
|
||||
<%:Running Status%>
|
||||
</legend>
|
||||
<fieldset class="cbi-section">
|
||||
<% if tcp_node_num and tonumber(tcp_node_num) >= 1 then %>
|
||||
<% for i = 1, tcp_node_num, 1 do %>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title">TCP_<%=i%>
|
||||
<%:Status%>
|
||||
</label>
|
||||
<div class="cbi-value-field" id="_tcp_node<%=i%>_status">
|
||||
<%:Collecting data...%>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if udp_node_num and tonumber(udp_node_num) >= 1 then %>
|
||||
<% for i = 1, udp_node_num, 1 do %>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title">UDP_<%=i%>
|
||||
<%:Status%>
|
||||
</label>
|
||||
<div class="cbi-value-field" id="_udp_node<%=i%>_status">
|
||||
<%:Collecting data...%>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if socks5_node_num and tonumber(socks5_node_num) >= 1 then %>
|
||||
<% for i = 1, socks5_node_num, 1 do %>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title">Socks5_<%=i%>
|
||||
<%:Status%>
|
||||
</label>
|
||||
<div class="cbi-value-field" id="_socks5_node<%=i%>_status">
|
||||
<%:Collecting data...%>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title">DNS
|
||||
<label class="cbi-value-title">TCP
|
||||
<%:Status%>
|
||||
</label>
|
||||
<div class="cbi-value-field" id="_dns_mode_status">
|
||||
<div class="cbi-value-field" id="_tcp_node_status">
|
||||
<%:Collecting data...%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title">UDP
|
||||
<%:Status%>
|
||||
</label>
|
||||
<div class="cbi-value-field" id="_udp_node_status">
|
||||
<%:Collecting data...%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title">Socks5
|
||||
<%:Status%>
|
||||
</label>
|
||||
<div class="cbi-value-field" id="_socks5_node_status">
|
||||
<%:Collecting data...%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% if ipkg.installed("kcptun") or is_finded("kcptun*") then %>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title">Kcptun
|
||||
<%:Status%>
|
||||
</label>
|
||||
<div class="cbi-value-field" id="_kcptun_tcp_node_status">
|
||||
<%:Collecting data...%>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if ipkg.installed("haproxy") or is_finded("haproxy*") then %>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title">
|
||||
@ -121,16 +112,16 @@ local status_show_ip111 = api.uci_get_type("global_other", "status_show_ip111",
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if ipkg.installed("kcptun") or is_finded("kcptun*") then %>
|
||||
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title">
|
||||
<%:Kcptun%>
|
||||
<label class="cbi-value-title">DNS
|
||||
<%:Status%>
|
||||
</label>
|
||||
<div class="cbi-value-field" id="_kcptun_status">
|
||||
<div class="cbi-value-field" id="_dns_mode_status">
|
||||
<%:Collecting data...%>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title">
|
||||
<%:Baidu Connection%>
|
||||
@ -182,33 +173,96 @@ local status_show_ip111 = api.uci_get_type("global_other", "status_show_ip111",
|
||||
XHR.poll(3, '<%=dsp.build_url("admin/vpn/passwall/status")%>', null,
|
||||
function(x, json) {
|
||||
if(x && x.status == 200) {
|
||||
<% if tcp_node_num and tonumber(tcp_node_num) >= 1 then %>
|
||||
<% for i = 1, tcp_node_num, 1 do %>
|
||||
var tcp_node<%=i%>_status = document.getElementById('_tcp_node<%=i%>_status');
|
||||
if(tcp_node<%=i%>_status)
|
||||
tcp_node<%=i%>_status.innerHTML = json.tcp_node<%=i%>_status ? '<font color="green"><%:RUNNING%> ✓</font>' : '<font color="red"><%:NOT RUNNING%> X</font>';
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if udp_node_num and tonumber(udp_node_num) >= 1 then %>
|
||||
<% for i = 1, udp_node_num, 1 do %>
|
||||
var udp_node<%=i%>_status = document.getElementById('_udp_node<%=i%>_status');
|
||||
if(udp_node<%=i%>_status)
|
||||
udp_node<%=i%>_status.innerHTML = json.udp_node<%=i%>_status ? '<font color="green"><%:RUNNING%> ✓</font>' : '<font color="red"><%:NOT RUNNING%> X</font>';
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if socks5_node_num and tonumber(socks5_node_num) >= 1 then %>
|
||||
<% for i = 1, socks5_node_num, 1 do %>
|
||||
var socks5_node<%=i%>_status = document.getElementById('_socks5_node<%=i%>_status');
|
||||
if(socks5_node<%=i%>_status)
|
||||
socks5_node<%=i%>_status.innerHTML = json.socks5_node<%=i%>_status ? '<font color="green"><%:RUNNING%> ✓</font>' : '<font color="red"><%:NOT RUNNING%> X</font>';
|
||||
<% end %>
|
||||
<% end %>
|
||||
if(dns_mode_status)
|
||||
dns_mode_status.innerHTML = json.dns_mode_status ? '<font color="green"><%:RUNNING%> ✓</font>' : '<font color="red"><%:NOT RUNNING%> X</font>';
|
||||
var tcp_node_status = document.getElementById('_tcp_node_status');
|
||||
if (tcp_node_status) {
|
||||
var tcp_node_num = <%=tcp_node_num%>;
|
||||
if (tcp_node_num >= 1) {
|
||||
var text = '';
|
||||
if (tcp_node_num == 1) {
|
||||
if (json["tcp_node1_status"])
|
||||
text += '<font color="green"><%:RUNNING%> ✓</font>';
|
||||
else
|
||||
text += '<font color="red"><%:NOT RUNNING%> X</font>';
|
||||
} else {
|
||||
for(var i = 0; i < tcp_node_num; i++) {
|
||||
var k = i + 1;
|
||||
if (json["tcp_node" + k + "_status"])
|
||||
text += '<font color="green" size="3"> ✓</font>';
|
||||
else
|
||||
text += '<font color="red" size="3"> X</font>';
|
||||
}
|
||||
}
|
||||
tcp_node_status.innerHTML = text;
|
||||
|
||||
var kcptun_tcp_node_status = document.getElementById('_kcptun_tcp_node_status');
|
||||
text = "";
|
||||
if (tcp_node_num == 1) {
|
||||
if (json["kcptun_tcp_node1_status"])
|
||||
text += '<font color="green"><%:RUNNING%> ✓</font>';
|
||||
else
|
||||
text += '<font color="red"><%:NOT RUNNING%> X</font>';
|
||||
} else {
|
||||
for(var i = 0; i < tcp_node_num; i++) {
|
||||
var k = i + 1;
|
||||
if (json["tcp_node" + k + "_status"])
|
||||
text += '<font color="green" size="3"> ✓</font>';
|
||||
else
|
||||
text += '<font color="red" size="3"> X</font>';
|
||||
}
|
||||
}
|
||||
kcptun_tcp_node_status.innerHTML = text;
|
||||
}
|
||||
}
|
||||
|
||||
var udp_node_status = document.getElementById('_udp_node_status');
|
||||
if (udp_node_status) {
|
||||
var udp_node_num = <%=udp_node_num%>;
|
||||
if (udp_node_num >= 1) {
|
||||
var text = '';
|
||||
if (udp_node_num == 1) {
|
||||
if (json["udp_node1_status"])
|
||||
text += '<font color="green"><%:RUNNING%> ✓</font>';
|
||||
else
|
||||
text += '<font color="red"><%:NOT RUNNING%> X</font>';
|
||||
} else {
|
||||
for(var i = 0; i < udp_node_num; i++) {
|
||||
var k = i + 1;
|
||||
if (json["udp_node" + k + "_status"])
|
||||
text += '<font color="green" size="3"> ✓</font>';
|
||||
else
|
||||
text += '<font color="red" size="3"> X</font>';
|
||||
}
|
||||
}
|
||||
udp_node_status.innerHTML = text;
|
||||
}
|
||||
}
|
||||
|
||||
var socks5_node_status = document.getElementById('_socks5_node_status');
|
||||
if (socks5_node_status) {
|
||||
var socks5_node_num = <%=socks5_node_num%>;
|
||||
if (socks5_node_num >= 1) {
|
||||
var text = '';
|
||||
if (socks5_node_num == 1) {
|
||||
if (json["socks5_node1_status"])
|
||||
text += '<font color="green"><%:RUNNING%> ✓</font>';
|
||||
else
|
||||
text += '<font color="red"><%:NOT RUNNING%> X</font>';
|
||||
} else {
|
||||
for(var i = 0; i < socks5_node_num; i++) {
|
||||
var k = i + 1;
|
||||
if (json["socks5_node" + k + "_status"])
|
||||
text += '<font color="green" size="3"> ✓</font>';
|
||||
else
|
||||
text += '<font color="red" size="3"> X</font>';
|
||||
}
|
||||
}
|
||||
socks5_node_status.innerHTML = text;
|
||||
}
|
||||
}
|
||||
if(haproxy_status)
|
||||
haproxy_status.innerHTML = json.haproxy_status ? '<font color="green"><%:RUNNING%> ✓</font>' : '<font color="red"><%:NOT RUNNING%> X</font>';
|
||||
if(kcptun_status)
|
||||
kcptun_status.innerHTML = json.kcptun_status ? '<font color="green"><%:RUNNING%> ✓</font>' : '<font color="red"><%:NOT RUNNING%> X</font>';
|
||||
if(dns_mode_status)
|
||||
dns_mode_status.innerHTML = json.dns_mode_status ? '<font color="green"><%:RUNNING%> ✓</font>' : '<font color="red"><%:NOT RUNNING%> X</font>';
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -388,16 +388,15 @@ gen_start_config() {
|
||||
local kcptun_server_host=$(config_n_get $node kcp_server)
|
||||
local kcptun_port=$(config_n_get $node kcp_port)
|
||||
local kcptun_config="$(config_n_get $node kcp_opts)"
|
||||
local lbenabled=$(config_t_get global_haproxy balancing_enable 0)
|
||||
if [ -z "$kcptun_port" -o -z "$kcptun_config" ]; then
|
||||
echolog "【未配置Kcptun参数】,跳过~"
|
||||
echolog "Kcptun未配置参数,错误!"
|
||||
force_stop
|
||||
fi
|
||||
if [ -n "$kcptun_port" -a -n "$kcptun_config" -a "$lbenabled" == "0" ]; then
|
||||
if [ -n "$kcptun_port" -a -n "$kcptun_config" ]; then
|
||||
local run_kcptun_ip=$server_host
|
||||
[ -n "$kcptun_server_host" ] && run_kcptun_ip=$(get_host_ip $network_type $kcptun_server_host)
|
||||
KCPTUN_REDIR_PORT=$(get_not_exists_port_after $KCPTUN_REDIR_PORT udp)
|
||||
ln_start_bin $(config_t_get global_app kcptun_client_file $(find_bin kcptun-client)) kcptun-client "--log $TMP_PATH/kcptun_${5}.log -l 0.0.0.0:$KCPTUN_REDIR_PORT -r $run_kcptun_ip:$kcptun_port $kcptun_config"
|
||||
KCPTUN_REDIR_PORT=$(get_not_exists_port_after $KCPTUN_REDIR_PORT tcp)
|
||||
ln_start_bin $(config_t_get global_app kcptun_client_file $(find_bin kcptun-client)) kcptun_tcp_$5 "-l 0.0.0.0:$KCPTUN_REDIR_PORT -r $run_kcptun_ip:$kcptun_port $kcptun_config"
|
||||
fi
|
||||
fi
|
||||
if [ "$type" == "ssr" ]; then
|
||||
@ -561,7 +560,7 @@ start_dns() {
|
||||
;;
|
||||
chinadns-ng)
|
||||
other_port=$(expr $DNS_PORT + 1)
|
||||
cat $APP_PATH/gfwlist.conf | sort | uniq | sed -e '/127.0.0.1/d' | sed 's/ipset=\/.//g' | sed 's/\/gfwlist//g' > $TMP_PATH/gfwlist.txt
|
||||
cat $RULES_PATH/gfwlist.conf | sort | uniq | sed -e '/127.0.0.1/d' | sed 's/ipset=\/.//g' | sed 's/\/gfwlist//g' > $TMP_PATH/gfwlist.txt
|
||||
[ -f "$TMP_PATH/gfwlist.txt" ] && local gfwlist_param="-g $TMP_PATH/gfwlist.txt"
|
||||
[ -f "$APP_PATH/chnlist" ] && local chnlist_param="-m $APP_PATH/chnlist"
|
||||
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
CONFIG=passwall
|
||||
CONFIG_PATH=/var/etc/$CONFIG
|
||||
RUN_BIN_PATH=$CONFIG_PATH/bin
|
||||
RUN_BIN_PATH=/var/etc/${CONFIG}/bin
|
||||
|
||||
config_n_get() {
|
||||
local ret=$(uci -q get $CONFIG.$1.$2 2>/dev/null)
|
||||
@ -43,13 +42,13 @@ ENABLED=$(config_t_get global enabled 0)
|
||||
#kcptun
|
||||
use_kcp=$(config_n_get $tmp_node use_kcp 0)
|
||||
if [ $use_kcp -gt 0 ]; then
|
||||
icount=$(ps -w | grep -v grep | grep $RUN_BIN_PATH | grep kcptun-client | grep kcptun_${i} | wc -l)
|
||||
icount=$(ps -w | grep -v grep | grep $RUN_BIN_PATH | grep kcptun_tcp_${i} | wc -l)
|
||||
if [ $icount = 0 ]; then
|
||||
/etc/init.d/passwall restart
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
icount=$(ps -w | grep -v grep | grep $RUN_BIN_PATH | grep -i -E "TCP_${i}|brook_tcp_$i|ipt2socks_tcp_$i" | wc -l)
|
||||
icount=$(ps -w | grep -v grep | grep $RUN_BIN_PATH | grep -i -E "TCP_${i}|brook_tcp_${i}|ipt2socks_tcp_${i}" | wc -l)
|
||||
if [ $icount = 0 ]; then
|
||||
/etc/init.d/passwall restart
|
||||
exit 0
|
||||
@ -63,7 +62,7 @@ ENABLED=$(config_t_get global enabled 0)
|
||||
eval tmp_node=\$UDP_NODE$i
|
||||
if [ "$tmp_node" != "nil" ]; then
|
||||
[ "$tmp_node" == "default" ] && tmp_node=$TCP_NODE1
|
||||
icount=$(ps -w | grep -v grep | grep $RUN_BIN_PATH | grep -i -E "UDP_${i}|brook_udp_$i|ipt2socks_udp_$i" | wc -l)
|
||||
icount=$(ps -w | grep -v grep | grep $RUN_BIN_PATH | grep -i -E "UDP_${i}|brook_udp_${i}|ipt2socks_udp_${i}" | wc -l)
|
||||
if [ $icount = 0 ]; then
|
||||
/etc/init.d/passwall restart
|
||||
exit 0
|
||||
@ -75,7 +74,7 @@ ENABLED=$(config_t_get global enabled 0)
|
||||
for i in $(seq 1 $SOCKS5_NODE_NUM); do
|
||||
eval tmp_node=\$SOCKS5_NODE$i
|
||||
if [ "$tmp_node" != "nil" ]; then
|
||||
icount=$(ps -w | grep -v grep | grep $RUN_BIN_PATH | grep -i -E "SOCKS5_${i}|brook_socks_$i" | wc -l)
|
||||
icount=$(ps -w | grep -v grep | grep $RUN_BIN_PATH | grep -i -E "SOCKS5_${i}|brook_socks_${i}" | wc -l)
|
||||
if [ $icount = 0 ]; then
|
||||
/etc/init.d/passwall restart
|
||||
exit 0
|
||||
|
||||
Loading…
Reference in New Issue
Block a user