summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-shadowsocks-libev
diff options
context:
space:
mode:
authorYousong Zhou <yszhou4tech@gmail.com>2017-08-21 22:58:40 +0800
committerYousong Zhou <yszhou4tech@gmail.com>2017-08-22 20:19:50 +0800
commit28b996d66f370517e5653b7ee5a4f3e5b3616520 (patch)
tree875c97a879d947ad51302b79b0f23cce788d11de /applications/luci-app-shadowsocks-libev
parent4b042bcbd9104c128dd2255b02f8dbc2dd59b653 (diff)
luci-app-shadowsocks-libev: support for option dst_forward_recentrst
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Diffstat (limited to 'applications/luci-app-shadowsocks-libev')
-rw-r--r--applications/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev/rules.lua18
1 files changed, 18 insertions, 0 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 1e2a491bc..4a01bed24 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
@@ -88,4 +88,22 @@ o = s:taboption('dst', ListValue, "dst_default",
translate("Default action for packets whose dst address do not match any of the dst ip list"))
ss.values_actions(o)
+local installed = os.execute("iptables -m recent -h &>/dev/null") == 0
+if installed then
+ o = s:taboption('dst', Flag, "dst_forward_recentrst")
+else
+ m:set('ss_rules', 'dst_forward_recentrst', "0")
+ o = s:taboption("dst", Button, "_install")
+ o.inputtitle = translate("Install package iptables-mod-conntrack-extra")
+ o.inputstyle = "apply"
+ o.write = function()
+ return luci.http.redirect(
+ luci.dispatcher.build_url("admin/system/packages") ..
+ "?submit=1&install=iptables-mod-conntrack-extra"
+ )
+ end
+end
+o.title = translate("Forward recentrst")
+o.description = translate("Forward those packets whose dst have recently sent to us multiple tcp-rst")
+
return m