1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
-- Copyright 2015 Jian Chang <aa65535@live.com>
-- Licensed to the public under the Apache License 2.0.
local m, s, o, e, a
if luci.sys.call("pidof ss-redir >/dev/null") == 0 then
m = Map("shadowsocks-libev", translate("ShadowSocks-libev"), translate("ShadowSocks-libev is running"))
else
m = Map("shadowsocks-libev", translate("ShadowSocks-libev"), translate("ShadowSocks-libev is not running"))
end
e = {
"table",
"rc4",
"rc4-md5",
"aes-128-cfb",
"aes-192-cfb",
"aes-256-cfb",
"bf-cfb",
"camellia-128-cfb",
"camellia-192-cfb",
"camellia-256-cfb",
"cast5-cfb",
"des-cfb",
"idea-cfb",
"rc2-cfb",
"seed-cfb",
"salsa20",
"chacha20",
}
-- Global Setting
s = m:section(TypedSection, "shadowsocks-libev", translate("Global Setting"))
s.anonymous = true
o = s:option(Flag, "enable", translate("Enable"))
o.default = 1
o.rmempty = false
o = s:option(Value, "server", translate("Server Address"))
o.datatype = "ipaddr"
o.rmempty = false
o = s:option(Value, "server_port", translate("Server Port"))
o.datatype = "port"
o.rmempty = false
o = s:option(Value, "local_port", translate("Local Port"))
o.datatype = "port"
o.default = 1080
o.rmempty = false
o = s:option(Value, "timeout", translate("Connection Timeout"))
o.datatype = "uinteger"
o.default = 60
o.rmempty = false
o = s:option(Value, "password", translate("Password"))
o.password = true
o.rmempty = false
o = s:option(ListValue, "encrypt_method", translate("Encrypt Method"))
for i,v in ipairs(e) do
o:value(v)
end
o.rmempty = false
o = s:option(Value, "ignore_list", translate("Ignore List"))
o:value("/dev/null", translate("Disabled"))
o.default = "/dev/null"
o.rmempty = false
-- UDP Relay
s = m:section(TypedSection, "shadowsocks-libev", translate("UDP Relay"))
s.anonymous = true
o = s:option(ListValue, "udp_mode", translate("Relay Mode"))
o:value("0", translate("Disabled"))
o:value("1", translate("Enabled"))
o:value("2", translate("Custom"))
o.default = 0
o.rmempty = false
o = s:option(Value, "udp_server", translate("Server Address"))
o.datatype = "ipaddr"
o:depends("udp_mode", 2)
o = s:option(Value, "udp_server_port", translate("Server Port"))
o.datatype = "port"
o:depends("udp_mode", 2)
o = s:option(Value, "udp_local_port", translate("Local Port"))
o.datatype = "port"
o.default = 1081
o:depends("udp_mode", 2)
o = s:option(Value, "udp_timeout", translate("Connection Timeout"))
o.datatype = "uinteger"
o.default = 60
o:depends("udp_mode", 2)
o = s:option(Value, "udp_password", translate("Password"))
o.password = true
o:depends("udp_mode", 2)
o = s:option(ListValue, "udp_encrypt_method", translate("Encrypt Method"))
for i,v in ipairs(e) do
o:value(v)
end
o:depends("udp_mode", 2)
-- UDP Forward
s = m:section(TypedSection, "shadowsocks-libev", translate("UDP Forward"))
s.anonymous = true
o = s:option(Flag, "tunnel_enable", translate("Enable"))
o.default = 1
o.rmempty = false
o = s:option(Value, "tunnel_port", translate("UDP Local Port"))
o.datatype = "port"
o.default = 5300
o = s:option(Value, "tunnel_forward", translate("Forwarding Tunnel"))
o.default = "8.8.4.4:53"
-- Access Control
s = m:section(TypedSection, "shadowsocks-libev", translate("Access Control"))
s.anonymous = true
s:tab("lan_ac", translate("LAN"))
o = s:taboption("lan_ac", ListValue, "lan_ac_mode", translate("Access Control"))
o:value("0", translate("Disabled"))
o:value("1", translate("Allow listed only"))
o:value("2", translate("Allow all except listed"))
o.default = 0
o.rmempty = false
a = luci.sys.net.arptable() or {}
o = s:taboption("lan_ac", DynamicList, "lan_ac_ip", translate("LAN IP List"))
o.datatype = "ipaddr"
for i,v in ipairs(a) do
o:value(v["IP address"])
end
s:tab("wan_ac", translate("WAN"))
o = s:taboption("wan_ac", DynamicList, "wan_bp_ip", translate("Bypassed IP"))
o.datatype = "ip4addr"
o = s:taboption("wan_ac", DynamicList, "wan_fw_ip", translate("Forwarded IP"))
o.datatype = "ip4addr"
return m
|