summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev/rules.lua
blob: fe5f9c31b8e150b602570051fb533d5c8b13ac83 (plain)
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
-- Copyright 2017 Yousong Zhou <yszhou4tech@gmail.com>
-- Licensed to the public under the Apache License 2.0.

local ss = require("luci.model.shadowsocks-libev")

local m, s, o

m = Map("shadowsocks-libev",
	translate("Redir Rules"),
	translate("On this page you can configure how traffics are to be \
		forwarded to ss-redir instances. \
		If enabled, packets will first have their source ip addresses checked \
		against <em>Src ip bypass</em>, <em>Src ip forward</em>, \
		<em>Src ip checkdst</em> and if none matches <em>Src default</em> \
		will give the default action to be taken. \
		If the prior check results in action <em>checkdst</em>, packets will continue \
		to have their destination addresses checked."))


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"))

s:taboption('general', Flag, "disabled", translate("Disable"))
ss.option_install_package(s, 'general')

o = s:taboption('general', ListValue, "redir_tcp",
	translate("ss-redir for TCP"))
ss.values_redir(o, 'tcp')
o = s:taboption('general', ListValue, "redir_udp",
	translate("ss-redir for UDP"))
ss.values_redir(o, 'udp')

o = s:taboption('general', ListValue, "local_default",
	translate("Local-out default"),
	translate("Default action for locally generated packets"))
ss.values_actions(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",
	translate("Src ip bypass"),
	translate("Bypass redir action for packets with source addresses in this list"))
s:taboption('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",
	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",
	translate("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",
	translate("Dst ip bypass"),
	translate("Bypass redir action for packets with destination addresses in this list"))
s:taboption('dstip', DynamicList, "dst_ips_forward",
	translate("Dst ip forward"),
	translate("Go through redir action for packets with destination addresses in this list"))

o = s:taboption('dstip', FileBrowser, "dst_ips_bypass_file",
	translate("Dst ip bypass file"),
	translate("File containing ip addresses for the purposes as with <em>Dst ip bypass</em>"))
o.datatype = "file"
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"

return m