luci-app-passwall: sync with upstream source

This commit is contained in:
CN_SZTL 2020-01-28 14:12:25 +08:00
parent 2e7954a850
commit 4cc2dedafc
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
5 changed files with 41 additions and 56 deletions

View File

@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-passwall
PKG_VERSION:=3.3
PKG_RELEASE:=36-20200124
PKG_RELEASE:=38-20200128
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)

View File

@ -148,13 +148,14 @@ o:value("208.67.222.222,208.67.220.220",
o:depends("dns_mode", "chinadns-ng")
---- Use TCP Node Resolve DNS
if is_installed("pdnsd") or is_installed("pdnsd-alt") or is_finded("pdnsd") then
--[[ if is_installed("pdnsd") or is_installed("pdnsd-alt") or is_finded("pdnsd") then
o = s:option(Flag, "use_tcp_node_resolve_dns",
translate("Use TCP Node Resolve DNS"),
translate("If checked, DNS is resolved using the TCP node."))
o.default = 1
o:depends("dns_mode", "pdnsd")
end
--]]
o = s:option(Value, "dns2socks_forward", translate("DNS Address"))
o.default = "8.8.4.4"

View File

@ -142,7 +142,7 @@ https://github.com/pure-css/pure/blob/master/LICENSE.md
<div class="pure-u-1-4">
<div class="block pure-g">
<div class="pure-u-16-24">
<h4 id="status_socks5_node">SOCKS5<br /><span class="red"><%:NOT RUNNING%></span></h4>
<h4 id="status_socks5_node">Socks5<br /><span class="red"><%:NOT RUNNING%></span></h4>
</div>
<div class="pure-u-8-24">
<div class="img-con">
@ -165,7 +165,6 @@ https://github.com/pure-css/pure/blob/master/LICENSE.md
</div>
</div>
</div>
<% if ipkg.installed("haproxy") or is_finded("haproxy*") then %>
<div class="pure-u-1-4">
<div class="block pure-g">
<div class="pure-u-16-24">
@ -179,12 +178,10 @@ https://github.com/pure-css/pure/blob/master/LICENSE.md
</div>
</div>
</div>
<% end %>
<% if ipkg.installed("kcptun") or is_finded("kcptun*") then %>
<div class="pure-u-1-4">
<div class="block pure-g">
<div class="pure-u-16-24">
<h4 id="status_kcptun">KcpTun<br /><span class="red"><%:NOT RUNNING%></span></h4>
<h4 id="status_kcptun">Kcptun<br /><span class="red"><%:NOT RUNNING%></span></h4>
</div>
<div class="pure-u-8-24">
<div class="img-con">
@ -194,7 +191,6 @@ https://github.com/pure-css/pure/blob/master/LICENSE.md
</div>
</div>
</div>
<% end %>
<div class="pure-u-1-4 check" onclick="check_connect('baidu')">
<div class="block pure-g">
<div class="pure-u-16-24">
@ -316,7 +312,7 @@ https://github.com/pure-css/pure/blob/master/LICENSE.md
if (socks5_node_num >= 1) {
var status_socks5_node = document.getElementById('status_socks5_node');
if (status_socks5_node) {
var text = 'SOCKS5<br />';
var text = 'Socks5<br />';
if (socks5_node_num == 1) {
if (data["socks5_node1_status"])
text += '<span class="green"><%:RUNNING%></span>';
@ -349,9 +345,9 @@ https://github.com/pure-css/pure/blob/master/LICENSE.md
}
if (status_kcptun) {
if (data.kcptun_status) {
status_kcptun.innerHTML = 'KcpTun<br /><span class="green"><%:RUNNING%></span>'
status_kcptun.innerHTML = 'Kcptun<br /><span class="green"><%:RUNNING%></span>'
} else {
status_kcptun.innerHTML = 'KcpTun<br /><span class="red"><%:NOT RUNNING%></span>'
status_kcptun.innerHTML = 'Kcptun<br /><span class="red"><%:NOT RUNNING%></span>'
}
}
}

View File

@ -527,46 +527,30 @@ gen_start_config() {
kcptun_use=$(config_n_get $node use_kcp 0)
kcptun_server_host=$(config_n_get $node kcp_server)
kcptun_port=$(config_n_get $node kcp_port)
kcptun_config=$(config_n_get $node kcp_opts)
kcptun_path=""
kcptun_config="$(config_n_get $node kcp_opts)"
kcptun_bin=$(config_t_get global_app kcptun_client_file $(find_bin kcptun-client))
lbenabled=$(config_t_get global_haproxy balancing_enable 0)
if [ -z "$kcptun_bin" ]; then
echolog "【未安装Kcptun主程序请到自动更新下载Kcptun】跳过~"
force_stop
fi
if [ "$kcptun_use" == "1" ] && ([ -z "$kcptun_port" ] || [ -z "$kcptun_config" ]); then
echolog "【检测到启用KCP但未配置KCP参数】跳过~"
echolog "【未配置Kcptun参数】跳过~"
force_stop
fi
if [ "$kcptun_use" == "1" -a -n "$kcptun_port" -a -n "$kcptun_config" -a "$lbenabled" == "1" ]; then
echolog "【检测到启用KCP但KCP与负载均衡二者不能同时开启】跳过~"
fi
if [ "$kcptun_use" == "1" ]; then
if [ -f "$(config_t_get global_kcptun kcptun_client_file)" ]; then
kcptun_path=$(config_t_get global_kcptun kcptun_client_file)
else
temp=$(find_bin kcptun_client)
[ -n "$temp" ] && kcptun_path=$temp
fi
fi
if [ "$kcptun_use" == "1" -a -z "$kcptun_path" ] && ([ -n "$kcptun_port" ] || [ -n "$kcptun_config" ]); then
echolog "【检测到启用KCP但未安装KCP主程序请自行到自动更新下载KCP】跳过~"
fi
if [ "$kcptun_use" == "1" -a -n "$kcptun_port" -a -n "$kcptun_config" -a "$lbenabled" == "0" -a -n "$kcptun_path" ]; then
if [ "$kcptun_use" == "1" -a -n "$kcptun_port" -a -n "$kcptun_config" -a "$lbenabled" == "0" -a -f "$kcptun_bin" ]; then
local run_kcptun_ip=$server_ip
if [ -n "$kcptun_server_host" ]; then
kcptun_use_ipv6=$(config_n_get $node kcp_use_ipv6)
network_type="ipv4"
[ "$kcptun_use_ipv6" == "1" ] && network_type="ipv6"
kcptun_server_ip=$(get_host_ip $network_type $kcptun_server_host)
TCP_NODE1_IP=$kcptun_server_ip
eval TCP_NODE${5}_IP=$kcptun_server_ip
run_kcptun_ip=$kcptun_server_ip
echolog "KCP节点IP地址:$kcptun_server_ip"
fi
if [ -z "$kcptun_path" ]; then
echolog "找不到Kcptun客户端主程序无法启用"
else
$kcptun_bin --log $CONFIG_PATH/kcptun -l 0.0.0.0:$KCPTUN_REDIR_PORT -r $run_kcptun_ip:$kcptun_port "$kcptun_config" >/dev/null 2>&1 &
echolog "运行Kcptun..."
echolog "Kcptun节点IP地址:$kcptun_server_ip"
fi
KCPTUN_REDIR_PORT=$(get_not_exists_port_after $KCPTUN_REDIR_PORT udp)
$kcptun_bin --log $CONFIG_PATH/kcptun_${5}.log -l 0.0.0.0:$KCPTUN_REDIR_PORT -r $run_kcptun_ip:$kcptun_port $kcptun_config >/dev/null 2>&1 &
fi
if [ "$type" == "ssr" ]; then
@ -739,6 +723,7 @@ start_dns() {
pdnsd)
pdnsd_bin=$(find_bin pdnsd)
[ -n "$pdnsd_bin" ] && {
use_tcp_node_resolve_dns=1
gen_pdnsd_config $DNS_PORT "cache"
DNS_FORWARD=$(echo $DNS_FORWARD | sed 's/,/ /g')
nohup $pdnsd_bin --daemon -c $pdnsd_dir/pdnsd.conf -d >/dev/null 2>&1 &
@ -1154,18 +1139,22 @@ start() {
}
stop() {
while [ -f "$LOCK_FILE" ]; do
sleep 1s
failcount=1
while [ "$failcount" -le 10 ]; do
if [ -f "$LOCK_FILE" ]; then
let "failcount++"
sleep 1s
[ "$failcount" -ge 10 ] && rm -f "$LOCK_FILE"
else
break
fi
done
clean_log
source $APP_PATH/iptables.sh stop
kill_all brook dns2socks haproxy chinadns-ng ipt2socks v2ray-plugin
ps -w | grep -E "$CONFIG_TCP_FILE|$CONFIG_UDP_FILE|$CONFIG_SOCKS5_FILE" | grep -v "grep" | awk '{print $1}' | xargs kill -9 >/dev/null 2>&1 &
ps -w | grep -E "$CONFIG_PATH" | grep -v "grep" | awk '{print $1}' | xargs kill -9 >/dev/null 2>&1 &
ps -w | grep "kcptun_client" | grep "$KCPTUN_REDIR_PORT" | grep -v "grep" | awk '{print $1}' | xargs kill -9 >/dev/null 2>&1 &
rm -rf /var/pdnsd/pdnsd.cache
rm -rf $TMP_DNSMASQ_PATH
rm -rf $CONFIG_PATH
rm -rf $TMP_DNSMASQ_PATH $CONFIG_PATH
stop_dnsmasq
stop_crontab
echolog "关闭相关程序,清理相关文件和缓存完成。"

View File

@ -35,13 +35,12 @@ use_haproxy=$(config_t_get global_haproxy balancing_enable 0)
#tcp
for i in $(seq 1 $TCP_NODE_NUM); do
eval temp_server=\$TCP_NODE$i
if [ "$temp_server" != "nil" ]; then
eval tmp_node=\$TCP_NODE$i
if [ "$tmp_node" != "nil" ]; then
#kcptun
use_kcp=$(config_n_get $temp_server use_kcp 0)
use_kcp=$(config_n_get $tmp_node use_kcp 0)
if [ $use_kcp -gt 0 ]; then
kcp_port=$(config_t_get global_proxy kcptun_port 11183)
icount=$(ps -w | grep kcptun-client | grep $kcp_port | grep -v grep | wc -l)
icount=$(ps -w | grep kcptun-client | grep $CONFIG_PATH/kcptun_${i} | grep -v grep | wc -l)
if [ $icount = 0 ]; then
/etc/init.d/passwall restart
exit 0
@ -59,9 +58,9 @@ done
#udp
for i in $(seq 1 $UDP_NODE_NUM); do
eval temp_server=\$UDP_NODE$i
if [ "$temp_server" != "nil" ]; then
[ "$temp_server" == "default" ] && temp_server=$TCP_NODE1
eval tmp_node=\$UDP_NODE$i
if [ "$tmp_node" != "nil" ]; then
[ "$tmp_node" == "default" ] && tmp_node=$TCP_NODE1
[ -f "/var/etc/passwall/port/UDP_$i" ] && listen_port=$(echo -n `cat /var/etc/passwall/port/UDP_$i`)
icount=$(ps -w | grep -v grep | grep -i -E "${CONFIG}/UDP_${i}|brook tproxy -l 0.0.0.0:${listen_port}|ipt2socks -U -l ${listen_port}" | wc -l)
if [ $icount = 0 ]; then
@ -73,8 +72,8 @@ done
#socks5
for i in $(seq 1 $SOCKS5_NODE_NUM); do
eval temp_server=\$SOCKS5_NODE$i
if [ "$temp_server" != "nil" ]; then
eval tmp_node=\$SOCKS5_NODE$i
if [ "$tmp_node" != "nil" ]; then
[ -f "/var/etc/passwall/port/SOCKS5_$i" ] && listen_port=$(echo -n `cat /var/etc/passwall/port/SOCKS5_$i`)
icount=$(ps -w | grep -v grep | grep -i -E "${CONFIG}/SOCKS5_${i}|brook client -l 0.0.0.0:${listen_port}" | wc -l)
if [ $icount = 0 ]; then