local _up = getfenv(3)
local ut = require("luci.util")
+local sys = require("luci.sys")
local ds = require("luci.dispatcher")
local nw = require("luci.model.network")
nw.init()
end)
function values_actions(o)
- for _, a in ipairs(actions) do
- o:value(a)
+ o:value("bypass")
+ o:value("forward")
+ if o.option ~= "dst_default" then
+ o:value("checkdst")
end
end
function values_redir(o, xmode)
o.map.uci.foreach("shadowsocks-libev", "ss_redir", function(sdata)
+ local disabled = ucival_to_bool(sdata["disabled"])
local sname = sdata[".name"]
- local mode = sdata["mode"]
- if mode and mode:find(xmode) then
+ local mode = sdata["mode"] or "tcp_only"
+ if not disabled and mode:find(xmode) then
local desc = "%s - %s" % {sname, mode}
o:value(sname, desc)
end
end)
+ o:value("", "<unset>")
+ o.default = ""
end
function values_serverlist(o)
local server = sdata["server"]
local server_port = sdata["server_port"]
if server and server_port then
- local desc = "%s - %s:%s" % {sname, sdata["server"], sdata["server_port"]}
+ local disabled = ucival_to_bool(sdata[".disabled"]) and " - disabled" or ""
+ local desc = "%s - %s:%s%s" % {sname, server, server_port, disabled}
o:value(sname, desc)
end
end)
end
function values_ipaddr(o)
- local keys, vals = {}, {}
for _, v in ipairs(nw:get_interfaces()) do
for _, a in ipairs(v:ipaddrs()) do
o:value(a:host():string(), '%s (%s)' %{ a:host(), v:shortname() })
end
end
+function values_ifnames(o)
+ for _, v in ipairs(sys.net.devices()) do
+ o:value(v)
+ end
+end
+
function options_client(s, tab)
local o
s:taboption(tab, Value, "user", translate("Run as"))
s:taboption(tab, Flag, "verbose", translate("Verbose"))
+ s:taboption(tab, Flag, "ipv6_first", translate("IPv6 First"), translate("Prefer IPv6 addresses when resolving names"))
s:taboption(tab, Flag, "fast_open", translate("Enable TCP Fast Open"))
s:taboption(tab, Flag, "reuse_port", translate("Enable SO_REUSEPORT"))
end
cfgvalue_overview_(sdata, lines, names_options_client)
if stype == "ss_tunnel" then
cfgvalue_overview_(sdata, lines, {"tunnel_address"})
+ elseif stype == "ss_redir" then
+ cfgvalue_overview_(sdata, lines, {"disable_sni"})
end
cfgvalue_overview_(sdata, lines, names_options_common)
else
for _, n in ipairs(names) do
local v = sdata[n]
if v ~= nil then
+ if n == "key" or n == "password" then
+ v = translate("<hidden>")
+ end
local fv = "<var>%s</var>" % ut.pcdata(v)
if sdata[".type"] ~= "ss_server" and n == "server" then
fv = '<a class="label" href="%s">%s</a>' % {
names_options_common = {
"verbose",
+ "ipv6_first",
"fast_open",
"reuse_port",
"mode",
"udp_only",
}
-actions = {
- "bypass",
- "forward",
- "checkdst",
-}
-
methods = {
-- aead
"aes-128-gcm",
"aes-192-gcm",
"aes-256-gcm",
+ "chacha20-ietf-poly1305",
+ "xchacha20-ietf-poly1305",
-- stream
"table",
"rc4",
"salsa20",
"chacha20",
"chacha20-ietf",
- "aes-128-gcm",
- "aes-192-gcm",
- "aes-256-gcm",
}