luci-app-passwall: bump to 4-17

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
xiaorouji 2021-03-13 14:54:21 +08:00 committed by Tianling Shen
parent 2c45dc201a
commit 15013245cd
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
15 changed files with 146 additions and 143 deletions

View File

@ -7,8 +7,8 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-passwall
PKG_VERSION:=4
PKG_RELEASE:=16
PKG_DATE:=20210303
PKG_RELEASE:=17
PKG_DATE:=20210314
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
@ -21,6 +21,11 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks
bool "Include Shadowsocks"
default y
config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Rust
bool "Include Shadowsocks Rust (AEAD ciphers only)"
depends on aarch64||arm||i386||mips||mipsel||x86_64
default y if aarch64||x86_64
config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Server
bool "Include Shadowsocks Server"
default y
@ -43,7 +48,7 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_Trojan_Plus
config PACKAGE_$(PKG_NAME)_INCLUDE_Trojan_GO
bool "Include Trojan_GO"
default y if i386||x86_64||arm||aarch64
default n
config PACKAGE_$(PKG_NAME)_INCLUDE_Brook
bool "Include Brook"
@ -92,6 +97,7 @@ define Package/$(PKG_NAME)
+pdnsd-alt \
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks:shadowsocks-libev-ss-redir \
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks:shadowsocks-libev-ss-local \
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Rust:shadowsocks-rust-sslocal \
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Server:shadowsocks-libev-ss-server \
+PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR:shadowsocksr-libev-ssr-redir \
+PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR:shadowsocksr-libev-ssr-local \

View File

@ -292,7 +292,7 @@ function delete_select_nodes()
ucic:delete(appname, w)
end)
ucic:commit(appname)
luci.sys.call("/etc/init.d/" .. appname .. " restart")
luci.sys.call("/etc/init.d/" .. appname .. " restart > /dev/null 2>&1 &")
end
function check_port()

View File

@ -55,13 +55,14 @@ function get_args(arg, myarg)
end
function get_valid_nodes()
local nodes_ping = uci_get_type("global_other", "nodes_ping") or ""
local nodes = {}
uci:foreach(appname, "nodes", function(e)
e.id = e[".name"]
if e.type and e.remarks then
if e.protocol and (e.protocol == "_balancing" or e.protocol == "_shunt") then
e.remarks_name = "%s[%s] " % {i18n.translatef(e.type .. e.protocol), e.remarks}
e.node_type = "special"
e["remark"] = "%s[%s] " % {i18n.translatef(e.type .. e.protocol), e.remarks}
e["node_type"] = "special"
nodes[#nodes + 1] = e
end
if e.port and e.address then
@ -81,9 +82,15 @@ function get_valid_nodes()
type2 = type2 .. " " .. protocol
end
if datatypes.ip6addr(address) then address2 = "[" .. address .. "]" end
e.remarks_name = "%s[%s] %s:%s" % {type2, e.remarks, address2, e.port}
e["remark"] = "%s[%s]" % {type2, e.remarks}
if nodes_ping:find("info") then
e["remark"] = "%s[%s] %s:%s" % {type2, e.remarks, address2, e.port}
end
if e.use_kcp and e.use_kcp == "1" then
e.remarks_name = "%s+%s[%s] %s" % {type2, "Kcptun", e.remarks, address2}
e["remark"] = "%s+%s[%s]" % {type2, "Kcptun", e.remarks}
if nodes_ping:find("info") then
e["remark"] = "%s+%s[%s] %s" % {type2, "Kcptun", e.remarks, address2}
end
end
e.node_type = "normal"
nodes[#nodes + 1] = e

View File

@ -24,7 +24,7 @@ o.default = "1"
o = s:option(DynamicList, "tcp_node", "TCP " .. translate("List of backup nodes"))
for k, v in pairs(nodes_table) do
if v.node_type == "normal" then
o:value(v.id, v.remarks_name)
o:value(v.id, v["remark"])
end
end

View File

@ -20,7 +20,7 @@ uci:foreach(appname, "socks", function(s)
else
for k, n in pairs(nodes_table) do
if (s.node == n.id) then
remarks = n.remarks_name; break
remarks = n["remark"]; break
end
end
end
@ -125,7 +125,7 @@ if has_xray and #nodes_table > 0 then
o:value("_direct", translate("Direct Connection"))
o:value("_blackhole", translate("Blackhole"))
for k1, v1 in pairs(normal_list) do
o:value(v1.id, v1.remarks_name)
o:value(v1.id, v1["remark"])
end
o.cfgvalue = function(self, section)
return m:get(v.id, id) or "nil"
@ -141,7 +141,7 @@ if has_xray and #nodes_table > 0 then
o:value("_direct", translate("Direct Connection"))
o:value("_blackhole", translate("Blackhole"))
for k1, v1 in pairs(normal_list) do
o:value(v1.id, v1.remarks_name)
o:value(v1.id, v1["remark"])
end
o.cfgvalue = function(self, section)
return m:get(v.id, id) or "nil"
@ -155,7 +155,7 @@ if has_xray and #nodes_table > 0 then
o:depends("tcp_node", v.id)
o:value("nil", translate("Close"))
for k1, v1 in pairs(normal_list) do
o:value(v1.id, v1.remarks_name)
o:value(v1.id, v1["remark"])
end
o.cfgvalue = function(self, section)
return m:get(v.id, id) or "nil"
@ -370,14 +370,14 @@ if has_xray then
end
for k, v in pairs(nodes_table) do
tcp_node:value(v.id, v.remarks_name)
udp_node:value(v.id, v.remarks_name)
tcp_node:value(v.id, v["remark"])
udp_node:value(v.id, v["remark"])
if v.type == "Socks" then
if has_xray then
socks_node:value(v.id, v.remarks_name)
socks_node:value(v.id, v["remark"])
end
else
socks_node:value(v.id, v.remarks_name)
socks_node:value(v.id, v["remark"])
end
end

View File

@ -9,7 +9,7 @@ for k, e in ipairs(api.get_valid_nodes()) do
nodes_table[#nodes_table + 1] = {
id = e[".name"],
obj = e,
remarks = e.remarks_name
remarks = e["remark"]
}
end
end

View File

@ -72,7 +72,7 @@ type = s:option(ListValue, "type", translate("Type"))
if api.is_finded("ipt2socks") then
type:value("Socks", translate("Socks"))
end
if api.is_finded("ss-redir") then
if api.is_finded("sslocal") or api.is_finded("ss-redir") then
type:value("SS", translate("Shadowsocks"))
end
if api.is_finded("ssr-redir") then
@ -116,7 +116,7 @@ for k, e in ipairs(api.get_valid_nodes()) do
if e.node_type == "normal" then
nodes_table[#nodes_table + 1] = {
id = e[".name"],
remarks = e.remarks_name
remarks = e["remark"]
}
end
end

View File

@ -7,15 +7,15 @@ m = Map(appname)
s = m:section(TypedSection, "global_other")
s.anonymous = true
o = s:option(MultiValue, "nodes_ping", "Ping")
o = s:option(MultiValue, "nodes_ping", " ")
o:value("auto_ping", translate("Auto Ping"), translate("This will automatically ping the node for latency"))
o:value("tcping", translate("Tcping"), translate("This will use tcping replace ping detection of node"))
o:value("info", translate("Show server address and port"), translate("Show server address and port"))
-- [[ Add the node via the link ]]--
s:append(Template(appname .. "/node_list/link_add_node"))
local nodes_ping = m:get("@global_other[0]", "nodes_ping") or ""
local nodes_display = m:get("@global_other[0]", "nodes_display") or ""
-- [[ Node List ]]--
s = m:section(TypedSection, "nodes")
@ -38,58 +38,58 @@ end
s.sortable = true
-- 简洁模式
if true then
o = s:option(DummyValue, "add_mode", "")
o.cfgvalue = function(t, n)
local v = Value.cfgvalue(t, n)
if v and v ~= '' then
local group = m:get(n, "group") or ""
if group ~= "" then
v = v .. " " .. group
end
return v
else
return ''
end
end
o = s:option(DummyValue, "remarks", translate("Remarks"))
o.rawhtml = true
o.cfgvalue = function(t, n)
local str = ""
local is_sub = m:get(n, "is_sub") or ""
o = s:option(DummyValue, "add_mode", "")
o.cfgvalue = function(t, n)
local v = Value.cfgvalue(t, n)
if v and v ~= '' then
local group = m:get(n, "group") or ""
local remarks = m:get(n, "remarks") or ""
local type = m:get(n, "type") or ""
str = str .. string.format("<input type='hidden' id='cbid.%s.%s.type' value='%s'/>", appname, n, type)
if type == "Xray" then
local protocol = m:get(n, "protocol")
if protocol == "_balancing" then
protocol = "负载均衡"
elseif protocol == "_shunt" then
protocol = "分流"
elseif protocol == "vmess" then
protocol = "VMess"
elseif protocol == "vless" then
protocol = "VLESS"
else
protocol = protocol:gsub("^%l",string.upper)
end
type = type .. " " .. protocol
if group ~= "" then
v = v .. " " .. group
end
local address = m:get(n, "address") or ""
local port = m:get(n, "port") or ""
str = str .. translate(type) .. "" .. remarks
if address ~= "" and port ~= "" then
return v
else
return ''
end
end
o = s:option(DummyValue, "remarks", translate("Remarks"))
o.rawhtml = true
o.cfgvalue = function(t, n)
local str = ""
local is_sub = m:get(n, "is_sub") or ""
local group = m:get(n, "group") or ""
local remarks = m:get(n, "remarks") or ""
local type = m:get(n, "type") or ""
str = str .. string.format("<input type='hidden' id='cbid.%s.%s.type' value='%s'/>", appname, n, type)
if type == "Xray" then
local protocol = m:get(n, "protocol")
if protocol == "_balancing" then
protocol = "负载均衡"
elseif protocol == "_shunt" then
protocol = "分流"
elseif protocol == "vmess" then
protocol = "VMess"
elseif protocol == "vless" then
protocol = "VLESS"
else
protocol = protocol:gsub("^%l",string.upper)
end
type = type .. " " .. protocol
end
local address = m:get(n, "address") or ""
local port = m:get(n, "port") or ""
str = str .. translate(type) .. "" .. remarks
if address ~= "" and port ~= "" then
if nodes_ping:find("info") then
if datatypes.ip6addr(address) then
str = str .. string.format("[%s]:%s", address, port)
else
str = str .. string.format("%s:%s", address, port)
end
str = str .. string.format("<input type='hidden' id='cbid.%s.%s.address' value='%s'/>", appname, n, address)
str = str .. string.format("<input type='hidden' id='cbid.%s.%s.port' value='%s'/>", appname, n, port)
end
return str
str = str .. string.format("<input type='hidden' id='cbid.%s.%s.address' value='%s'/>", appname, n, address)
str = str .. string.format("<input type='hidden' id='cbid.%s.%s.port' value='%s'/>", appname, n, port)
end
return str
end
---- Ping

View File

@ -551,7 +551,7 @@ for k, e in ipairs(api.get_valid_nodes()) do
if e.node_type == "normal" and e.type == "Xray" then
nodes_table[#nodes_table + 1] = {
id = e[".name"],
remarks = e.remarks_name
remarks = e["remark"]
}
end
end

View File

@ -136,7 +136,7 @@ local api = require "luci.model.cbi.passwall.api.api"
<input class="cbi-button cbi-button-add" type="button" onclick="open_add_link_div()" value="<%:Add the node via the link%>" />
<input class="cbi-button cbi-button-remove" type="button" onclick="clear_all_nodes()" value="<%:Clear all nodes%>" />
<input class="cbi-button cbi-button-remove" type="button" onclick="delete_select_nodes()" value="<%:Delete select nodes%>" />
<input class="cbi-button" type="button" onclick="select_all(this)" value="<%:Select all%>" />
<input class="cbi-button" type="button" onclick="checked_all_node(this)" value="<%:Select all%>" />
<input class="cbi-button cbi-button-apply" type="submit" name="cbi.apply" value="<%:Save & Apply%>" />
</div>
</div>

View File

@ -27,10 +27,6 @@ table td, .table .td {
box-shadow: darkgrey 10px 10px 30px 5px;
}
._select {
background: #dad8d8 !important;
}
._now_use {
background: #94e1ff !important;
}
@ -125,75 +121,58 @@ table td, .table .td {
}
}
function select_node_div(btn, id) {
btn.value = "<%:DeSelect%>";
btn.setAttribute("onclick", "deselect_node_div(this, '" + id + "')");
var dom = document.getElementById("cbi-passwall-" + id);
if (dom) {
dom.classList.add("_select");
dom.setAttribute("nodes_id", id);
}
}
function deselect_node_div(btn, id) {
btn.value = "<%:Select%>";
btn.setAttribute("onclick", "select_node_div(this, '" + id + "')");
var dom = document.getElementById("cbi-passwall-" + id);
if (dom) {
dom.classList.remove("_select");
dom.removeAttribute("nodes_id");
}
}
function select_all(btn) {
var doms = document.getElementById("cbi-passwall-nodes").getElementsByClassName("cbi-section-table-row");
function checked_all_node(btn) {
var doms = document.getElementById("cbi-passwall-nodes").getElementsByClassName("nodes_select");
if (doms && doms.length > 0) {
for (var i = 0 ; i < doms.length; i++) {
var id = doms[i].id.replace("cbi-passwall-", "");
var btn2 = document.getElementById("select_" + id);
select_node_div(btn2, id);
doms[i].checked = true;
}
btn.value = "<%:DeSelect all%>";
btn.setAttribute("onclick", "deselect_all(this)");
btn.setAttribute("onclick", "dechecked_all_node(this)");
}
}
function deselect_all(btn) {
var doms = document.getElementById("cbi-passwall-nodes").getElementsByClassName("cbi-section-table-row");
function dechecked_all_node(btn) {
var doms = document.getElementById("cbi-passwall-nodes").getElementsByClassName("nodes_select");
if (doms && doms.length > 0) {
for (var i = 0 ; i < doms.length; i++) {
var id = doms[i].id.replace("cbi-passwall-", "");
var btn2 = document.getElementById("select_" + id);
deselect_node_div(btn2, id);
doms[i].checked = false;
}
btn.value = "<%:Select all%>";
btn.setAttribute("onclick", "select_all(this)");
btn.setAttribute("onclick", "checked_all_node(this)");
}
}
function delete_select_nodes() {
var doms = document.getElementsByClassName("_select");
var ids = [];
var doms = document.getElementById("cbi-passwall-nodes").getElementsByClassName("nodes_select");
if (doms && doms.length > 0) {
var ids = [];
for (var i = 0 ; i < doms.length; i++) {
if (doms[i].getAttribute("nodes_id")) {
ids.push(doms[i].getAttribute("nodes_id"))
if (doms[i].checked) {
ids.push(doms[i].getAttribute("cbid"))
}
}
if (confirm('<%:Are you sure to delete select nodes?%>') == true){
XHR.get('<%=api.url("delete_select_nodes")%>', {
ids: ids.join()
},
function(x, data) {
if(x && x.status == 200) {
window.location.href = '<%=api.url("node_list")%>';
}
else {
alert("<%:Error%>");
}
});
if (ids.length > 0) {
if (confirm('<%:Are you sure to delete select nodes?%>') == true){
XHR.get('<%=api.url("delete_select_nodes")%>', {
ids: ids.join()
},
function(x, data) {
if (x && x.status == 200) {
for (var i = 0 ; i < ids.length; i++) {
var box = document.getElementById("cbi-passwall-" + ids[i]);
box.remove();
}
//window.location.href = '<%=api.url("node_list")%>';
}
else {
alert("<%:Error%>");
}
});
}
}
} else {
}
if (ids.length <= 0) {
alert("<%:You no select nodes !%>");
}
}
@ -404,10 +383,10 @@ table td, .table .td {
var id = onclick_str.substring(onclick_str.lastIndexOf('/') + 1, onclick_str.length - 1);
var td = edit_btn[i].parentNode;
var new_div = "";
//添加"勾选"框
new_div += '<input class="cbi-input-checkbox nodes_select" type="checkbox" cbid="' + id + '" />&nbsp;&nbsp;';
//添加"置顶"按钮
new_div += '<input class="cbi-button" type="button" value="<%:To Top%>" onclick="_cbi_row_top(\'' + id + '\')"/>&nbsp;&nbsp;';
//添加"选择"按钮
new_div += '<input class="cbi-button cbi-button-add" type="button" value="<%:Select%>" id="select_' + id + '" onclick="select_node_div(this, \'' + id + '\')"/>&nbsp;&nbsp;';
//添加"应用"按钮
new_div += '<input class="cbi-button cbi-button-apply" type="button" value="<%:Use%>" id="apply_' + id + '" onclick="open_set_node_div(\'' + id + '\')"/>&nbsp;&nbsp;';
//添加"复制"按钮

View File

@ -532,6 +532,9 @@ msgstr "选中后保存应用后即使用tcping替换ping检测节点"
msgid "Concise display nodes"
msgstr "简洁显示节点"
msgid "Show server address and port"
msgstr "显示服务器地址和端口"
msgid "Apply"
msgstr "应用"

View File

@ -409,7 +409,10 @@ run_socks() {
;;
ss|ssr)
lua $API_GEN_SS -node $node -local_addr "0.0.0.0" -local_port $socks_port -server_host $server_host -server_port $port > $config_file
ln_start_bin "$(first_type ${type}-local)" "${type}-local" $log_file -c "$config_file" -b "$bind" -u -v
ss_program="$(first_type ${type}local ${type}-local)"
[ "$(printf '%s' "$ss_program" | awk -F '/' '{print $NF}')" = "${type}local" ] && \
ss_extra_arg="-U" || ss_extra_arg="-u"
ln_start_bin "$ss_program" "${type}-local" $log_file -c "$config_file" -v $ss_extra_arg
;;
esac
@ -488,7 +491,10 @@ run_redir() {
;;
ss|ssr)
lua $API_GEN_SS -node $node -local_addr "0.0.0.0" -local_port $local_port > $config_file
ln_start_bin "$(first_type ${type}-redir)" "${type}-redir" $log_file -c "$config_file" -U -v
ss_program="$(first_type ${type}local ${type}-redir)"
[ "$(printf '%s' "$ss_program" | awk -F '/' '{print $NF}')" = "${type}local" ] && \
ss_extra_arg="--protocol redir -u" || ss_extra_arg="-U"
ln_start_bin "$ss_program" "${type}-redir" $log_file -c "$config_file" -v $ss_extra_arg
;;
esac
;;
@ -574,14 +580,17 @@ run_redir() {
fi
;;
ss|ssr)
ss_program="$(first_type ${type}local ${type}-redir)"
[ "$(printf '%s' "$ss_program" | awk -F '/' '{print $NF}')" = "${type}local" ] && \
ss_extra_arg="--protocol redir"
if [ "$kcptun_use" == "1" ]; then
lua $API_GEN_SS -node $node -local_addr "0.0.0.0" -local_port $local_port -server_host "127.0.0.1" -server_port $KCPTUN_REDIR_PORT > $config_file
[ "$UDP_NODE" == "tcp" ] && echolog "Kcptun不支持UDP转发"
else
lua $API_GEN_SS -node $node -local_addr "0.0.0.0" -local_port $local_port > $config_file
[ "$UDP_NODE" == "tcp" ] && extra_param="-u"
[ "$UDP_NODE" == "tcp" ] && ss_extra_arg="$ss_extra_arg -u"
fi
ln_start_bin "$(first_type ${type}-redir)" "${type}-redir" $log_file -c "$config_file" -v $extra_param
ln_start_bin "$ss_program" "${type}-redir" $log_file -c "$config_file" -v $ss_extra_arg
;;
esac
if [ -n "$_socks_flag" ]; then

View File

@ -208,7 +208,7 @@ load_acl() {
fi
[ "$tcp_no_redir_ports" != "disable" ] && {
$ipt_tmp -A PSW $(comment "$remarks") $(factor $ip "-s") $(factor $mac "-m mac --mac-source") -p tcp -m multiport --dport $tcp_no_redir_ports -j RETURN
$ip6t_m -A PSW $(comment "$remarks") $(factor $ip "-s") $(factor $mac "-m mac --mac-source") -p tcp -m multiport --dport $tcp_no_redir_ports -j RETURN
$ip6t_m -A PSW $(comment "$remarks") $(factor $ip "-s") $(factor $mac "-m mac --mac-source") -p tcp -m multiport --dport $tcp_no_redir_ports -j RETURN 2>/dev/null
msg2="${msg2}[$?]除${tcp_no_redir_ports}外的"
}
msg2="${msg2}所有端口"
@ -218,15 +218,15 @@ load_acl() {
$ipt_tmp -A PSW $(comment "$remarks") -p tcp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $tcp_redir_ports "-m multiport --dport") $(get_redirect_ipt $tcp_proxy_mode $tcp_port $is_tproxy)
if [ "$PROXY_IPV6" == "1" ]; then
$ip6t_m -A PSW $(comment "$remarks") -p tcp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $tcp_redir_ports "-m multiport --dport") $(dst $IPSET_SHUNTLIST6) $(REDIRECT $tcp_port TPROXY)
$ip6t_m -A PSW $(comment "$remarks") -p tcp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $tcp_redir_ports "-m multiport --dport") $(dst $IPSET_BLACKLIST6) $(REDIRECT $tcp_port TPROXY)
$ip6t_m -A PSW $(comment "$remarks") -p tcp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $tcp_redir_ports "-m multiport --dport") $(get_redirect_ip6t $tcp_proxy_mode $tcp_port TPROXY)
$ip6t_m -A PSW $(comment "$remarks") -p tcp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $tcp_redir_ports "-m multiport --dport") $(dst $IPSET_SHUNTLIST6) $(REDIRECT $tcp_port TPROXY) 2>/dev/null
$ip6t_m -A PSW $(comment "$remarks") -p tcp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $tcp_redir_ports "-m multiport --dport") $(dst $IPSET_BLACKLIST6) $(REDIRECT $tcp_port TPROXY) 2>/dev/null
$ip6t_m -A PSW $(comment "$remarks") -p tcp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $tcp_redir_ports "-m multiport --dport") $(get_redirect_ip6t $tcp_proxy_mode $tcp_port TPROXY) 2>/dev/null
fi
}
echolog " - ${msg2}"
}
$ipt_tmp -A PSW $(comment "$remarks") $(factor $ip "-s") $(factor $mac "-m mac --mac-source") -p tcp -j RETURN
$ip6t_m -A PSW $(comment "$remarks") $(factor $ip "-s") $(factor $mac "-m mac --mac-source") -p tcp -j RETURN
$ip6t_m -A PSW $(comment "$remarks") $(factor $ip "-s") $(factor $mac "-m mac --mac-source") -p tcp -j RETURN 2>/dev/null
[ "$udp_proxy_mode" != "disable" ] && {
msg2="${msg}使用UDP节点 [$(get_action_chain_name $udp_proxy_mode)]"
@ -235,7 +235,7 @@ load_acl() {
msg2="${msg2}(TPROXY:${udp_port})代理"
[ "$udp_no_redir_ports" != "disable" ] && {
$ipt_m -A PSW $(comment "$remarks") $(factor $ip "-s") $(factor $mac "-m mac --mac-source") -p udp -m multiport --dport $udp_no_redir_ports -j RETURN
$ip6t_m -A PSW $(comment "$remarks") $(factor $ip "-s") $(factor $mac "-m mac --mac-source") -p udp -m multiport --dport $udp_no_redir_ports -j RETURN
$ip6t_m -A PSW $(comment "$remarks") $(factor $ip "-s") $(factor $mac "-m mac --mac-source") -p udp -m multiport --dport $udp_no_redir_ports -j RETURN 2>/dev/null
msg2="${msg2}[$?]除${udp_no_redir_ports}外的"
}
msg2="${msg2}所有端口"
@ -245,15 +245,15 @@ load_acl() {
$ipt_m -A PSW $(comment "$remarks") -p udp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $udp_redir_ports "-m multiport --dport") $(get_redirect_ipt $udp_proxy_mode $udp_port TPROXY)
if [ "$PROXY_IPV6" == "1" ]; then
$ip6t_m -A PSW $(comment "$remarks") -p udp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $udp_redir_ports "-m multiport --dport") $(dst $IPSET_SHUNTLIST6) $(REDIRECT $udp_port TPROXY)
$ip6t_m -A PSW $(comment "$remarks") -p udp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $udp_redir_ports "-m multiport --dport") $(dst $IPSET_BLACKLIST6) $(REDIRECT $udp_port TPROXY)
$ip6t_m -A PSW $(comment "$remarks") -p udp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $udp_redir_ports "-m multiport --dport") $(get_redirect_ip6t $udp_proxy_mode $udp_port TPROXY)
$ip6t_m -A PSW $(comment "$remarks") -p udp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $udp_redir_ports "-m multiport --dport") $(dst $IPSET_SHUNTLIST6) $(REDIRECT $udp_port TPROXY) 2>/dev/null
$ip6t_m -A PSW $(comment "$remarks") -p udp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $udp_redir_ports "-m multiport --dport") $(dst $IPSET_BLACKLIST6) $(REDIRECT $udp_port TPROXY) 2>/dev/null
$ip6t_m -A PSW $(comment "$remarks") -p udp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $udp_redir_ports "-m multiport --dport") $(get_redirect_ip6t $udp_proxy_mode $udp_port TPROXY) 2>/dev/null
fi
}
echolog " - ${msg2}"
}
$ipt_m -A PSW $(comment "$remarks") $(factor $ip "-s") $(factor $mac "-m mac --mac-source") -p udp -j RETURN
$ip6t_m -A PSW $(comment "$remarks") $(factor $ip "-s") $(factor $mac "-m mac --mac-source") -p udp -j RETURN
$ip6t_m -A PSW $(comment "$remarks") $(factor $ip "-s") $(factor $mac "-m mac --mac-source") -p udp -j RETURN 2>/dev/null
done
}
@ -339,7 +339,7 @@ filter_haproxy() {
filter_vpsip() {
uci show $CONFIG | grep ".address=" | cut -d "'" -f 2 | grep -E "([0-9]{1,3}[\.]){3}[0-9]{1,3}" | sed -e "/^$/d" | sed -e "s/^/add $IPSET_VPSIPLIST &/g" | awk '{print $0} END{print "COMMIT"}' | ipset -! -R
uci show $CONFIG | grep ".address=" | cut -d "'" -f 2 | grep -E "([[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){0,7}::[a-f0-9]{0,4}(:[a-f0-9]{1,4}){0,7}])" | sed -e "/^$/d" | sed -e "s/^/add $IPSET_VPSIPLIST6 &/g" | awk '{print $0} END{print "COMMIT"}' | ipset -! -R
uci show $CONFIG | grep ".address=" | cut -d "'" -f 2 | grep -E "([A-Fa-f0-9]{1,4}::?){1,7}[A-Fa-f0-9]{1,4}" | sed -e "/^$/d" | sed -e "s/^/add $IPSET_VPSIPLIST6 &/g" | awk '{print $0} END{print "COMMIT"}' | ipset -! -R
echolog "加入所有节点到ipset[$IPSET_VPSIPLIST]直连完成"
}
@ -394,7 +394,7 @@ filter_node() {
dst_rule=" -j RETURN"
msg2="直连代理"
}
$_ipt -I PSW_OUTPUT $ADD_INDEX $(comment "${address}:${port}") -p $stream -d $address --dport $port $dst_rule 2>/dev/null
$_ipt -w -I PSW_OUTPUT $ADD_INDEX $(comment "${address}:${port}") -p $stream -d $address --dport $port $dst_rule 2>/dev/null
else
msg2="已配置过的节点,"
fi

View File

@ -8,6 +8,7 @@ require 'luci.model.uci'
require 'luci.util'
require 'luci.jsonc'
require 'luci.sys'
local datatypes = require "luci.cbi.datatypes"
local api = require "luci.model.cbi.passwall.api.api"
local has_xray = api.is_finded("xray")
@ -731,7 +732,7 @@ local function update_node(manual)
log("更新失败,没有可用的节点信息")
return
end
-- delet all for subscribe nodes
-- delete all for subscribe nodes
ucic2:foreach(application, uciType, function(node)
-- 如果是手动导入的节点就不参与删除
if manual == 0 and (node.is_sub or node.hashkey) and node.add_mode ~= '导入' then
@ -785,8 +786,8 @@ local function update_node(manual)
]]--
ucic2:commit(application)
--luci.sys.call("/etc/init.d/" .. application .. " restart > /dev/null 2>&1 &") -- 不加&的话日志会出现的更早
end
luci.sys.call("/etc/init.d/" .. application .. " restart > /dev/null 2>&1 &")
end
local function parse_link(raw, remark, manual)
@ -848,9 +849,7 @@ local function parse_link(raw, remark, manual)
if (not manual and is_filter_keyword(result.remarks)) or
not result.address or
result.remarks == "NULL" or
result.address:match("[^0-9a-zA-Z%-%_%.%s]") or -- 中文做地址的 也没有人拿中文域名搞就算中文域也有Puny Code SB 机场
not result.address:find("%.") or -- 虽然没有.也算域,不过应该没有人会这样干吧
result.address:sub(#result.address) == "." -- 结尾是.
(not datatypes.hostname(result.address) and not (datatypes.ipmask4(result.address) or datatypes.ipmask6(result.address)))
then
log('丢弃过滤节点: ' .. result.type .. ' 节点, ' .. result.remarks)
else