1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Add support for simple-obfs

This commit is contained in:
Ycarus 2018-02-16 15:42:54 +01:00
parent 3578bd0a83
commit bd4ac15126
6 changed files with 745 additions and 3 deletions

View file

@ -22,9 +22,14 @@ m.title = "shadowsocks-libev - %s - %s" % {stype, sname}
s = m:section(NamedSection, sname, stype)
s:tab("general", translate("General Settings"))
s:tab("advanced", translate("Advanced Settings"))
s:tab("obfuscate", translate("Obfuscating"))
s:taboption("general", Flag, "disabled", translate("Disable"))
ss.option_install_package(s, "general")
ss.options_common(s, "advanced")
local obfs_installed = nixio.fs.access("/usr/bin/obfs-local")
if obfs_installed then
ss.options_obfs(s, "obfuscate")
end
if stype == "ss_server" then
ss.options_server(s, "general")
@ -48,6 +53,11 @@ else
translate("Disable SNI"),
translate("Disable parsing HTTP/HTTPS payload to find then resolve hostname at remote server"))
end
if obfs_installed then
o = s:taboption("obfuscate", Value, "obfs_host", translate("Host"))
o.default = "www.bing.com"
s:taboption("obfuscate", Value, "obfs_uri", translate("HTTP path uri"))
end
end
return m

View file

@ -126,6 +126,15 @@ function options_common(s, tab)
s:taboption(tab, Flag, "mptcp", translate("Enable MPTCP"))
end
function options_obfs(s, tab)
local o
s:taboption(tab, Flag, "obfs", translate("Enable"))
o = s:taboption(tab, ListValue, "obfs_type", translate("Type"))
o:value("http")
o:value("tls")
o.default = "http"
end
function ucival_to_bool(val)
return val == "true" or val == "1" or val == "yes" or val == "on"
end
@ -141,6 +150,10 @@ function cfgvalue_overview(sdata)
"bind_address",
"manager_address",
})
local installed = nixio.fs.access("/usr/bin/obfs-server")
if installed then
cfgvalue_overview_(sdata, lines, names_options_obfs)
end
elseif stype == "ss_local" or stype == "ss_redir" or stype == "ss_tunnel" then
cfgvalue_overview_(sdata, lines, names_options_client)
if stype == "ss_tunnel" then
@ -149,6 +162,10 @@ function cfgvalue_overview(sdata)
cfgvalue_overview_(sdata, lines, {"disable_sni"})
end
cfgvalue_overview_(sdata, lines, names_options_common)
local installed = nixio.fs.access("/usr/bin/obfs-local")
if installed then
cfgvalue_overview_(sdata, lines, names_options_obfs)
end
else
return nil, nil
end
@ -234,6 +251,10 @@ names_options_common = {
"mptcp",
}
names_options_obfs = {
"obfs",
}
modes = {
"tcp_only",
"tcp_and_udp",