luci: add Xray dialerProxy option
This commit is contained in:
parent
5aec13e562
commit
549c8735f5
@ -71,9 +71,11 @@ end
|
|||||||
function gen_outbound(node, tag, proxy_table)
|
function gen_outbound(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
|
||||||
local result = nil
|
local result = nil
|
||||||
if node and node ~= "nil" then
|
if node and node ~= "nil" then
|
||||||
@ -85,12 +87,20 @@ function gen_outbound(node, tag, proxy_table)
|
|||||||
if node.type == "V2ray" or node.type == "Xray" then
|
if node.type == "V2ray" or node.type == "Xray" then
|
||||||
proxy = 0
|
proxy = 0
|
||||||
if proxy_tag ~= "nil" then
|
if proxy_tag ~= "nil" then
|
||||||
|
if dialerProxy and dialerProxy == "1" then
|
||||||
|
node.streamSettings = {
|
||||||
|
sockopt = {
|
||||||
|
dialerProxy = proxy_tag
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
node.proxySettings = {
|
node.proxySettings = {
|
||||||
tag = proxy_tag,
|
tag = proxy_tag,
|
||||||
transportLayer = true
|
transportLayer = true
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if node.type ~= "V2ray" and node.type ~= "Xray" then
|
if node.type ~= "V2ray" and node.type ~= "Xray" then
|
||||||
if node.type == "Socks" then
|
if node.type == "Socks" then
|
||||||
@ -107,7 +117,7 @@ function gen_outbound(node, tag, proxy_table)
|
|||||||
"127.0.0.1", --bind
|
"127.0.0.1", --bind
|
||||||
new_port, --socks port
|
new_port, --socks port
|
||||||
string.format("%s_%s_%s_%s.json", flag, tag, node_id, new_port), --config file
|
string.format("%s_%s_%s_%s.json", flag, tag, node_id, new_port), --config file
|
||||||
(proxy == 1 and proxy_tag ~= "nil" and relay_port) and tostring(relay_port) or "" --relay port
|
(proxy == 1 and relay_port) and tostring(relay_port) or "" --relay port
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -139,9 +149,10 @@ function gen_outbound(node, tag, proxy_table)
|
|||||||
concurrency = (node.mux_concurrency) and tonumber(node.mux_concurrency) or 8
|
concurrency = (node.mux_concurrency) and tonumber(node.mux_concurrency) or 8
|
||||||
} or nil,
|
} or nil,
|
||||||
-- 底层传输配置
|
-- 底层传输配置
|
||||||
streamSettings = (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,
|
||||||
@ -382,7 +393,7 @@ if node_id then
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if default_node and api.is_normal_node(default_node) then
|
if default_node and api.is_normal_node(default_node) then
|
||||||
local default_outbound = gen_outbound(default_node, "default", { proxy = proxy, tag = proxy_tag })
|
local default_outbound = gen_outbound(default_node, "default", { proxy = proxy, tag = proxy_tag, dialerProxy = node.dialerProxy })
|
||||||
if default_outbound then
|
if default_outbound then
|
||||||
table.insert(outbounds, default_outbound)
|
table.insert(outbounds, default_outbound)
|
||||||
default_outboundTag = "default"
|
default_outboundTag = "default"
|
||||||
@ -440,7 +451,7 @@ if node_id then
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local _outbound = gen_outbound(_node, name, { proxy = (proxy_tag ~= "nil") and 1 or 0, tag = (proxy_tag ~= "nil") and proxy_tag or nil })
|
local _outbound = gen_outbound(_node, name, { proxy = (proxy_tag ~= "nil") and 1 or 0, tag = (proxy_tag ~= "nil") and proxy_tag or nil, dialerProxy = node.dialerProxy })
|
||||||
if _outbound then
|
if _outbound then
|
||||||
table.insert(outbounds, _outbound)
|
table.insert(outbounds, _outbound)
|
||||||
outboundTag = name
|
outboundTag = name
|
||||||
|
@ -188,6 +188,9 @@ if #nodes_table > 0 then
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
dialerProxy = s:option(Flag, "dialerProxy", translate("dialerProxy"))
|
||||||
|
dialerProxy:depends({ type = "Xray", protocol = "_shunt"})
|
||||||
|
|
||||||
domainStrategy = s:option(ListValue, "domainStrategy", translate("Domain Strategy"))
|
domainStrategy = s:option(ListValue, "domainStrategy", translate("Domain Strategy"))
|
||||||
domainStrategy:value("AsIs")
|
domainStrategy:value("AsIs")
|
||||||
domainStrategy:value("IPIfNonMatch")
|
domainStrategy:value("IPIfNonMatch")
|
||||||
|
@ -367,6 +367,9 @@ 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 "域名解析策略"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user