update 2026-09-02 16:19:19

This commit is contained in:
action committed 2026-09-02 16:19:19 +08:00
1 parent e9e78405e1
commit 86b8972e8e
11 files changed
+47 -7

No files matched your search

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 319 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 389 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 640 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 550 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 547 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 659 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 650 KiB

@@ -346,8 +346,12 @@ function index_status()
has_tproxy = (mods:find("TPROXY") or mods:find("nft_tproxy")) and "1" or "0" has_tproxy = (mods:find("TPROXY") or mods:find("nft_tproxy")) and "1" or "0"
api.set_cache_var("HAS_TPROXY", has_tproxy) api.set_cache_var("HAS_TPROXY", has_tproxy)
end end
local tcp_redir = api.get_cache_var("DEFAULT_TCP_REDIR")
local udp_redir = api.get_cache_var("DEFAULT_UDP_REDIR")
if tcp_redir == "1" then
e["tcp_status"] = luci.sys.call("/bin/busybox top -bn1 | grep -v 'grep' | grep '%s/bin/' | grep 'default' | grep 'global' >/dev/null" % api.TMP_PATH) == 0 e["tcp_status"] = luci.sys.call("/bin/busybox top -bn1 | grep -v 'grep' | grep '%s/bin/' | grep 'default' | grep 'global' >/dev/null" % api.TMP_PATH) == 0
if has_tproxy == "1" then end
if has_tproxy == "1" and udp_redir == "1" then
e["udp_status"] = luci.sys.call("/bin/busybox top -bn1 | grep -v -E 'grep|naive' | grep '%s/bin/' | grep 'default' | grep 'global' >/dev/null" % api.TMP_PATH) == 0 e["udp_status"] = luci.sys.call("/bin/busybox top -bn1 | grep -v -E 'grep|naive' | grep '%s/bin/' | grep 'default' | grep 'global' >/dev/null" % api.TMP_PATH) == 0
end end
end end
@@ -962,7 +966,7 @@ function geo_view()
return return
end end
local function get_rules(str, type) local function get_rules(str, type)
local rules_id = {} local rules = {}
uci_foreach("shunt_rules", function(s) uci_foreach("shunt_rules", function(s)
local list local list
if type == "geoip" then list = s.ip_list else list = s.domain_list end if type == "geoip" then list = s.ip_list else list = s.domain_list end
@@ -971,14 +975,18 @@ function geo_view()
local prefix, main = line:match("^(.-):(.*)") local prefix, main = line:match("^(.-):(.*)")
if not main then main = line end if not main then main = line end
if type == "geoip" and (api.datatypes.ipaddr(str) or api.datatypes.ip6addr(str)) then if type == "geoip" and (api.datatypes.ipaddr(str) or api.datatypes.ip6addr(str)) then
if main:find(str, 1, true) then rules_id[#rules_id + 1] = s[".name"] end if main:find(str, 1, true) then
table.insert(rules, {id = s[".name"], group = s.group or i18n.translate("default")})
end
else else
if main == str then rules_id[#rules_id + 1] = s[".name"] end if main == str then
table.insert(rules, {id = s[".name"], group = s.group or i18n.translate("default")})
end
end end
end end
end end
end) end)
return rules_id return rules
end end
local geo_dir = (uci_get("@global_rules[0]", "v2ray_location_asset") or "/usr/share/v2ray/"):match("^(.*)/") local geo_dir = (uci_get("@global_rules[0]", "v2ray_location_asset") or "/usr/share/v2ray/"):match("^(.*)/")
local geosite_path = geo_dir .. "/geosite.dat" local geosite_path = geo_dir .. "/geosite.dat"
@@ -999,11 +1007,17 @@ function geo_view()
for line in geo_string:gmatch("([^\n]+)") do for line in geo_string:gmatch("([^\n]+)") do
lines[#lines + 1] = geo_type .. ":" .. line lines[#lines + 1] = geo_type .. ":" .. line
for _, r in ipairs(get_rules(line, geo_type) or {}) do for _, r in ipairs(get_rules(line, geo_type) or {}) do
if not seen[r] then seen[r] = true; rules[#rules + 1] = r end if not seen[r.id] then
seen[r.id] = true
rules[#rules + 1] = string.format("[%s]%s", r.group, r.id)
end
end end
end end
for _, r in ipairs(get_rules(value, geo_type) or {}) do for _, r in ipairs(get_rules(value, geo_type) or {}) do
if not seen[r] then seen[r] = true; rules[#rules + 1] = r end if not seen[r.id] then
seen[r.id] = true
rules[#rules + 1] = string.format("[%s]%s", r.group, r.id)
end
end end
geo_string = table.concat(lines, "\n") geo_string = table.concat(lines, "\n")
if #rules > 0 then if #rules > 0 then
@@ -560,6 +560,8 @@ load_acl() {
msg="【默认】," msg="【默认】,"
local ipt_tmp=$ipt_n local ipt_tmp=$ipt_n
[ -n "${is_tproxy}" ] && ipt_tmp=$ipt_m [ -n "${is_tproxy}" ] && ipt_tmp=$ipt_m
local DEFAULT_TCP_REDIR=1
local DEFAULT_UDP_REDIR=1
[ "$TCP_NO_REDIR_PORTS" != "disable" ] && { [ "$TCP_NO_REDIR_PORTS" != "disable" ] && {
add_port_rules "$ip6t_m -A PSW $(comment "默认") -p tcp" $TCP_NO_REDIR_PORTS "-j RETURN" add_port_rules "$ip6t_m -A PSW $(comment "默认") -p tcp" $TCP_NO_REDIR_PORTS "-j RETURN"
@@ -568,6 +570,7 @@ load_acl() {
echolog " - ${msg}不代理 TCP 端口[${TCP_NO_REDIR_PORTS}]" echolog " - ${msg}不代理 TCP 端口[${TCP_NO_REDIR_PORTS}]"
else else
unset TCP_PROXY_MODE unset TCP_PROXY_MODE
DEFAULT_TCP_REDIR=0
echolog " - ${msg}不代理所有 TCP 端口" echolog " - ${msg}不代理所有 TCP 端口"
fi fi
} }
@@ -579,6 +582,7 @@ load_acl() {
echolog " - ${msg}不代理 UDP 端口[${UDP_NO_REDIR_PORTS}]" echolog " - ${msg}不代理 UDP 端口[${UDP_NO_REDIR_PORTS}]"
else else
unset UDP_PROXY_MODE unset UDP_PROXY_MODE
DEFAULT_UDP_REDIR=0
echolog " - ${msg}不代理所有 UDP 端口" echolog " - ${msg}不代理所有 UDP 端口"
fi fi
} }
@@ -626,6 +630,9 @@ load_acl() {
[ "${USE_SHUNT_NODE}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "默认") -p tcp" $TCP_PROXY_DROP_PORTS $(dst $IPSET_SHUNT) "-j MARK --set-mark 88" [ "${USE_SHUNT_NODE}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "默认") -p tcp" $TCP_PROXY_DROP_PORTS $(dst $IPSET_SHUNT) "-j MARK --set-mark 88"
[ "${TCP_PROXY_MODE}" != "disable" ] && add_port_rules "$ipt_m -A PSW $(comment "默认") -p tcp" $TCP_PROXY_DROP_PORTS "-j MARK --set-mark 88" [ "${TCP_PROXY_MODE}" != "disable" ] && add_port_rules "$ipt_m -A PSW $(comment "默认") -p tcp" $TCP_PROXY_DROP_PORTS "-j MARK --set-mark 88"
echolog " - ${msg}屏蔽代理 TCP 端口[${TCP_PROXY_DROP_PORTS}]" echolog " - ${msg}屏蔽代理 TCP 端口[${TCP_PROXY_DROP_PORTS}]"
if has_1_65535 "$TCP_PROXY_DROP_PORTS"; then
DEFAULT_TCP_REDIR=0
fi
} }
[ "$UDP_PROXY_DROP_PORTS" != "disable" ] && { [ "$UDP_PROXY_DROP_PORTS" != "disable" ] && {
@@ -644,6 +651,9 @@ load_acl() {
[ "${USE_SHUNT_NODE}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "默认") -p udp" $UDP_PROXY_DROP_PORTS "$(dst $IPSET_SHUNT) -j MARK --set-mark 88" [ "${USE_SHUNT_NODE}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "默认") -p udp" $UDP_PROXY_DROP_PORTS "$(dst $IPSET_SHUNT) -j MARK --set-mark 88"
[ "${UDP_PROXY_MODE}" != "disable" ] && add_port_rules "$ipt_m -A PSW $(comment "默认") -p udp" $UDP_PROXY_DROP_PORTS "-j MARK --set-mark 88" [ "${UDP_PROXY_MODE}" != "disable" ] && add_port_rules "$ipt_m -A PSW $(comment "默认") -p udp" $UDP_PROXY_DROP_PORTS "-j MARK --set-mark 88"
echolog " - ${msg}屏蔽代理 UDP 端口[${UDP_PROXY_DROP_PORTS}]" echolog " - ${msg}屏蔽代理 UDP 端口[${UDP_PROXY_DROP_PORTS}]"
if has_1_65535 "$UDP_PROXY_DROP_PORTS"; then
DEFAULT_UDP_REDIR=0
fi
} }
$ipt_m -A PSW $(comment "默认") -m mark --mark 88 -j ACCEPT 2>/dev/null $ipt_m -A PSW $(comment "默认") -m mark --mark 88 -j ACCEPT 2>/dev/null
@@ -652,6 +662,9 @@ load_acl() {
} }
} }
set_cache_var "DEFAULT_TCP_REDIR" "$DEFAULT_TCP_REDIR"
set_cache_var "DEFAULT_UDP_REDIR" "$DEFAULT_UDP_REDIR"
# 加载TCP默认代理模式 # 加载TCP默认代理模式
if [ -n "${TCP_PROXY_MODE}" ]; then if [ -n "${TCP_PROXY_MODE}" ]; then
[ -n "$NODE" ] && { [ -n "$NODE" ] && {
@@ -620,6 +620,8 @@ load_acl() {
} }
[ "$ENABLED_DEFAULT_ACL" = 1 ] && [ "$CLIENT_PROXY" = 1 ] && { [ "$ENABLED_DEFAULT_ACL" = 1 ] && [ "$CLIENT_PROXY" = 1 ] && {
local DEFAULT_TCP_REDIR=1
local DEFAULT_UDP_REDIR=1
msg="【默认】," msg="【默认】,"
[ "$TCP_NO_REDIR_PORTS" != "disable" ] && { [ "$TCP_NO_REDIR_PORTS" != "disable" ] && {
nft "add rule $NFTABLE_NAME $nft_prerouting_chain ip protocol tcp $(factor $TCP_NO_REDIR_PORTS "tcp dport") counter return comment \"默认\"" nft "add rule $NFTABLE_NAME $nft_prerouting_chain ip protocol tcp $(factor $TCP_NO_REDIR_PORTS "tcp dport") counter return comment \"默认\""
@@ -628,6 +630,7 @@ load_acl() {
echolog " - ${msg}不代理 TCP 端口[${TCP_NO_REDIR_PORTS}]" echolog " - ${msg}不代理 TCP 端口[${TCP_NO_REDIR_PORTS}]"
else else
unset TCP_PROXY_MODE unset TCP_PROXY_MODE
DEFAULT_TCP_REDIR=0
echolog " - ${msg}不代理所有 TCP 端口" echolog " - ${msg}不代理所有 TCP 端口"
fi fi
} }
@@ -639,6 +642,7 @@ load_acl() {
echolog " - ${msg}不代理 UDP 端口[${UDP_NO_REDIR_PORTS}]" echolog " - ${msg}不代理 UDP 端口[${UDP_NO_REDIR_PORTS}]"
else else
unset UDP_PROXY_MODE unset UDP_PROXY_MODE
DEFAULT_UDP_REDIR=0
echolog " - ${msg}不代理所有 UDP 端口" echolog " - ${msg}不代理所有 UDP 端口"
fi fi
} }
@@ -689,6 +693,9 @@ load_acl() {
[ "${USE_SHUNT_NODE}" = "1" ] && nft_rule_dual "$nft_prerouting_chain" "ip protocol tcp $(factor $TCP_PROXY_DROP_PORTS "tcp dport") ip daddr" "$NFTSET_SHUNT" "counter reject comment \"默认\"" [ "${USE_SHUNT_NODE}" = "1" ] && nft_rule_dual "$nft_prerouting_chain" "ip protocol tcp $(factor $TCP_PROXY_DROP_PORTS "tcp dport") ip daddr" "$NFTSET_SHUNT" "counter reject comment \"默认\""
[ "${TCP_PROXY_MODE}" != "disable" ] && nft "add rule $NFTABLE_NAME $nft_prerouting_chain ip protocol tcp $(factor $TCP_PROXY_DROP_PORTS "tcp dport") counter reject comment \"默认\"" [ "${TCP_PROXY_MODE}" != "disable" ] && nft "add rule $NFTABLE_NAME $nft_prerouting_chain ip protocol tcp $(factor $TCP_PROXY_DROP_PORTS "tcp dport") counter reject comment \"默认\""
echolog " - ${msg}屏蔽代理 TCP 端口[${TCP_PROXY_DROP_PORTS}]" echolog " - ${msg}屏蔽代理 TCP 端口[${TCP_PROXY_DROP_PORTS}]"
if has_1_65535 "$TCP_PROXY_DROP_PORTS"; then
DEFAULT_TCP_REDIR=0
fi
} }
[ "$UDP_PROXY_DROP_PORTS" != "disable" ] && { [ "$UDP_PROXY_DROP_PORTS" != "disable" ] && {
@@ -707,9 +714,15 @@ load_acl() {
[ "${USE_SHUNT_NODE}" = "1" ] && nft_rule_dual "PSW_MANGLE" "ip protocol udp $(factor $UDP_PROXY_DROP_PORTS "udp dport") ip daddr" "$NFTSET_SHUNT" "counter reject comment \"默认\"" [ "${USE_SHUNT_NODE}" = "1" ] && nft_rule_dual "PSW_MANGLE" "ip protocol udp $(factor $UDP_PROXY_DROP_PORTS "udp dport") ip daddr" "$NFTSET_SHUNT" "counter reject comment \"默认\""
[ "${UDP_PROXY_MODE}" != "disable" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE ip protocol udp $(factor $UDP_PROXY_DROP_PORTS "udp dport") counter reject comment \"默认\"" [ "${UDP_PROXY_MODE}" != "disable" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE ip protocol udp $(factor $UDP_PROXY_DROP_PORTS "udp dport") counter reject comment \"默认\""
echolog " - ${msg}屏蔽代理 UDP 端口[${UDP_PROXY_DROP_PORTS}]" echolog " - ${msg}屏蔽代理 UDP 端口[${UDP_PROXY_DROP_PORTS}]"
if has_1_65535 "$UDP_PROXY_DROP_PORTS"; then
DEFAULT_UDP_REDIR=0
fi
} }
} }
set_cache_var "DEFAULT_TCP_REDIR" "$DEFAULT_TCP_REDIR"
set_cache_var "DEFAULT_UDP_REDIR" "$DEFAULT_UDP_REDIR"
# 加载TCP默认代理模式 # 加载TCP默认代理模式
if [ -n "${TCP_PROXY_MODE}" ]; then if [ -n "${TCP_PROXY_MODE}" ]; then
[ -n "$NODE" ] && { [ -n "$NODE" ] && {