luci-app-passwall: sync with upstream source

This commit is contained in:
CN_SZTL 2020-01-03 13:21:45 +08:00
parent bbd0c763c9
commit dc88083f49
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
9 changed files with 93 additions and 114 deletions

View File

@ -6,8 +6,8 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-passwall
PKG_VERSION:=3.0
PKG_RELEASE:=2-20200101
PKG_VERSION:=3.1
PKG_RELEASE:=3-20200103
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PO2LMO:=./po2lmo

View File

@ -26,20 +26,18 @@ if redir_port ~= "nil" then
}
if proto == "tcp" and node.v2ray_tcp_socks == "1" then
inboundDetour_json = {
{
listen = "0.0.0.0",
port = tonumber(node.v2ray_tcp_socks_port),
protocol = "socks",
settings = {
auth = node.v2ray_tcp_socks_auth,
accounts = (node.v2ray_tcp_socks_auth == "password") and {
{
user = node.v2ray_tcp_socks_auth_username,
pass = node.v2ray_tcp_socks_auth_password
}
} or nil,
udp = true
}
listen = "0.0.0.0",
port = tonumber(node.v2ray_tcp_socks_port),
protocol = "socks",
settings = {
auth = node.v2ray_tcp_socks_auth,
accounts = (node.v2ray_tcp_socks_auth == "password") and {
{
user = node.v2ray_tcp_socks_auth_username,
pass = node.v2ray_tcp_socks_auth_password
}
} or nil,
udp = true
}
}
end
@ -51,70 +49,69 @@ local v2ray = {
loglevel = "warning"
},
-- 传入连接
inbound = inbound_json,
inboundDetour = inboundDetour_json,
inbounds = {inbound_json, inboundDetour_json},
-- 传出连接
outbound = {
protocol = node.v2ray_protocol,
settings = {
vnext = {
{
address = node.address,
port = tonumber(node.port),
users = {
{
id = node.v2ray_VMess_id,
alterId = tonumber(node.v2ray_VMess_alterId),
level = tonumber(node.v2ray_VMess_level),
security = node.v2ray_security
outbounds = {
{
protocol = node.v2ray_protocol,
mux = {
enabled = (node.v2ray_mux == "1") and true or false,
concurrency = (node.v2ray_mux_concurrency) and
tonumber(node.v2ray_mux_concurrency) or 8
},
-- 底层传输配置
streamSettings = {
network = node.v2ray_transport,
security = node.v2ray_stream_security,
tlsSettings = (node.v2ray_stream_security == "tls") and {
serverName = node.tls_serverName,
allowInsecure = (node.tls_allowInsecure == "1") and true or
false
} or nil,
kcpSettings = (node.v2ray_transport == "mkcp") and {
mtu = tonumber(node.v2ray_mkcp_mtu),
tti = tonumber(node.v2ray_mkcp_tti),
uplinkCapacity = tonumber(node.v2ray_mkcp_uplinkCapacity),
downlinkCapacity = tonumber(node.v2ray_mkcp_downlinkCapacity),
congestion = (node.v2ray_mkcp_congestion == "1") and true or
false,
readBufferSize = tonumber(node.v2ray_mkcp_readBufferSize),
writeBufferSize = tonumber(node.v2ray_mkcp_writeBufferSize),
header = {type = node.v2ray_mkcp_guise}
} or nil,
wsSettings = (node.v2ray_transport == "ws") and {
path = node.v2ray_ws_path,
headers = (node.v2ray_ws_host ~= nil) and
{Host = node.v2ray_ws_host} or nil
} or nil,
httpSettings = (node.v2ray_transport == "h2") and
{path = node.v2ray_h2_path, host = node.v2ray_h2_host} or
nil,
dsSettings = (node.v2ray_transport == "ds") and
{path = node.v2ray_ds_path} or nil,
quicSettings = (node.v2ray_transport == "quic") and {
security = node.v2ray_quic_security,
key = node.v2ray_quic_key,
header = {type = node.v2ray_quic_guise}
} or nil
},
settings = {
vnext = {
{
address = node.address,
port = tonumber(node.port),
users = {
{
id = node.v2ray_VMess_id,
alterId = tonumber(node.v2ray_VMess_alterId),
level = tonumber(node.v2ray_VMess_level),
security = node.v2ray_security
}
}
}
}
}
},
mux = {
enabled = (node.v2ray_mux == "1") and true or false,
concurrency = (node.v2ray_mux_concurrency) and
tonumber(node.v2ray_mux_concurrency) or 8
},
-- 底层传输配置
streamSettings = {
network = node.v2ray_transport,
security = node.v2ray_stream_security,
tlsSettings = (node.v2ray_stream_security == "tls") and {
serverName = node.tls_serverName,
allowInsecure = (node.tls_allowInsecure == "1") and true or
false
} or nil,
kcpSettings = (node.v2ray_transport == "mkcp") and {
mtu = tonumber(node.v2ray_mkcp_mtu),
tti = tonumber(node.v2ray_mkcp_tti),
uplinkCapacity = tonumber(node.v2ray_mkcp_uplinkCapacity),
downlinkCapacity = tonumber(node.v2ray_mkcp_downlinkCapacity),
congestion = (node.v2ray_mkcp_congestion == "1") and true or
false,
readBufferSize = tonumber(node.v2ray_mkcp_readBufferSize),
writeBufferSize = tonumber(node.v2ray_mkcp_writeBufferSize),
header = {type = node.v2ray_mkcp_guise}
} or nil,
wsSettings = (node.v2ray_transport == "ws") and {
path = node.v2ray_ws_path,
headers = (node.v2ray_ws_host ~= nil) and
{Host = node.v2ray_ws_host} or nil
} or nil,
httpSettings = (node.v2ray_transport == "h2") and
{path = node.v2ray_h2_path, host = node.v2ray_h2_host} or nil,
dsSettings = (node.v2ray_transport == "ds") and
{path = node.v2ray_ds_path} or nil,
quicSettings = (node.v2ray_transport == "quic") and {
security = node.v2ray_quic_security,
key = node.v2ray_quic_key,
header = {type = node.v2ray_quic_guise}
} or nil
}
},
-- 额外传出连接
outboundDetour = {
}, -- 额外传出连接
{protocol = "freedom", tag = "direct", settings = {keep = ""}}
}
}

View File

@ -144,10 +144,7 @@ ss_plugin:value("none", translate("none"))
if is_finded("v2ray-plugin") then ss_plugin:value("v2ray-plugin") end
ss_plugin:depends("type", "SS")
ss_plugin_v2ray_opts = s:option(ListValue, "ss_plugin_v2ray_opts", translate("opts"))
ss_plugin_v2ray_opts:value("http", translate("HTTP"))
ss_plugin_v2ray_opts:value("https", translate("HTTPS"))
ss_plugin_v2ray_opts:value("quic", translate("QUIC"))
ss_plugin_v2ray_opts = s:option(Value, "ss_plugin_v2ray_opts", translate("opts"))
ss_plugin_v2ray_opts:depends("ss_plugin", "v2ray-plugin")
use_kcp = s:option(Flag, "use_kcp", translate("Use Kcptun"),

View File

@ -37,7 +37,8 @@ o.default = 1
s:append(Template("passwall/node_list/link_add_node"))
-- [[ Node List ]]--
s = m:section(TypedSection, "nodes")
s = m:section(TypedSection, "nodes", translate(""), translate(
"Support for more than 10,000 ping nodes and luci does not crash and not slow."))
s.anonymous = true
s.addremove = true
s.template = "cbi/tblsection"

View File

@ -1,4 +1,5 @@
<%
-- Copyright 2018-2020 Lienol <lawlienol@gmail.com>
local api = require "luci.model.cbi.passwall.api.api"
local dsp = require "luci.dispatcher"
@ -199,4 +200,4 @@ table td, .table .td {
<% end %>
<input class="cbi-button cbi-button-remove" type="button" onclick="close_set_node_div()" value="<%:Close%>">
</div>
</div>
</div>

View File

@ -304,6 +304,9 @@ msgstr "选中后保存应用后即自动Ping节点"
msgid "Concise display nodes"
msgstr "简洁显示节点"
msgid "Support for more than 10,000 ping nodes and luci does not crash and not slow."
msgstr "支持超过10000个节点而LuCI却不会卡死更不会崩溃。"
msgid "Apply"
msgstr "应用"

View File

@ -433,15 +433,8 @@ start_tcp_redir() {
local plugin=$(config_n_get $temp_server ss_plugin)
if [ "$plugin" != "none" ]; then
[ "$plugin" == "v2ray-plugin" ] && {
plugin_params="--plugin "
plugin_params="${plugin_params}v2ray-plugin"
local opts=$(config_n_get $temp_server ss_plugin_v2ray_opts)
local address=$(config_n_get $temp_server address)
if [ "$opts" == "https" ]; then
plugin_params="${plugin_params} --plugin-opts \"tls;host=${address}\""
elif [ "$opts" == "quic" ]; then
plugin_params="${plugin_params} --plugin-opts \"mode=quic;host=${address}\""
fi
plugin_params="--plugin v2ray-plugin --plugin-opts \"$opts\""
}
fi
for k in $(seq 1 $process); do
@ -524,15 +517,8 @@ start_udp_redir() {
local plugin=$(config_n_get $temp_server ss_plugin)
if [ "$plugin" != "none" ]; then
[ "$plugin" == "v2ray-plugin" ] && {
plugin_params="--plugin "
plugin_params="${plugin_params}v2ray-plugin"
local opts=$(config_n_get $temp_server ss_plugin_v2ray_opts)
local address=$(config_n_get $temp_server address)
if [ "$opts" == "https" ]; then
plugin_params="${plugin_params} --plugin-opts \"tls;host=${address}\""
elif [ "$opts" == "quic" ]; then
plugin_params="${plugin_params} --plugin-opts \"mode=quic;host=${address}\""
fi
plugin_params="--plugin v2ray-plugin --plugin-opts \"$opts\""
}
fi
$ss_bin -c $config_file -f $RUN_PID_PATH/udp_${TYPE}_1_$i -U $plugin_params >/dev/null 2>&1 &
@ -584,15 +570,8 @@ start_socks5_proxy() {
local plugin=$(config_n_get $temp_server ss_plugin)
if [ "$plugin" != "none" ]; then
[ "$plugin" == "v2ray-plugin" ] && {
plugin_params="--plugin "
plugin_params="${plugin_params}v2ray-plugin"
local opts=$(config_n_get $temp_server ss_plugin_v2ray_opts)
local address=$(config_n_get $temp_server address)
if [ "$opts" == "https" ]; then
plugin_params="${plugin_params} --plugin-opts \"tls;host=${address}\""
elif [ "$opts" == "quic" ]; then
plugin_params="${plugin_params} --plugin-opts \"mode=quic;host=${address}\""
fi
plugin_params="--plugin v2ray-plugin --plugin-opts \"$opts\""
}
fi
$ss_bin -c $config_file -b 0.0.0.0 -u $plugin_params >/dev/null 2>&1 &

View File

@ -307,13 +307,15 @@ add_nodes(){
update_config(){
[ "$isAdd" == 1 ] && {
isadded_remarks=$(uci show $CONFIG | grep -c "remarks='$remarks'")
isadded_remarks=$(uci show $CONFIG | grep "@nodes" | grep "remarks" | grep -c -F "$remarks")
if [ "$isadded_remarks" -eq 0 ]; then
add_nodes add "$link_type"
else
index=$(uci show $CONFIG | grep -w "remarks='$remarks'" | cut -d '[' -f2|cut -d ']' -f1)
uci delete $CONFIG.@nodes[$index]
add_nodes update "$link_type"
index=$(uci show $CONFIG | grep "@nodes" | grep "remarks" | grep -w -F "$remarks" | cut -d '[' -f2|cut -d ']' -f1)
[ "$?" == 0 ] && {
uci delete $CONFIG.@nodes[$index]
add_nodes update "$link_type"
}
fi
}
}
@ -323,7 +325,7 @@ 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 ] && {
for localindex in $(uci show $CONFIG|grep -w "$localaddress" |grep -w "address=" |cut -d '[' -f2|cut -d ']' -f1)
for localindex in $(uci show $CONFIG | grep -w "$localaddress" | grep -w "address=" |cut -d '[' -f2|cut -d ']' -f1)
do
del_type=$(uci get $CONFIG.@nodes[$localindex].type)
uci delete $CONFIG.@nodes[$localindex]

View File

@ -8,10 +8,9 @@ get_date() {
}
test_url() {
ps -ef | grep "$1" | grep -v grep | awk '{print $1}' | xargs kill -9
status=$(/usr/bin/curl -I -o /dev/null -s --connect-timeout 3 -w %{http_code} "$1" | grep 200)
status=$(/usr/bin/curl -I -o /dev/null -s --connect-timeout 2 -w %{http_code} "$1" | grep 200)
[ "$?" != 0 ] && {
status=$(/usr/bin/wget --no-check-certificate --spider --timeout=3 "$1")
status=$(/usr/bin/wget --no-check-certificate --spider --timeout=2 "$1")
[ "$?" == 0 ] && status=200
}
echo $status
@ -141,4 +140,4 @@ test_url)
*)
start
;;
esac
esac