diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/shunt_rules.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/shunt_rules.lua index 7e7ded1e6..d3f4b450b 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/shunt_rules.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/shunt_rules.lua @@ -18,6 +18,10 @@ protocol:value("http") protocol:value("tls") protocol:value("bittorrent") +o = s:option(MultiValue, "inbound", translate("Inbound Tag")) +o:value("tproxy", translate("Transparent proxy")) +o:value("socks", "Socks") + network = s:option(ListValue, "network", translate("Network")) network:value("tcp,udp", "TCP UDP") network:value("tcp", "TCP") diff --git a/luci-app-passwall/luasrc/passwall/util_sing-box.lua b/luci-app-passwall/luasrc/passwall/util_sing-box.lua index e49ec9946..5f2eb04b3 100644 --- a/luci-app-passwall/luasrc/passwall/util_sing-box.lua +++ b/luci-app-passwall/luasrc/passwall/util_sing-box.lua @@ -1052,8 +1052,31 @@ function gen_config(var) table.insert(protocols, w) end) end + + local inboundTag = nil + if e["inbound"] and e["inbound"] ~= "" then + inboundTag = {} + if e["inbound"]:find("tproxy") then + if tcp_redir_port then + if tcp_proxy_way == "tproxy" then + table.insert(inboundTag, "tproxy_tcp") + else + table.insert(inboundTag, "redirect_tcp") + end + end + if udp_redir_port then + table.insert(inboundTag, "tproxy_udp") + end + end + if e["inbound"]:find("socks") then + if local_socks_port then + table.insert(inboundTag, "socks-in") + end + end + end local rule = { + inbound = inboundTag, outbound = outboundTag, invert = false, --匹配反选 protocol = protocols diff --git a/luci-app-passwall/luasrc/passwall/util_xray.lua b/luci-app-passwall/luasrc/passwall/util_xray.lua index f0b7d8885..9f1abdd3f 100644 --- a/luci-app-passwall/luasrc/passwall/util_xray.lua +++ b/luci-app-passwall/luasrc/passwall/util_xray.lua @@ -547,6 +547,7 @@ function gen_config(var) local node = uci:get_all(appname, node_id) if local_socks_port then local inbound = { + tag = "socks-in", listen = local_socks_address, port = tonumber(local_socks_port), protocol = "socks", @@ -870,6 +871,23 @@ function gen_config(var) table.insert(protocols, w) end) end + local inboundTag = nil + if e["inbound"] and e["inbound"] ~= "" then + inboundTag = {} + if e["inbound"]:find("tproxy") then + if tcp_redir_port then + table.insert(inboundTag, "tcp_redir") + end + if udp_redir_port then + table.insert(inboundTag, "udp_redir") + end + end + if e["inbound"]:find("socks") then + if local_socks_port then + table.insert(inboundTag, "socks-in") + end + end + end local domains = nil if e.domain_list then domains = {} @@ -894,6 +912,7 @@ function gen_config(var) local rule = { _flag = e.remarks, type = "field", + inboundTag = inboundTag, outboundTag = outboundTag, balancerTag = balancerTag, network = e["network"] or "tcp,udp", diff --git a/luci-app-passwall/po/zh-cn/passwall.po b/luci-app-passwall/po/zh-cn/passwall.po index 59ec68024..b3af519cf 100644 --- a/luci-app-passwall/po/zh-cn/passwall.po +++ b/luci-app-passwall/po/zh-cn/passwall.po @@ -1018,6 +1018,12 @@ msgstr "配置路由etc/hosts文件,如果你不知道自己在做什么,请 msgid "These had been joined ip addresses will be block. Please input the ip address or ip address segment, every line can input only one ip address." msgstr "加入的IP段将屏蔽。可输入IP地址或地址段,每个地址段一行。" +msgid "Inbound Tag" +msgstr "入站标签" + +msgid "Transparent proxy" +msgstr "透明代理" + msgid "Not valid domain name, please re-enter!" msgstr "不是有效域名,请重新输入!"