summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-shadowsocks-libev/luasrc
diff options
context:
space:
mode:
authorYousong Zhou <yszhou4tech@gmail.com>2017-08-20 02:19:02 +0800
committerYousong Zhou <yszhou4tech@gmail.com>2017-08-20 02:27:45 +0800
commitf5ae714d9d7e33436613912c75fae6fc99c195ba (patch)
tree4c0c7371dde7772a9a2eaadf73065e777e1f66b7 /applications/luci-app-shadowsocks-libev/luasrc
parent1c680e8c7803a1b801242e659382353385f7ec7f (diff)
luci-app-shadowsocks-libev: support ss_rules options: dst_default, ifnames
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Diffstat (limited to 'applications/luci-app-shadowsocks-libev/luasrc')
-rw-r--r--applications/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev/rules.lua10
-rw-r--r--applications/luci-app-shadowsocks-libev/luasrc/model/shadowsocks-libev.lua21
2 files changed, 21 insertions, 10 deletions
diff --git a/applications/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev/rules.lua b/applications/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev/rules.lua
index 1a3dcb883..998579017 100644
--- a/applications/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev/rules.lua
+++ b/applications/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev/rules.lua
@@ -39,8 +39,12 @@ ss.values_redir(o, 'udp')
o = s:taboption('general', ListValue, "local_default",
translate("Local-out default"),
- translate("Default action for locally generated packets"))
+ translate("Default action for locally generated TCP packets"))
ss.values_actions(o)
+o = s:taboption('general', DynamicList, "ifnames",
+ translate("Ingress interfaces"),
+ translate("Only apply rules on packets from these network interfaces"))
+ss.values_ifnames(o)
s:taboption('general', Value, "ipt_args",
translate("Extra arguments"),
translate("Passes additional arguments to iptables. Use with care!"))
@@ -74,5 +78,9 @@ s:taboption('dstip', FileBrowser, "dst_ips_forward_file",
translate("Dst ip forward file"),
translate("File containing ip addresses for the purposes as with <em>Dst ip forward</em>"))
o.datatype = "file"
+o = s:taboption('dstip', ListValue, "dst_default",
+ translate("Dst default"),
+ translate("Default action for packets whose destination addresses do not match any of the destination ip list"))
+ss.values_actions(o)
return m
diff --git a/applications/luci-app-shadowsocks-libev/luasrc/model/shadowsocks-libev.lua b/applications/luci-app-shadowsocks-libev/luasrc/model/shadowsocks-libev.lua
index e1bde6008..650ff6356 100644
--- a/applications/luci-app-shadowsocks-libev/luasrc/model/shadowsocks-libev.lua
+++ b/applications/luci-app-shadowsocks-libev/luasrc/model/shadowsocks-libev.lua
@@ -14,8 +14,10 @@ module("luci.model.shadowsocks-libev", function(m)
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
@@ -43,7 +45,6 @@ function values_serverlist(o)
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() })
@@ -51,6 +52,14 @@ function values_ipaddr(o)
end
end
+function values_ifnames(o)
+ for _, v in ipairs(nw:get_interfaces()) do
+ if v.dev then
+ o:value(v.dev.name)
+ end
+ end
+end
+
function options_client(s, tab)
local o
@@ -226,12 +235,6 @@ modes = {
"udp_only",
}
-actions = {
- "bypass",
- "forward",
- "checkdst",
-}
-
methods = {
-- aead
"aes-128-gcm",