luci: achieve Xray vision pre-proxy

This commit is contained in:
xiaorouji 2023-03-13 02:49:22 +08:00 committed by sbwml
parent 2fc4eb5470
commit 12976f60a3
2 changed files with 42 additions and 22 deletions

View File

@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-passwall
PKG_VERSION:=4.60
PKG_RELEASE:=2
PKG_RELEASE:=4
PKG_CONFIG_DEPENDS:= \
CONFIG_PACKAGE_$(PKG_NAME)_Iptables_Transparent_Proxy \

View File

@ -33,6 +33,13 @@ local function get_domain_excluded()
end
function gen_outbound(flag, node, tag, proxy_table)
local result = nil
if node and node ~= "nil" then
local node_id = node[".name"]
if tag == nil then
tag = node_id
end
local proxy = 0
local proxy_tag = "nil"
local dialerProxy = nil
@ -41,14 +48,10 @@ function gen_outbound(flag, node, tag, proxy_table)
proxy_tag = proxy_table.tag or "nil"
dialerProxy = proxy_table.dialerProxy
end
local result = nil
if node and node ~= "nil" then
local node_id = node[".name"]
if tag == nil then
tag = node_id
end
if node.type == "V2ray" or node.type == "Xray" then
if node.type == "Xray" and node.tlsflow == "xtls-rprx-vision" then
else
proxy = 0
if proxy_tag ~= "nil" then
if dialerProxy and dialerProxy == "1" then
@ -65,6 +68,7 @@ function gen_outbound(flag, node, tag, proxy_table)
end
end
end
end
if node.type ~= "V2ray" and node.type ~= "Xray" then
if node.type == "Socks" then
@ -96,7 +100,9 @@ function gen_outbound(flag, node, tag, proxy_table)
node.port = new_port
end
node.stream_security = "none"
else
end
if node.type == "V2ray" or node.type == "Xray" then
if node.tls and node.tls == "1" then
node.stream_security = "tls"
if node.type == "Xray" and node.reality and node.reality == "1" then
@ -611,7 +617,14 @@ function gen_config(var)
table.insert(outbounds, main_node_outbound)
proxy = 1
proxy_tag = "main"
local pre_proxy = nil
if default_node.type ~= "V2ray" and default_node.type ~= "Xray" then
pre_proxy = true
end
if default_node.type == "Xray" and default_node.tlsflow == "xtls-rprx-vision" then
pre_proxy = true
end
if pre_proxy then
proxy_tag = nil
new_port = get_new_port()
table.insert(inbounds, {
@ -672,7 +685,14 @@ function gen_config(var)
table.insert(outbounds, new_outbound)
outboundTag = name
else
local pre_proxy = nil
if _node.type ~= "V2ray" and _node.type ~= "Xray" then
pre_proxy = true
end
if _node.type == "Xray" and _node.tlsflow == "xtls-rprx-vision" then
pre_proxy = true
end
if pre_proxy then
if proxy_tag ~= "nil" then
new_port = get_new_port()
table.insert(inbounds, {