luci-app-passwall: sync with upstream source
Signed-off-by: CN_SZTL <cnsztl@project-openwrt.eu.org>
This commit is contained in:
parent
a3eb950cdd
commit
d4ff724ded
@ -96,10 +96,6 @@ function gen_outbound(node, tag, is_proxy)
|
||||
node.stream_security = "xtls"
|
||||
end
|
||||
end
|
||||
|
||||
if node.transport == "mkcp" or node.transport == "quic" then
|
||||
node.stream_security = "none"
|
||||
end
|
||||
end
|
||||
|
||||
result = {
|
||||
@ -349,16 +345,23 @@ if node_section then
|
||||
if outboundTag == "default" then
|
||||
outboundTag = default_outboundTag
|
||||
end
|
||||
local protocols = nil
|
||||
if e["protocol"] and e["protocol"] ~= "" then
|
||||
protocols = {}
|
||||
string.gsub(e["protocol"], '[^' .. " " .. ']+', function(w)
|
||||
table.insert(protocols, w)
|
||||
end)
|
||||
end
|
||||
if e.domain_list then
|
||||
local _domain = {}
|
||||
string.gsub(e.domain_list, '[^' .. "\r\n" .. ']+', function(w)
|
||||
table.insert(_domain, w)
|
||||
end)
|
||||
|
||||
table.insert(rules, {
|
||||
type = "field",
|
||||
outboundTag = outboundTag,
|
||||
domain = _domain
|
||||
domain = _domain,
|
||||
protocol = protocols
|
||||
})
|
||||
end
|
||||
if e.ip_list then
|
||||
@ -369,7 +372,15 @@ if node_section then
|
||||
table.insert(rules, {
|
||||
type = "field",
|
||||
outboundTag = outboundTag,
|
||||
ip = _ip
|
||||
ip = _ip,
|
||||
protocol = protocols
|
||||
})
|
||||
end
|
||||
if not e.domain_list and not e.ip_list and protocols then
|
||||
table.insert(rules, {
|
||||
type = "field",
|
||||
outboundTag = outboundTag,
|
||||
protocol = protocols
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
@ -56,7 +56,7 @@ o = s:option(Value, "xray_location_asset", translate("Location of Xray asset"),
|
||||
o.default = "/usr/share/xray/"
|
||||
o.rmempty = false
|
||||
|
||||
s = m:section(TypedSection, "shunt_rules", "Xray" .. translate("Shunt") .. translate("Rule"))
|
||||
s = m:section(TypedSection, "shunt_rules", "Xray" .. translate("Shunt") .. translate("Rule"), "<a style='color: red'>" .. translate("Please note attention to the priority, the higher the order, the higher the priority.") .. "</a>")
|
||||
s.template = "cbi/tblsection"
|
||||
s.anonymous = false
|
||||
s.addremove = true
|
||||
|
||||
@ -12,6 +12,11 @@ remarks = s:option(Value, "remarks", translate("Remarks"))
|
||||
remarks.default = arg[1]
|
||||
remarks.rmempty = false
|
||||
|
||||
protocol = s:option(MultiValue, "protocol", translate("Protocol"))
|
||||
protocol:value("http")
|
||||
protocol:value("tls")
|
||||
protocol:value("bittorrent")
|
||||
|
||||
domain_list = s:option(TextValue, "domain_list", translate("Domain"))
|
||||
domain_list.rows = 10
|
||||
domain_list.wrap = "off"
|
||||
|
||||
@ -15,7 +15,6 @@ function gen_config(user)
|
||||
clients[i] = {
|
||||
id = user.uuid[i],
|
||||
flow = ("1" == user.xtls) and user.flow or nil,
|
||||
level = user.level and tonumber(user.level) or nil,
|
||||
alterId = user.alter_id and tonumber(user.alter_id) or nil
|
||||
}
|
||||
end
|
||||
@ -50,7 +49,6 @@ function gen_config(user)
|
||||
settings = {
|
||||
method = user.method,
|
||||
password = user.password,
|
||||
level = user.level and tonumber(user.level) or nil,
|
||||
network = user.ss_network or "TCP,UDP"
|
||||
}
|
||||
elseif user.protocol == "trojan" then
|
||||
@ -60,7 +58,6 @@ function gen_config(user)
|
||||
clients[i] = {
|
||||
flow = ("1" == user.xtls) and user.flow or nil,
|
||||
password = user.uuid[i],
|
||||
level = user.level and tonumber(user.level) or nil,
|
||||
}
|
||||
end
|
||||
settings = {
|
||||
@ -71,7 +68,6 @@ function gen_config(user)
|
||||
settings = {
|
||||
users = {
|
||||
{
|
||||
level = user.level and tonumber(user.level) or nil,
|
||||
secret = (user.password == nil) and "" or user.password
|
||||
}
|
||||
}
|
||||
@ -115,9 +111,23 @@ function gen_config(user)
|
||||
}
|
||||
|
||||
if user.transit_node and user.transit_node ~= "nil" then
|
||||
local transit_node_t = ucic:get_all("passwall", user.transit_node)
|
||||
if user.transit_node == "_socks" or user.transit_node == "_http" then
|
||||
transit_node_t = {
|
||||
type = "Xray",
|
||||
protocol = user.transit_node:gsub("_", ""),
|
||||
transport = "tcp",
|
||||
address = user.transit_node_address,
|
||||
port = user.transit_node_port,
|
||||
username = (user.transit_node_username and user.transit_node_username ~= "") and user.transit_node_username or nil,
|
||||
password = (user.transit_node_password and user.transit_node_password ~= "") and user.transit_node_password or nil,
|
||||
}
|
||||
end
|
||||
local gen_xray = require("luci.model.cbi.passwall.api.gen_xray")
|
||||
local client = gen_xray.gen_outbound(ucic:get_all("passwall", user.transit_node), "transit")
|
||||
table.insert(outbounds, 1, client)
|
||||
local outbound = gen_xray.gen_outbound(transit_node_t, "transit")
|
||||
if outbound then
|
||||
table.insert(outbounds, 1, outbound)
|
||||
end
|
||||
end
|
||||
|
||||
local config = {
|
||||
@ -216,10 +226,5 @@ function gen_config(user)
|
||||
end
|
||||
end
|
||||
|
||||
if user.transport == "mkcp" or user.transport == "quic" then
|
||||
config.inbounds[1].streamSettings.security = "none"
|
||||
config.inbounds[1].streamSettings.tlsSettings = nil
|
||||
end
|
||||
|
||||
return config
|
||||
end
|
||||
|
||||
@ -246,13 +246,6 @@ uuid:depends("type", "Trojan-Plus")
|
||||
alter_id = s:option(Value, "alter_id", translate("Alter ID"))
|
||||
alter_id:depends({ type = "Xray", protocol = "vmess" })
|
||||
|
||||
level = s:option(Value, "level", translate("User Level"))
|
||||
level:depends({ type = "Xray", protocol = "vmess" })
|
||||
level:depends({ type = "Xray", protocol = "vless" })
|
||||
level:depends({ type = "Xray", protocol = "shadowsocks" })
|
||||
level:depends({ type = "Xray", protocol = "trojan" })
|
||||
level:depends({ type = "Xray", protocol = "mtproto" })
|
||||
|
||||
tls = s:option(Flag, "tls", translate("TLS"))
|
||||
tls.default = 0
|
||||
tls.validate = function(self, value, t)
|
||||
@ -565,10 +558,30 @@ end
|
||||
|
||||
transit_node = s:option(ListValue, "transit_node", translate("transit node"))
|
||||
transit_node:value("nil", translate("Close"))
|
||||
transit_node:value("_socks", translate("Custom Socks"))
|
||||
transit_node:value("_http", translate("Custom HTTP"))
|
||||
for k, v in pairs(nodes_table) do transit_node:value(v.id, v.remarks) end
|
||||
transit_node.default = "nil"
|
||||
transit_node:depends("type", "Xray")
|
||||
|
||||
transit_node_address = s:option(Value, "transit_node_address", translate("Address (Support Domain Name)"))
|
||||
transit_node_address:depends("transit_node", "_socks")
|
||||
transit_node_address:depends("transit_node", "_http")
|
||||
|
||||
transit_node_port = s:option(Value, "transit_node_port", translate("Port"))
|
||||
transit_node_port.datatype = "port"
|
||||
transit_node_port:depends("transit_node", "_socks")
|
||||
transit_node_port:depends("transit_node", "_http")
|
||||
|
||||
transit_node_username = s:option(Value, "transit_node_username", translate("Username"))
|
||||
transit_node_username:depends("transit_node", "_socks")
|
||||
transit_node_username:depends("transit_node", "_http")
|
||||
|
||||
transit_node_password = s:option(Value, "transit_node_password", translate("Password"))
|
||||
transit_node_password.password = true
|
||||
transit_node_password:depends("transit_node", "_socks")
|
||||
transit_node_password:depends("transit_node", "_http")
|
||||
|
||||
log = s:option(Flag, "log", translate("Enable") .. translate("Log"))
|
||||
log.default = "1"
|
||||
log.rmempty = false
|
||||
|
||||
@ -421,12 +421,12 @@ msgstr "黑洞"
|
||||
msgid "Use the default node for the transit."
|
||||
msgstr "使用默认节点代理转发。"
|
||||
|
||||
msgid "Use the under node for the transit."
|
||||
msgstr "使用下面的节点代理转发。"
|
||||
|
||||
msgid "No shunt rules? Click me to go to add."
|
||||
msgstr "没有分流规则?点我前往去添加。"
|
||||
|
||||
msgid "Use this node proxy to forward the default node."
|
||||
msgstr "使用此节点代理转发默认节点。"
|
||||
|
||||
msgid "Domain Strategy"
|
||||
msgstr "域名解析策略"
|
||||
|
||||
@ -757,6 +757,9 @@ msgstr "Xray 资源文件目录"
|
||||
msgid "This variable specifies a directory where geoip.dat and geosite.dat files are."
|
||||
msgstr "此变量指定geoip.dat和geosite.dat文件所在的目录。"
|
||||
|
||||
msgid "Please note attention to the priority, the higher the order, the higher the priority."
|
||||
msgstr "请注意优先级问题,排序越上面优先级越高。"
|
||||
|
||||
msgid "Update..."
|
||||
msgstr "更新中"
|
||||
|
||||
@ -1102,6 +1105,12 @@ msgstr "是否接收 PROXY protocol,当该节点要被回落或被代理转发
|
||||
msgid "transit node"
|
||||
msgstr "中转到此节点"
|
||||
|
||||
msgid "Custom Socks"
|
||||
msgstr "自定义 Socks"
|
||||
|
||||
msgid "Custom HTTP"
|
||||
msgstr "自定义 HTTP"
|
||||
|
||||
msgid "Bind Local"
|
||||
msgstr "本机监听"
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user