1 -- Copyright 2015 Jian Chang <aa65535@live.com>
2 -- Licensed to the public under the Apache License 2.0.
6 if luci.sys.call("pidof ss-redir >/dev/null") == 0 then
7 m = Map("shadowsocks-libev", translate("ShadowSocks-libev"), translate("ShadowSocks-libev is running"))
9 m = Map("shadowsocks-libev", translate("ShadowSocks-libev"), translate("ShadowSocks-libev is not running"))
33 s = m:section(TypedSection, "shadowsocks-libev", translate("Global Setting"))
36 o = s:option(Flag, "enable", translate("Enable"))
40 o = s:option(Value, "server", translate("Server Address"))
44 o = s:option(Value, "server_port", translate("Server Port"))
48 o = s:option(Value, "local_port", translate("Local Port"))
53 o = s:option(Value, "timeout", translate("Connection Timeout"))
54 o.datatype = "uinteger"
58 o = s:option(Value, "password", translate("Password"))
62 o = s:option(ListValue, "encrypt_method", translate("Encrypt Method"))
63 for i,v in ipairs(e) do
68 o = s:option(Value, "ignore_list", translate("Ignore List"))
69 o:value("/dev/null", translate("Disabled"))
70 o.default = "/dev/null"
74 s = m:section(TypedSection, "shadowsocks-libev", translate("UDP Relay"))
77 o = s:option(ListValue, "udp_mode", translate("Relay Mode"))
78 o:value("0", translate("Disabled"))
79 o:value("1", translate("Enabled"))
80 o:value("2", translate("Custom"))
84 o = s:option(Value, "udp_server", translate("Server Address"))
86 o:depends("udp_mode", 2)
88 o = s:option(Value, "udp_server_port", translate("Server Port"))
90 o:depends("udp_mode", 2)
92 o = s:option(Value, "udp_local_port", translate("Local Port"))
95 o:depends("udp_mode", 2)
97 o = s:option(Value, "udp_timeout", translate("Connection Timeout"))
98 o.datatype = "uinteger"
100 o:depends("udp_mode", 2)
102 o = s:option(Value, "udp_password", translate("Password"))
104 o:depends("udp_mode", 2)
106 o = s:option(ListValue, "udp_encrypt_method", translate("Encrypt Method"))
107 for i,v in ipairs(e) do
110 o:depends("udp_mode", 2)
113 s = m:section(TypedSection, "shadowsocks-libev", translate("UDP Forward"))
116 o = s:option(Flag, "tunnel_enable", translate("Enable"))
120 o = s:option(Value, "tunnel_port", translate("UDP Local Port"))
124 o = s:option(Value, "tunnel_forward", translate("Forwarding Tunnel"))
125 o.default = "8.8.4.4:53"
128 s = m:section(TypedSection, "shadowsocks-libev", translate("Access Control"))
131 s:tab("lan_ac", translate("LAN"))
133 o = s:taboption("lan_ac", ListValue, "lan_ac_mode", translate("Access Control"))
134 o:value("0", translate("Disabled"))
135 o:value("1", translate("Allow listed only"))
136 o:value("2", translate("Allow all except listed"))
140 a = luci.sys.net.arptable() or {}
142 o = s:taboption("lan_ac", DynamicList, "lan_ac_ip", translate("LAN IP List"))
143 o.datatype = "ipaddr"
144 for i,v in ipairs(a) do
145 o:value(v["IP address"])
148 s:tab("wan_ac", translate("WAN"))
150 o = s:taboption("wan_ac", DynamicList, "wan_bp_ip", translate("Bypassed IP"))
151 o.datatype = "ip4addr"
153 o = s:taboption("wan_ac", DynamicList, "wan_fw_ip", translate("Forwarded IP"))
154 o.datatype = "ip4addr"