1 -- Copyright 2017 Yousong Zhou <yszhou4tech@gmail.com>
2 -- Licensed to the public under the Apache License 2.0.
4 local ss = require("luci.model.shadowsocks-libev")
8 m = Map("shadowsocks-libev",
9 translate("Redir Rules"),
10 translate("On this page you can configure how traffics are to be \
11 forwarded to ss-redir instances. \
12 If enabled, packets will first have their source ip addresses checked \
13 against <em>Src ip bypass</em>, <em>Src ip forward</em>, \
14 <em>Src ip checkdst</em> and if none matches <em>Src default</em> \
15 will give the default action to be taken. \
16 If the prior check results in action <em>checkdst</em>, packets will continue \
17 to have their destination addresses checked."))
20 s = m:section(NamedSection, "ss_rules", "ss-rules")
21 s:tab("general", translate("General Settings"))
22 s:tab("srcip", translate("Source Settings"))
23 s:tab("dstip", translate("Destination Settings"))
25 s:taboption('general', Flag, "disabled", translate("Disable"))
26 ss.option_install_package(s, 'general')
28 o = s:taboption('general', ListValue, "redir_tcp",
29 translate("ss-redir for TCP"))
30 ss.values_redir(o, 'tcp')
31 o = s:taboption('general', ListValue, "redir_udp",
32 translate("ss-redir for UDP"))
33 ss.values_redir(o, 'udp')
35 o = s:taboption('general', ListValue, "local_default",
36 translate("Local-out default"),
37 translate("Default action for locally generated packets"))
39 s:taboption('general', Value, "ipt_args",
40 translate("Extra arguments"),
41 translate("Passes additional arguments to iptables. Use with care!"))
43 s:taboption('srcip', DynamicList, "src_ips_bypass",
44 translate("Src ip bypass"),
45 translate("Bypass redir action for packets with source addresses in this list"))
46 s:taboption('srcip', DynamicList, "src_ips_forward",
47 translate("Src ip forward"),
48 translate("Go through redir action for packets with source addresses in this list"))
49 s:taboption('srcip', DynamicList, "src_ips_checkdst",
50 translate("Src ip checkdst"),
51 translate("Continue to have dst address checked for packets with source addresses in this list"))
52 o = s:taboption('srcip', ListValue, "src_default",
53 translate("Src default"),
54 translate("Default action for packets whose source addresses do not match any of the source ip list"))
57 s:taboption('dstip', DynamicList, "dst_ips_bypass",
58 translate("Dst ip bypass"),
59 translate("Bypass redir action for packets with destination addresses in this list"))
60 s:taboption('dstip', DynamicList, "dst_ips_forward",
61 translate("Dst ip forward"),
62 translate("Go through redir action for packets with destination addresses in this list"))
64 o = s:taboption('dstip', FileBrowser, "dst_ips_bypass_file",
65 translate("Dst ip bypass file"),
66 translate("File containing ip addresses for the purposes as with <em>Dst ip bypass</em>"))
68 s:taboption('dstip', FileBrowser, "dst_ips_forward_file",
69 translate("Dst ip forward file"),
70 translate("File containing ip addresses for the purposes as with <em>Dst ip forward</em>"))