Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

luci-app-ssr-plus: add Xray sniffing(enable/disable) domainsExcluded routeOnly #1369

Closed
wants to merge 8 commits into from
5 changes: 5 additions & 0 deletions luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/advanced.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
local uci = luci.model.uci.cursor()
local server_table = {}
local function is_finded(e)
return luci.sys.exec('type -t -p "%s"' % e) ~= "" and true or false
end

uci:foreach("shadowsocksr", "servers", function(s)
if s.alias then
Expand Down Expand Up @@ -69,7 +72,9 @@ o:depends("netflix_enable", "1")

o = s:option(ListValue, "shunt_dns_mode", translate("DNS Query Mode For Shunt Mode"))
o:value("1", translate("Use DNS2SOCKS query and cache"))
if is_finded("mosdns") then
o:value("2", translate("Use MOSDNS query"))
end
o:depends("netflix_enable", "1")
o.default = 1

Expand Down
31 changes: 28 additions & 3 deletions luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,7 @@ o.rmempty = true
-- [[ Mux ]]--
o = s:option(Flag, "mux", translate("Mux"))
o.rmempty = false
o.default = false
o:depends({type = "v2ray", v2ray_protocol = "vless"})
o:depends({type = "v2ray", v2ray_protocol = "vmess"})
o:depends({type = "v2ray", v2ray_protocol = "trojan"})
Expand All @@ -931,32 +932,56 @@ o = s:option(Value, "concurrency", translate("concurrency"))
o.datatype = "integer"
o.rmempty = true
o.default = "-1"
o:depends("mux", "1")
o:depends("mux", true)

o = s:option(Value, "xudpConcurrency", translate("xudpConcurrency"))
o.datatype = "integer"
o.rmempty = true
o.default = "16"
o:depends("mux", "1")
o:depends("mux", true)

o = s:option(Value, "xudpProxyUDP443", translate("xudpProxyUDP443"))
o.rmempty = true
o.default = "reject"
o:value("reject", translate("reject"))
o:value("allow", translate("allow"))
o:value("skip", translate("skip"))
o:depends("mux", "1")
o:depends("mux", true)

-- [[ MPTCP ]]--
o = s:option(Flag, "mptcp", translate("MPTCP"))
o.rmempty = false
o.default = false
o:depends({type = "v2ray", v2ray_protocol = "vless"})
o:depends({type = "v2ray", v2ray_protocol = "vmess"})
o:depends({type = "v2ray", v2ray_protocol = "trojan"})
o:depends({type = "v2ray", v2ray_protocol = "shadowsocks"})
o:depends({type = "v2ray", v2ray_protocol = "socks"})
o:depends({type = "v2ray", v2ray_protocol = "http"})

-- [[ custom_sniffing ]]--
o = s:option(Flag, "custom_sniffing", translate("custom_sniffing"))
o.rmempty = false
o.default = true
o:depends({type = "v2ray", v2ray_protocol = "vless"})
o:depends({type = "v2ray", v2ray_protocol = "vmess"})
o:depends({type = "v2ray", v2ray_protocol = "trojan"})
o:depends({type = "v2ray", v2ray_protocol = "shadowsocks"})
o:depends({type = "v2ray", v2ray_protocol = "socks"})
o:depends({type = "v2ray", v2ray_protocol = "http"})

-- [[ custom_domainsExcluded ]]--
o = s:option(Flag, "custom_domainsExcluded", translate("custom_domainsExcluded"))
o.rmempty = false
o.default = true
o:depends("custom_sniffing", true)

-- [[ custom_routeOnly ]]--
o = s:option(Flag, "custom_routeOnly", translate("custom_routeOnly"))
o.rmempty = false
o.default = false
o:depends("custom_sniffing", true)

-- [[ Cert ]]--
o = s:option(Flag, "certificate", translate("Self-signed Certificate"))
o.rmempty = true
Expand Down
9 changes: 9 additions & 0 deletions luci-app-ssr-plus/po/zh-cn/ssr-plus.po
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,15 @@ msgstr "UDP 最大并发连接数"
msgid "xudpProxyUDP443"
msgstr "对被代理的 UDP/443 流量处理方式"

msgid "custom_sniffing"
msgstr "流量嗅探"

msgid "custom_domainsExcluded"
msgstr "流量嗅探域名排除列表"

msgid "custom_routeOnly"
msgstr "嗅探得到的域名仅用于 Xray 内部路由"

msgid "If true, allowss insecure connection at TLS client, e.g., TLS server uses unverifiable certificates."
msgstr "是否允许不安全连接。当选择时,将不会检查远端主机所提供的 TLS 证书的有效性。"

Expand Down
33 changes: 32 additions & 1 deletion luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,38 @@ local Xray = {
port = tonumber(local_port),
protocol = "dokodemo-door",
settings = {network = proto, followRedirect = true},
sniffing = {enabled = true, destOverride = {"http", "tls", "quic"}}
sniffing = {
enabled = (server.custom_sniffing == "1") and true or false,
routeOnly = (server.custom_routeOnly == "1") and true or false,
destOverride = {"http", "tls", "quic"},
domainsExcluded = (server.custom_domainsExcluded == "1") and {
"courier.push.apple.com",
"rbsxbxp-mim.vivox.com",
"rbsxbxp.www.vivox.com",
"rbsxbxp-ws.vivox.com",
"rbspsxp.www.vivox.com",
"rbspsxp-mim.vivox.com",
"rbspsxp-ws.vivox.com",
"rbswxp.www.vivox.com",
"rbswxp-mim.vivox.com",
"disp-rbspsp-5-1.vivox.com",
"disp-rbsxbp-5-1.vivox.com",
"proxy.rbsxbp.vivox.com",
"proxy.rbspsp.vivox.com",
"proxy.rbswp.vivox.com",
"rbswp.vivox.com",
"rbsxbp.vivox.com",
"rbspsp.vivox.com",
"rbspsp.www.vivox.com",
"rbswp.www.vivox.com",
"rbsxbp.www.vivox.com",
"rbsxbxp.vivox.com",
"rbspsxp.vivox.com",
"rbswxp.vivox.com",
"Mijia Cloud",
"dlg.io.mi.com"
} or nil,
}
} or nil,
-- 开启 socks 代理
inboundDetour = (proto:find("tcp") and socks_port ~= "0") and {
Expand Down