X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=applications%2Fluci-app-shadowsocks-libev%2Fluasrc%2Fmodel%2Fcbi%2Fshadowsocks-libev%2Frules.lua;h=1f5a9d22ffba897986ddb207a5cd1eefbe47f47a;hp=fe5f9c31b8e150b602570051fb533d5c8b13ac83;hb=56e9ac6642c580cdd121e1bcd0f3bbd924c44dd0;hpb=bf407f087cde592631bd0c95948e32cbd0efab08 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 fe5f9c31b..1f5a9d22f 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 @@ -16,8 +16,18 @@ m = Map("shadowsocks-libev", If the prior check results in action checkdst, packets will continue \ to have their destination addresses checked.")) +local sdata = m:get('ss_rules') +if not sdata then + m:set('ss_rules', nil, 'ss_rules') + m:set('ss_rules', 'disabled', "1") +end -s = m:section(NamedSection, "ss_rules", "ss-rules") +function src_dst_option(s, ...) + local o = s:taboption(...) + o.datatype = "or(ip4addr,cidr4)" +end + +s = m:section(NamedSection, "ss_rules", "ss_rules") s:tab("general", translate("General Settings")) s:tab("srcip", translate("Source Settings")) s:tab("dstip", translate("Destination Settings")) @@ -34,19 +44,23 @@ 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!")) -s:taboption('srcip', DynamicList, "src_ips_bypass", +src_dst_option(s, 'srcip', DynamicList, "src_ips_bypass", translate("Src ip bypass"), translate("Bypass redir action for packets with source addresses in this list")) -s:taboption('srcip', DynamicList, "src_ips_forward", +src_dst_option(s, 'srcip', DynamicList, "src_ips_forward", translate("Src ip forward"), translate("Go through redir action for packets with source addresses in this list")) -s:taboption('srcip', DynamicList, "src_ips_checkdst", +src_dst_option(s, 'srcip', DynamicList, "src_ips_checkdst", translate("Src ip checkdst"), translate("Continue to have dst address checked for packets with source addresses in this list")) o = s:taboption('srcip', ListValue, "src_default", @@ -54,10 +68,10 @@ o = s:taboption('srcip', ListValue, "src_default", translate("Default action for packets whose source addresses do not match any of the source ip list")) ss.values_actions(o) -s:taboption('dstip', DynamicList, "dst_ips_bypass", +src_dst_option(s, 'dstip', DynamicList, "dst_ips_bypass", translate("Dst ip bypass"), translate("Bypass redir action for packets with destination addresses in this list")) -s:taboption('dstip', DynamicList, "dst_ips_forward", +src_dst_option(s, 'dstip', DynamicList, "dst_ips_forward", translate("Dst ip forward"), translate("Go through redir action for packets with destination addresses in this list")) @@ -69,5 +83,9 @@ s:taboption('dstip', FileBrowser, "dst_ips_forward_file", translate("Dst ip forward file"), translate("File containing ip addresses for the purposes as with Dst ip forward")) 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