1 -- Copyright 2017 Yousong Zhou <yszhou4tech@gmail.com>
2 -- Licensed to the public under the Apache License 2.0.
4 local ds = require "luci.dispatcher"
5 local ss = require "luci.model.shadowsocks-libev"
8 local redirect_url = ds.build_url("admin/services/shadowsocks-libev/instances")
11 local m = Map("shadowsocks-libev")
12 local sdata = m:get(sname)
14 luci.http.redirect(redirect_url)
17 local stype = sdata[".type"]
18 m.redirect = redirect_url
19 m.title = "shadowsocks-libev - %s - %s" % {stype, sname}
22 s = m:section(NamedSection, sname, stype)
23 s:tab("general", translate("General Settings"))
24 s:tab("advanced", translate("Advanced Settings"))
25 s:taboption("general", Flag, "disabled", translate("Disable"))
26 ss.option_install_package(s, "general")
27 ss.options_common(s, "advanced")
29 if stype == "ss_server" then
30 ss.options_server(s, "general")
31 o = s:taboption("general", Value, "bind_address",
32 translate("Bind address"),
33 translate("The address ss-server will initiate connection from"))
35 o.placeholder = "0.0.0.0"
37 o = s:taboption("general", Value, "manager_address", translate("Manager address"))
38 o.datatype = "hostport"
40 ss.options_client(s, "general")
41 if stype == "ss_tunnel" then
42 o = s:taboption("general", Value, "tunnel_address",
43 translate("Tunnel address"),
44 translate("The address ss-tunnel will forward traffic to"))
45 o.datatype = "hostport"
46 elseif stype == "ss_redir" then
47 o = s:taboption("advanced", Flag, "disable_sni",
48 translate("Disable SNI"),
49 translate("Disable parsing HTTP/HTTPS payload to find then resolve hostname at remote server"))