update 2024-11-18 16:28:17
This commit is contained in:
parent
d0e359209d
commit
5cd087f026
|
@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=luci-app-passwall
|
PKG_NAME:=luci-app-passwall
|
||||||
PKG_VERSION:=24.11.18
|
PKG_VERSION:=24.11.18
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=2
|
||||||
|
|
||||||
PKG_CONFIG_DEPENDS:= \
|
PKG_CONFIG_DEPENDS:= \
|
||||||
CONFIG_PACKAGE_$(PKG_NAME)_Iptables_Transparent_Proxy \
|
CONFIG_PACKAGE_$(PKG_NAME)_Iptables_Transparent_Proxy \
|
||||||
|
|
|
@ -927,11 +927,9 @@ function gen_config(var)
|
||||||
if node.protocol == "_shunt" then
|
if node.protocol == "_shunt" then
|
||||||
local rules = {}
|
local rules = {}
|
||||||
|
|
||||||
local preproxy_enabled = node.preproxy_enabled == "1"
|
local preproxy_rule_name = node.preproxy_enabled == "1" and "main" or nil
|
||||||
local preproxy_rule_name = "main"
|
local preproxy_tag = preproxy_rule_name
|
||||||
local preproxy_tag = "main"
|
local preproxy_node_id = preproxy_rule_name and node["main_node"] or nil
|
||||||
local preproxy_node_id = node["main_node"]
|
|
||||||
local preproxy_node = preproxy_enabled and preproxy_node_id and uci:get_all(appname, preproxy_node_id) or nil
|
|
||||||
|
|
||||||
local function gen_shunt_node(rule_name, _node_id)
|
local function gen_shunt_node(rule_name, _node_id)
|
||||||
if not rule_name then return nil, nil end
|
if not rule_name then return nil, nil end
|
||||||
|
@ -956,7 +954,6 @@ function gen_config(var)
|
||||||
}
|
}
|
||||||
local _outbound = gen_outbound(flag, _node, rule_name)
|
local _outbound = gen_outbound(flag, _node, rule_name)
|
||||||
if _outbound then
|
if _outbound then
|
||||||
_outbound.tag = _outbound.tag .. ":" .. _node.remarks
|
|
||||||
table.insert(outbounds, _outbound)
|
table.insert(outbounds, _outbound)
|
||||||
rule_outboundTag = _outbound.tag
|
rule_outboundTag = _outbound.tag
|
||||||
end
|
end
|
||||||
|
@ -966,10 +963,10 @@ function gen_config(var)
|
||||||
if not _node then return nil, nil end
|
if not _node then return nil, nil end
|
||||||
|
|
||||||
if api.is_normal_node(_node) then
|
if api.is_normal_node(_node) then
|
||||||
local proxy = preproxy_enabled and node[rule_name .. "_proxy_tag"] == preproxy_rule_name and _node_id ~= preproxy_node_id
|
local use_proxy = preproxy_tag and node[rule_name .. "_proxy_tag"] == preproxy_rule_name and _node_id ~= preproxy_node_id
|
||||||
local copied_outbound
|
local copied_outbound
|
||||||
for index, value in ipairs(outbounds) do
|
for index, value in ipairs(outbounds) do
|
||||||
if value["_id"] == _node_id and value["_flag_proxy_tag"] == preproxy_tag then
|
if value["_id"] == _node_id and value["_flag_proxy_tag"] == (use_proxy and preproxy_tag or nil) then
|
||||||
copied_outbound = api.clone(value)
|
copied_outbound = api.clone(value)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
@ -979,7 +976,7 @@ function gen_config(var)
|
||||||
table.insert(outbounds, copied_outbound)
|
table.insert(outbounds, copied_outbound)
|
||||||
rule_outboundTag = copied_outbound.tag
|
rule_outboundTag = copied_outbound.tag
|
||||||
else
|
else
|
||||||
if proxy then
|
if use_proxy then
|
||||||
local pre_proxy = nil
|
local pre_proxy = nil
|
||||||
if _node.type ~= "sing-box" then
|
if _node.type ~= "sing-box" then
|
||||||
pre_proxy = true
|
pre_proxy = true
|
||||||
|
@ -1006,7 +1003,7 @@ function gen_config(var)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local _outbound = gen_outbound(flag, _node, rule_name, { tag = proxy and preproxy_tag or nil })
|
local _outbound = gen_outbound(flag, _node, rule_name, { tag = use_proxy and preproxy_tag or nil })
|
||||||
if _outbound then
|
if _outbound then
|
||||||
_outbound.tag = _outbound.tag .. ":" .. _node.remarks
|
_outbound.tag = _outbound.tag .. ":" .. _node.remarks
|
||||||
rule_outboundTag = set_outbound_detour(_node, _outbound, outbounds, rule_name)
|
rule_outboundTag = set_outbound_detour(_node, _outbound, outbounds, rule_name)
|
||||||
|
@ -1030,12 +1027,10 @@ function gen_config(var)
|
||||||
return rule_outboundTag
|
return rule_outboundTag
|
||||||
end
|
end
|
||||||
|
|
||||||
if preproxy_node then
|
if preproxy_tag and preproxy_node_id then
|
||||||
local preproxy_outboundTag = gen_shunt_node(preproxy_rule_name, preproxy_node_id)
|
local preproxy_outboundTag = gen_shunt_node(preproxy_rule_name, preproxy_node_id)
|
||||||
if preproxy_outboundTag then
|
if preproxy_outboundTag then
|
||||||
preproxy_tag = preproxy_outboundTag
|
preproxy_tag = preproxy_outboundTag
|
||||||
else
|
|
||||||
preproxy_node = nil
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--default_node
|
--default_node
|
||||||
|
|
|
@ -758,16 +758,15 @@ function gen_config(var)
|
||||||
end
|
end
|
||||||
-- new balancer
|
-- new balancer
|
||||||
local blc_nodes = _node.balancing_node
|
local blc_nodes = _node.balancing_node
|
||||||
local length = #blc_nodes
|
|
||||||
local valid_nodes = {}
|
local valid_nodes = {}
|
||||||
for i = 1, length do
|
for i = 1, #blc_nodes do
|
||||||
local blc_node_id = blc_nodes[i]
|
local blc_node_id = blc_nodes[i]
|
||||||
local blc_node_tag = "blc-" .. blc_node_id
|
local blc_node_tag = "blc-" .. blc_node_id
|
||||||
local is_new_blc_node = true
|
local is_new_blc_node = true
|
||||||
for _, outbound in ipairs(outbounds) do
|
for _, outbound in ipairs(outbounds) do
|
||||||
if outbound.tag == blc_node_tag then
|
if outbound.tag:find("^" .. blc_node_tag) == 1 then
|
||||||
is_new_blc_node = false
|
is_new_blc_node = false
|
||||||
valid_nodes[#valid_nodes + 1] = blc_node_tag
|
valid_nodes[#valid_nodes + 1] = outbound.tag
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -777,7 +776,7 @@ function gen_config(var)
|
||||||
if outbound then
|
if outbound then
|
||||||
outbound.tag = outbound.tag .. ":" .. blc_node.remarks
|
outbound.tag = outbound.tag .. ":" .. blc_node.remarks
|
||||||
table.insert(outbounds, outbound)
|
table.insert(outbounds, outbound)
|
||||||
valid_nodes[#valid_nodes + 1] = blc_node_tag
|
valid_nodes[#valid_nodes + 1] = outbound.tag
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1241,7 +1240,9 @@ function gen_config(var)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
else
|
else
|
||||||
if COMMON.default_outbound_tag then
|
if COMMON.default_balancer_tag then
|
||||||
|
dns_outbound_tag = nil
|
||||||
|
elseif COMMON.default_outbound_tag then
|
||||||
dns_outbound_tag = COMMON.default_outbound_tag
|
dns_outbound_tag = COMMON.default_outbound_tag
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1262,9 +1263,9 @@ function gen_config(var)
|
||||||
table.insert(outbounds, {
|
table.insert(outbounds, {
|
||||||
tag = "dns-out",
|
tag = "dns-out",
|
||||||
protocol = "dns",
|
protocol = "dns",
|
||||||
proxySettings = {
|
proxySettings = dns_outbound_tag and {
|
||||||
tag = dns_outbound_tag
|
tag = dns_outbound_tag
|
||||||
},
|
} or nil,
|
||||||
settings = {
|
settings = {
|
||||||
address = remote_dns_tcp_server,
|
address = remote_dns_tcp_server,
|
||||||
port = tonumber(remote_dns_tcp_port),
|
port = tonumber(remote_dns_tcp_port),
|
||||||
|
@ -1288,6 +1289,7 @@ function gen_config(var)
|
||||||
remote_dns_tcp_server
|
remote_dns_tcp_server
|
||||||
},
|
},
|
||||||
port = tonumber(remote_dns_tcp_port),
|
port = tonumber(remote_dns_tcp_port),
|
||||||
|
balancerTag = COMMON.default_balancer_tag,
|
||||||
outboundTag = dns_outbound_tag
|
outboundTag = dns_outbound_tag
|
||||||
})
|
})
|
||||||
if _remote_dns_host then
|
if _remote_dns_host then
|
||||||
|
@ -1299,6 +1301,7 @@ function gen_config(var)
|
||||||
_remote_dns_host
|
_remote_dns_host
|
||||||
},
|
},
|
||||||
port = tonumber(remote_dns_doh_port),
|
port = tonumber(remote_dns_doh_port),
|
||||||
|
balancerTag = COMMON.default_balancer_tag,
|
||||||
outboundTag = dns_outbound_tag
|
outboundTag = dns_outbound_tag
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
@ -1311,6 +1314,7 @@ function gen_config(var)
|
||||||
remote_dns_doh_ip
|
remote_dns_doh_ip
|
||||||
},
|
},
|
||||||
port = tonumber(remote_dns_doh_port),
|
port = tonumber(remote_dns_doh_port),
|
||||||
|
balancerTag = COMMON.default_balancer_tag,
|
||||||
outboundTag = dns_outbound_tag
|
outboundTag = dns_outbound_tag
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue