luci-app-passwall: bump to 3.9-54

This commit is contained in:
CN_SZTL 2020-09-06 12:04:39 +08:00
parent 5257c59e66
commit 34dbeede98
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
15 changed files with 2974 additions and 3278 deletions

View File

@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-passwall
PKG_VERSION:=3.9
PKG_RELEASE:=52
PKG_RELEASE:=54
PKG_DATE:=20200905
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)

View File

@ -29,8 +29,7 @@ o.default = 0
o.rmempty = false
---- Testing Time
o = s:option(Value, "testing_time", translate("How often is a diagnosis made"),
translate("Units:minutes"))
o = s:option(Value, "testing_time", translate("How often is a diagnosis made"), translate("Units:minutes"))
o.default = "3"
---- TCP Node
@ -38,7 +37,12 @@ o.default = "3"
-- 暂时只支持TCP1
local tcp_node_num = 1
for i = 1, tcp_node_num, 1 do
o = s:option(DynamicList, "tcp_node" .. i, "TCP " .. i .. " " .. translate("List of backup nodes"), translate("List of backup nodes, the first of which must be the primary node and the others the standby node."))
o = s:option(ListValue, "tcp_main" .. i, "TCP " .. i .. " " .. translate("Main node"))
for k, v in pairs(nodes_table) do
o:value(v.id, v.remarks)
end
o = s:option(DynamicList, "tcp_node" .. i, "TCP " .. i .. " " .. translate("List of backup nodes"))
for k, v in pairs(nodes_table) do
o:value(v.id, v.remarks)
end

View File

@ -69,9 +69,28 @@ for i = 1, tcp_node_num, 1 do
if i == 1 then
o = s:taboption("Main", ListValue, "tcp_node" .. i, translate("TCP Node"))
o.description = translate("For proxy specific list.")
if tonumber(m:get("@auto_switch[0]", "enable") or 0) == 1 then
local now_node = luci.sys.exec(string.format("[ -f '/var/etc/%s/id/TCP_%s' ] && echo -n $(cat /var/etc/%s/id/TCP_%s)", appname, i, appname, i))
if now_node and now_node ~= "" then
local e = uci:get_all(appname, now_node)
if e then
local remarks = ""
if e.type == "V2ray" and (e.protocol == "_balancing" or e.protocol == "_shunt") then
remarks = "%s[%s] " % {translatef(e.type .. e.protocol), e.remarks}
else
if e.use_kcp and e.use_kcp == "1" then
remarks = "%s+%s[%s] %s" % {e.type, "Kcptun", e.remarks, e.address}
else
remarks = "%s[%s] %s:%s" % {e.type, e.remarks, e.address, e.port}
end
end
o.description = o.description .. "<br />" ..translatef("Current node: %s", remarks)
end
end
end
else
o = s:taboption("Main", ListValue, "tcp_node" .. i,
translate("TCP Node") .. " " .. i)
o = s:taboption("Main", ListValue, "tcp_node" .. i, translate("TCP Node") .. " " .. i)
end
o:value("nil", translate("Close"))
for k, v in pairs(nodes_table) do o:value(v.id, v.remarks) end
@ -88,8 +107,7 @@ for i = 1, udp_node_num, 1 do
--o:value("tcp", translate("Same as the tcp node"))
--o:value("tcp_", translate("Same as the tcp node") .. "" .. translate("New process") .. "")
else
o = s:taboption("Main", ListValue, "udp_node" .. i,
translate("UDP Node") .. " " .. i)
o = s:taboption("Main", ListValue, "udp_node" .. i, translate("UDP Node") .. " " .. i)
o:value("nil", translate("Close"))
end
for k, v in pairs(nodes_table) do o:value(v.id, v.remarks) end

View File

@ -5,39 +5,30 @@ m = Map(appname)
-- [[ Rule Settings ]]--
s = m:section(TypedSection, "global_rules", translate("Rule status"))
s.anonymous = true
s:append(Template(appname .. "/rule/rule_version"))
--[[
o = s:option(Flag, "adblock", translate("Enable adblock"))
o.rmempty = false
]]--
---- Enable custom url
--[[
o = s:option(Flag, "enable_custom_url", translate("Enable custom URL"))
o.default = 0
o.rmempty = false
]]--
---- gfwlist URL
o = s:option(Value, "gfwlist_url", translate("GFW domains(gfwlist) Update URL"))
o:value("https://cdn.jsdelivr.net/gh/Loukky/gfwlist-by-loukky/gfwlist.txt", translate("Loukky/gfwlist-by-loukky"))
o:value("https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt", translate("gfwlist/gfwlist"))
o.default = "https://cdn.jsdelivr.net/gh/Loukky/gfwlist-by-loukky/gfwlist.txt"
--o:depends("enable_custom_url", 1)
----chnroute URL
o = s:option(Value, "chnroute_url", translate("China IPs(chnroute) Update URL"))
o:value("https://ispip.clang.cn/all_cn.txt", translate("Clang.CN"))
o:value("https://ispip.clang.cn/all_cn_cidr.txt", translate("Clang.CN.CIDR"))
o.default = "https://ispip.clang.cn/all_cn.txt"
--o:depends("enable_custom_url", 1)
----chnroute6 URL
o = s:option(Value, "chnroute6_url", translate("China IPv6s(chnroute6) Update URL"))
o:value("https://ispip.clang.cn/all_cn_ipv6.txt", translate("Clang.CN.IPv6"))
o.default = "https://ispip.clang.cn/all_cn_ipv6.txt"
--o:depends("enable_custom_url", 1)
s:append(Template(appname .. "/rule/rule_version"))
---- Auto Update
o = s:option(Flag, "auto_update", translate("Enable auto update rules"))

View File

@ -1,11 +1,6 @@
<%
local api = require "luci.model.cbi.passwall.api.api"
local gfwlist_version = api.uci_get_type("global_rules", "gfwlist_version")
local chnroute_version = api.uci_get_type("global_rules", "chnroute_version")
local chnroute6_version = api.uci_get_type("global_rules", "chnroute6_version")
local chnlist_version = api.uci_get_type("global_rules", "chnlist_version")
local gfwlist_update = api.uci_get_type("global_rules", "gfwlist_update", "1") == "1" and "checked='checked'" or ""
local chnroute_update = api.uci_get_type("global_rules", "chnroute_update", "1") == "1" and "checked='checked'" or ""
local chnroute6_update = api.uci_get_type("global_rules", "chnroute6_update", "1") == "1" and "checked='checked'" or ""
@ -45,62 +40,31 @@ local chnlist_update = api.uci_get_type("global_rules", "chnlist_update", "1") =
</script>
<fieldset class="cbi-section">
<fieldset class="cbi-section" id="_rule_fieldset">
<div class="cbi-value">
<label class="cbi-value-title">gfwlist
<%:Version%>
</label>
<div class="cbi-value-field">
<div class="cbi-value-description">
<span><%=gfwlist_version%> 】</span>
<input type="checkbox" name="gfwlist_update" value="1" <%=gfwlist_update%> />
</div>
</div>
</div>
<div class="cbi-value">
<label class="cbi-value-title">chnroute
<%:Version%>
</label>
<div class="cbi-value-field">
<div class="cbi-value-description">
<span><%=chnroute_version%> 】</span>
<input type="checkbox" name="chnroute_update" value="1" <%=chnroute_update%> />
</div>
</div>
</div>
<div class="cbi-value">
<label class="cbi-value-title">chnroute6
<%:Version%>
</label>
<div class="cbi-value-field">
<div class="cbi-value-description">
<span><%=chnroute6_version%> 】</span>
<input type="checkbox" name="chnroute6_update" value="1" <%=chnroute6_update%> />
</div>
</div>
</div>
<div class="cbi-value">
<label class="cbi-value-title">chnlist
<%:Version%>
</label>
<div class="cbi-value-field">
<div class="cbi-value-description">
<span><%=chnlist_version%> 】</span>
<input type="checkbox" name="chnlist_update" value="1" <%=chnlist_update%> />
</div>
</div>
</div>
<div class="cbi-value">
<label class="cbi-value-title">
<%:Manually update%>
</label>
<div class="cbi-value-field">
<input class="cbi-button cbi-input-apply" type="button" id="update_rules_btn" onclick="update_rules(this)" value="<%:Manually update%>" />
<div>
<label>
<input class="cbi-input-checkbox" type="checkbox" name="gfwlist" value="1" <%=gfwlist_update%>>
gfwlist
</label>
<label>
<input class="cbi-input-checkbox" type="checkbox" name="chnroute" value="1" <%=chnroute_update%>>
chnroute
</label>
<label>
<input class="cbi-input-checkbox" type="checkbox" name="chnroute6" value="1" <%=chnroute6_update%>>
chnroute6
</label>
<label>
<input class="cbi-input-checkbox" type="checkbox" name="chnlist" value="1" <%=chnlist_update%>>
chnlist
</label>
<input class="cbi-button cbi-input-apply" type="button" id="update_rules_btn" onclick="update_rules(this)" value="<%:Manually update%>" />
</div>
</div>
</div>
</fieldset>
</fieldset>

View File

@ -127,6 +127,9 @@ msgstr "与TCP%s节点相同"
msgid "New process"
msgstr "另开进程"
msgid "Current node: %s"
msgstr "当前节点:%s"
msgid "For proxy specific list."
msgstr "用于代理特定的列表。"
@ -595,12 +598,12 @@ msgstr "检测时间"
msgid "Automatic switching cannot be used when this option is checked"
msgstr "当勾选此选项时,不能使用自动切换"
msgid "Main node"
msgstr "主节点"
msgid "List of backup nodes"
msgstr "备用节点的列表"
msgid "List of backup nodes, the first of which must be the primary node and the others the standby node."
msgstr "备用节点的列表,第一个必须是主节点,其他是备用节点。"
msgid "Configure this node with 127.0.0.1: this port"
msgstr "使用127.0.0.1和此端口配置节点"

View File

@ -43,11 +43,6 @@ config global_rules
option chnroute_update '1'
option chnroute6_update '1'
option gfwlist_update '1'
option chnroute6_version '2020-08-22'
option gfwlist_version '2020-08-24'
option chnroute_version '2020-08-24'
option chnlist_version '2020-08-24'
option enable_custom_url '0'
option gfwlist_url 'https://cdn.jsdelivr.net/gh/Loukky/gfwlist-by-loukky/gfwlist.txt'
option chnroute_url 'https://ispip.clang.cn/all_cn.txt'
option chnroute6_url 'https://ispip.clang.cn/all_cn_ipv6.txt'

View File

@ -514,9 +514,9 @@ node_switch() {
local port=$(cat $TMP_PORT_PATH/${1}_${i})
run_redir $node "0.0.0.0" $port $config_file $1 $i
echo $node > $TMP_ID_PATH/${1}_${i}
local node_net=$(echo $1 | tr 'A-Z' 'a-z')
uci set $CONFIG.@global[0].${node_net}_node${i}=$node
uci commit $CONFIG
#local node_net=$(echo $1 | tr 'A-Z' 'a-z')
#uci set $CONFIG.@global[0].${node_net}_node${i}=$node
#uci commit $CONFIG
/etc/init.d/dnsmasq restart >/dev/null 2>&1
}
}

View File

@ -7,7 +7,6 @@ local name = 'passwall'
local arg1 = arg[1]
local rule_path = "/usr/share/" .. name .. "/rules"
local url_main = 'https://cdn.jsdelivr.net/gh/hq450/fancyss/rules'
local reboot = 0
local gfwlist_update = 0
local chnroute_update = 0
@ -26,8 +25,7 @@ local mydnsport = '7913'
local ipsetname = 'gfwlist'
-- custom url
local enable_custom_url = ucic:get_first(name, 'global_rules', "enable_custom_url", 0)
enable_custom_url = 1
local enable_custom_url = 1
local gfwlist_url = ucic:get_first(name, 'global_rules', "gfwlist_url", "https://cdn.jsdelivr.net/gh/Loukky/gfwlist-by-loukky/gfwlist.txt")
local chnroute_url = ucic:get_first(name, 'global_rules', "chnroute_url", "https://ispip.clang.cn/all_cn.txt")
local chnroute6_url = ucic:get_first(name, 'global_rules', "chnroute6_url", "https://ispip.clang.cn/all_cn_ipv6.txt")
@ -330,88 +328,6 @@ if tonumber(enable_custom_url) == 1 then
end
end
if (enable_custom_url) == 0 then
local version = curl(url_main .. "/version1")
if version and tonumber(version) ~= 0 then
if tonumber(gfwlist_update) == 1 then
log("开始更新gfwlist...")
local gfwlist = luci.sys.exec("echo -n $(echo '" .. version .. "' | sed -n 1p)")
local new_version = luci.sys.exec("echo -n $(echo '" .. gfwlist .. "' | awk '{print $1}')")
local new_md5 = luci.sys.exec("echo -n $(echo '" .. gfwlist .. "' | awk '{print $3}')")
if new_version ~= "" and new_md5 ~= "" then
local old_version = ucic:get_first(name, 'global_rules', "gfwlist_version", "nil")
local old_md5 = luci.sys.exec("echo -n $(md5sum " .. rule_path .. "/gfwlist.conf | awk '{print $1}')")
if old_md5 ~= new_md5 or old_version ~= new_version then
curl(url_main .. "/gfwlist.conf", "/tmp/gfwlist_tmp")
local download_md5 = luci.sys.exec("echo -n $([ -f '/tmp/gfwlist_tmp' ] && md5sum /tmp/gfwlist_tmp | awk '{print $1}')")
if download_md5 == new_md5 then
luci.sys.exec("mv -f /tmp/gfwlist_tmp " .. rule_path .. "/gfwlist.conf")
ucic:set(name, ucic:get_first(name, 'global_rules'), "gfwlist_version", new_version)
reboot = 1
log("更新gfwlist成功...")
end
else
log("gfwlist版本一致不用更新。")
end
else
log("gfwlist文件下载失败")
end
end
if tonumber(chnroute_update) == 1 and tonumber(enable_custom_url) == 0 then
log("开始更新chnroute...")
local chnroute = luci.sys.exec("echo -n $(echo '" .. version .. "' | sed -n 2p)")
local new_version = luci.sys.exec("echo -n $(echo '" .. chnroute .. "' | awk '{print $1}')")
local new_md5 = luci.sys.exec("echo -n $(echo '" .. chnroute .. "' | awk '{print $3}')")
if new_version ~= "" and new_md5 ~= "" then
local old_version = ucic:get_first(name, 'global_rules', "chnroute_version", "nil")
local old_md5 = luci.sys.exec("echo -n $(md5sum " .. rule_path .. "/chnroute | awk '{print $1}')")
if old_md5 ~= new_md5 or old_version ~= new_version then
curl(url_main .. "/chnroute.txt", "/tmp/chnroute_tmp")
local download_md5 = luci.sys.exec("echo -n $([ -f '/tmp/chnroute_tmp' ] && md5sum /tmp/chnroute_tmp | awk '{print $1}')")
if download_md5 == new_md5 then
luci.sys.exec("mv -f /tmp/chnroute_tmp " .. rule_path .. "/chnroute")
ucic:set(name, ucic:get_first(name, 'global_rules'), "chnroute_version", new_version)
reboot = 1
log("更新chnroute成功...")
end
else
log("chnroute版本一致不用更新。")
end
else
log("chnroute文件下载失败")
end
end
if tonumber(chnlist_update) == 1 then
log("开始更新chnlist...")
local chnlist = luci.sys.exec("echo -n $(echo '" .. version .. "' | sed -n 4p)")
local new_version = luci.sys.exec("echo -n $(echo '" .. chnlist .. "' | awk '{print $1}')")
local new_md5 = luci.sys.exec("echo -n $(echo '" .. chnlist .. "' | awk '{print $3}')")
if new_version ~= "" and new_md5 ~= "" then
local old_version = ucic:get_first(name, 'global_rules', "chnlist_version", "nil")
local old_md5 = luci.sys.exec("echo -n $(md5sum " .. rule_path .. "/chnlist | awk '{print $1}')")
if old_md5 ~= new_md5 or old_version ~= new_version then
curl(url_main .. "/cdn.txt", "/tmp/chnlist_tmp")
local download_md5 = luci.sys.exec("echo -n $([ -f '/tmp/chnlist_tmp' ] && md5sum /tmp/chnlist_tmp | awk '{print $1}')")
if download_md5 == new_md5 then
luci.sys.exec("mv -f /tmp/chnlist_tmp " .. rule_path .. "/chnlist")
ucic:set(name, ucic:get_first(name, 'global_rules'), "chnlist_version", new_version)
reboot = 1
log("更新chnlist成功...")
end
else
log("chnlist版本一致不用更新。")
end
else
log("chnlist文件下载失败")
end
end
else
log("版本信息下载失败!")
end
end
ucic:set(name, ucic:get_first(name, 'global_rules'), "gfwlist_update", gfwlist_update)
ucic:set(name, ucic:get_first(name, 'global_rules'), "chnroute_update", chnroute_update)
ucic:set(name, ucic:get_first(name, 'global_rules'), "chnroute6_update", chnroute6_update)

View File

@ -4077,6 +4077,12 @@
103.154.164.0/23
103.154.168.0/23
103.154.242.0/23
103.155.14.0/23
103.155.16.0/23
103.155.34.0/23
103.155.48.0/23
103.155.76.0/23
103.155.100.0/23
103.192.0.0/22
103.192.4.0/22
103.192.8.0/22

View File

@ -88,6 +88,8 @@
2001:df4:4d80::/48
2001:df4:5900::/48
2001:df4:a680::/48
2001:df4:a980::/48
2001:df4:c180::/48
2001:df4:cf00::/48
2001:df5:7800::/48
2001:df6:100::/48
@ -1603,18 +1605,23 @@
2406:6080::/32
2406:6100::/32
2406:6180::/32
2406:61c0::/30
2406:6280::/32
2406:6300::/32
2406:6340::/32
2406:6380::/32
2406:6480::/32
2406:6500::/32
2406:6580::/32
2406:65c0::/32
2406:6640::/32
2406:6680::/32
2406:6780::/32
2406:6880::/32
2406:6980::/32
2406:6a80::/32
2406:6b80::/32
2406:6bc0::/32
2406:6c80::/32
2406:6d80::/32
2406:6e80::/32

View File

@ -85,6 +85,16 @@ do
}
end)
local tcp_main1 = ucic2:get(application, "@auto_switch[0]", "tcp_main1") or "nil"
CONFIG[#CONFIG + 1] = {
log = false,
remarks = "自动切换TCP_1主节点",
currentNode = ucic2:get_all(application, tcp_main1),
set = function(server)
ucic2:set(application, "@auto_switch[0]", "tcp_main1", server)
end
}
local tcp_node1_table = ucic2:get(application, "@auto_switch[0]", "tcp_node1")
if tcp_node1_table then
local nodes = {}

View File

@ -9,6 +9,11 @@ echolog() {
echo -e "$d: $1" >> $LOG_FILE
}
config_n_get() {
local ret=$(uci -q get "${CONFIG}.${1}.${2}" 2>/dev/null)
echo "${ret:=$3}"
}
config_t_get() {
local index=0
[ -n "$4" ] && index=$4
@ -63,7 +68,7 @@ test_auto_switch() {
status=$(test_proxy)
if [ "$status" == 0 ]; then
#echolog "自动切换检测:${type}_${index}节点正常。"
echolog "自动切换检测:${type}_${index}节点正常。"
return 0
elif [ "$status" == 2 ]; then
echolog "自动切换检测:无法连接到网络,请检查网络是否正常!"
@ -71,13 +76,21 @@ test_auto_switch() {
elif [ "$status" == 1 ]; then
echolog "自动切换检测:${type}_${index}节点异常,开始切换节点!"
#检测自动切换列表主节点是否能使用
local main_node=$(echo $b_tcp_nodes | awk -F ' ' '{print $1}')
#检测主节点是否能使用
local main_node=$(config_t_get auto_switch tcp_main1)
if [ "$now_node" != "$main_node" ]; then
local tmp_port=$(/usr/share/passwall/app.sh get_new_port 61080 tcp)
/usr/share/passwall/app.sh run_socks "$main_node" "127.0.0.1" "$tmp_port" "/var/etc/passwall/auto_switch_main.json" "10"
proxy_status=$(test_url "https://www.google.com/generate_204" 3 3 "-x socks5h://127.0.0.1:$tmp_port")
ps -w | grep -v "grep" | grep "/var/etc/passwall/auto_switch_main.json" | awk '{print $1}' | xargs kill -9 >/dev/null 2>&1
local node_type=$(echo $(config_n_get $main_node type) | tr 'A-Z' 'a-z')
if [ "$node_type" == "socks" ]; then
local node_address=$(config_n_get $main_node address)
local node_port=$(config_n_get $main_node port)
[ -n "$node_address" ] && [ -n "$node_port" ] && local curlx="socks5h://$node_address:$node_port"
else
local tmp_port=$(/usr/share/passwall/app.sh get_new_port 61080 tcp)
/usr/share/passwall/app.sh run_socks "$main_node" "127.0.0.1" "$tmp_port" "/var/etc/passwall/auto_switch_$index.json" "10"
local curlx="socks5h://127.0.0.1:$tmp_port"
fi
proxy_status=$(test_url "https://www.google.com/generate_204" 3 3 "-x $curlx")
ps -w | grep -v "grep" | grep "/var/etc/passwall/auto_switch_$index.json" | awk '{print $1}' | xargs kill -9 >/dev/null 2>&1
if [ "$proxy_status" -eq 200 ]; then
#主节点正常,切换到主节点
echolog "自动切换检测:${type}_${index}主节点正常,切换到主节点!"
@ -90,7 +103,7 @@ test_auto_switch() {
in_backup_nodes=$(echo $b_tcp_nodes | grep $now_node)
# 判断当前节点是否存在于备用节点列表里
if [ -z "$in_backup_nodes" ]; then
# 如果不存在,设置第一节点为新的节点
# 如果不存在,设置第一节点为新的节点
new_node=$(echo $b_tcp_nodes | awk -F ' ' '{print $1}')
else
# 如果存在,设置下一个备用节点为新的节点