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")
28 if stype == "ss_server" then
29 ss.options_server(s, "general")
30 o = s:taboption("general", Value, "bind_address",
31 translate("Bind address"),
32 translate("The address ss-server will initiate connection from"))
34 o.placeholder = "0.0.0.0"
36 o = s:taboption("general", Value, "manager_address", translate("Manager address"))
37 o.datatype = "hostport"
39 ss.options_client(s, "general")
40 if stype == "ss_tunnel" then
41 o = s:taboption("general", Value, "tunnel_address",
42 translate("Tunnel address"),
43 translate("The address ss-tunnel will forward traffic to"))
44 o.datatype = "hostport"
47 ss.options_common(s, "advanced")