luci: preproxy remove dialerProxy option

This commit is contained in:
Tianhe Y 2023-04-05 20:31:25 +08:00 committed by sbwml
parent d9023cffba
commit fddd6eed92
4 changed files with 7 additions and 38 deletions

View File

@ -144,12 +144,7 @@ if (has_v2ray or has_xray) and #nodes_table > 0 then
type:value("Xray", translate("Xray")) type:value("Xray", translate("Xray"))
end end
type.cfgvalue = get_cfgvalue(v.id, "type") type.cfgvalue = get_cfgvalue(v.id, "type")
type.write = function(self, section, value) type.write = get_write(v.id, "type")
m:set(v.id, "type", value)
if value == "V2ray" then
m:del(v.id, "dialerProxy")
end
end
-- pre-proxy -- pre-proxy
o = s:taboption("Main", Flag, vid .. "-preproxy_enabled", translate("Preproxy")) o = s:taboption("Main", Flag, vid .. "-preproxy_enabled", translate("Preproxy"))
o:depends("tcp_node", v.id) o:depends("tcp_node", v.id)
@ -166,20 +161,10 @@ if (has_v2ray or has_xray) and #nodes_table > 0 then
end end
o.cfgvalue = get_cfgvalue(v.id, "main_node") o.cfgvalue = get_cfgvalue(v.id, "main_node")
o.write = get_write(v.id, "main_node") o.write = get_write(v.id, "main_node")
-- Xray dialerProxy
local dialerProxy = s:taboption("Main", Flag, vid .. "-dialerProxy", translate("dialerProxy"))
dialerProxy.cfgvalue = get_cfgvalue(v.id, "dialerProxy")
dialerProxy.write = get_write(v.id, "dialerProxy")
dialerProxy.rmempty = false
dialerProxy.default = "0"
dialerProxy:depends({ [vid .. "-type"] = "Xray", [vid .. "-preproxy_enabled"] = "1" })
if (has_v2ray and has_xray) or (v.type == "V2ray" and not has_v2ray) or (v.type == "Xray" and not has_xray) then if (has_v2ray and has_xray) or (v.type == "V2ray" and not has_v2ray) or (v.type == "Xray" and not has_xray) then
type:depends("tcp_node", v.id) type:depends("tcp_node", v.id)
else else
type:depends("tcp_node", "hide") --不存在的依赖,即始终隐藏 type:depends("tcp_node", "hide") --不存在的依赖,即始终隐藏
if v.type == "Xray" then
dialerProxy:depends({ tcp_node = v.id, [vid .. "-preproxy_enabled"] = "1" })
end
end end
uci:foreach(appname, "shunt_rules", function(e) uci:foreach(appname, "shunt_rules", function(e)

View File

@ -177,8 +177,6 @@ if #nodes_table > 0 then
o:depends("protocol", "_shunt") o:depends("protocol", "_shunt")
o = s:option(ListValue, "main_node", string.format('<a style="color:red">%s</a>', translate("Preproxy Node")), translate("Set the node to be used as a pre-proxy. Each rule (including <code>Default</code>) has a separate switch that controls whether this rule uses the pre-proxy or not.")) o = s:option(ListValue, "main_node", string.format('<a style="color:red">%s</a>', translate("Preproxy Node")), translate("Set the node to be used as a pre-proxy. Each rule (including <code>Default</code>) has a separate switch that controls whether this rule uses the pre-proxy or not."))
o:depends("preproxy_enabled", "1") o:depends("preproxy_enabled", "1")
local dialerProxy = s:option(Flag, "dialerProxy", translate("dialerProxy"))
dialerProxy:depends({ type = "Xray", protocol = "_shunt", preproxy_enabled = "1" })
for k, v in pairs(balancers_table) do for k, v in pairs(balancers_table) do
o:value(v.id, v.remarks) o:value(v.id, v.remarks)
end end

View File

@ -42,11 +42,9 @@ function gen_outbound(flag, node, tag, proxy_table)
local proxy = 0 local proxy = 0
local proxy_tag = "nil" local proxy_tag = "nil"
local dialerProxy = nil
if proxy_table ~= nil and type(proxy_table) == "table" then if proxy_table ~= nil and type(proxy_table) == "table" then
proxy = proxy_table.proxy or 0 proxy = proxy_table.proxy or 0
proxy_tag = proxy_table.tag or "nil" proxy_tag = proxy_table.tag or "nil"
dialerProxy = proxy_table.dialerProxy
end end
if node.type == "V2ray" or node.type == "Xray" then if node.type == "V2ray" or node.type == "Xray" then
@ -54,18 +52,10 @@ function gen_outbound(flag, node, tag, proxy_table)
else else
proxy = 0 proxy = 0
if proxy_tag ~= "nil" then if proxy_tag ~= "nil" then
if dialerProxy and dialerProxy == "1" then node.proxySettings = {
node.streamSettings = { tag = proxy_tag,
sockopt = { transportLayer = true
dialerProxy = proxy_tag }
}
}
else
node.proxySettings = {
tag = proxy_tag,
transportLayer = true
}
end
end end
end end
end end
@ -124,8 +114,7 @@ function gen_outbound(flag, node, tag, proxy_table)
-- 底层传输配置 -- 底层传输配置
streamSettings = (node.streamSettings or node.protocol == "vmess" or node.protocol == "vless" or node.protocol == "socks" or node.protocol == "shadowsocks" or node.protocol == "trojan") and { streamSettings = (node.streamSettings or node.protocol == "vmess" or node.protocol == "vless" or node.protocol == "socks" or node.protocol == "shadowsocks" or node.protocol == "trojan") and {
sockopt = { sockopt = {
mark = 255, mark = 255
dialerProxy = (node.streamSettings and dialerProxy and dialerProxy == "1") and node.streamSettings.sockopt.dialerProxy or nil
}, },
network = node.transport, network = node.transport,
security = node.stream_security, security = node.stream_security,
@ -754,7 +743,7 @@ function gen_config(var)
}) })
end end
end end
local _outbound = gen_outbound(flag, _node, rule_name, { proxy = proxy and 1 or 0, tag = proxy and preproxy_tag or nil, dialerProxy = node.dialerProxy }) local _outbound = gen_outbound(flag, _node, rule_name, { proxy = proxy and 1 or 0, tag = proxy and preproxy_tag or nil })
if _outbound then if _outbound then
table.insert(outbounds, _outbound) table.insert(outbounds, _outbound)
if proxy then preproxy_used = true end if proxy then preproxy_used = true end

View File

@ -406,9 +406,6 @@ msgstr "没有分流规则?点我前往去添加。"
msgid "When using, localhost will connect this node first and then use this node to connect the default node." msgid "When using, localhost will connect this node first and then use this node to connect the default node."
msgstr "当使用时,本机将首先连接到此节点,然后再使用此节点连接到默认节点落地。" msgstr "当使用时,本机将首先连接到此节点,然后再使用此节点连接到默认节点落地。"
msgid "dialerProxy"
msgstr "底层传输方式的链式转发"
msgid "Domain Strategy" msgid "Domain Strategy"
msgstr "域名解析策略" msgstr "域名解析策略"