Merge pull request #581 from Umeaboy/patch-2
[project/luci.git] / protocols / luci-proto-ipv6 / luasrc / model / cbi / admin_network / proto_aiccu.lua
1 -- Copyright 2015 Paul Oranje <por@xs4all.nl>
2 -- Licensed to the public under the Apache License 2.0.
3
4 local map, section, net = ...
5
6 -- config read by /lib/netifd/proto/aiccu.sh
7 local username, password, protocol, server, tunnelid, ip6prefix, requiretls, nat, heartbeat,
8         verbose, ntpsynctimeout, ip6addr, sourcerouting, defaultroute
9
10 -- generic parameters
11 local metric, ttl, mtu
12
13
14 username = section:taboption("general", Value, "username",
15         translate("Server username"),
16         translate("SIXXS-handle[/Tunnel-ID]"))
17 username.datatype = "string"
18
19 password = section:taboption("general", Value, "password",
20         translate("Server password"),
21         translate("Server password, enter the specific password of the tunnel when the username contains the tunnel ID"))
22 password.datatype = "string"
23 password.password = true
24
25
26 --[[ SIXXS supports only TIC as tunnel broker protocol, no use setting it.
27 protocol = section:taboption("general", ListValue, "protocol",
28         translate("Tunnel broker protocol"),
29         translate("SIXXS supports TIC only, for static tunnels using IP protocol 41 (RFC4213) use 6in4 instead"))
30
31 protocol:value("tic", "TIC")
32 protocol:value("tsp", "TSP")
33 protocol:value("l2tp", "L2TP")
34 protocol.default = "tic"
35 protocol.optional = true
36 --]]
37
38
39 server = section:taboption("general", Value, "server",
40         translate("Tunnel setup server"),
41         translate("Optional, specify to override default server (tic.sixxs.net)"))
42 server.datatype = "host"
43 server.optional = true
44
45
46 tunnelid = section:taboption("general", Value, "tunnelid",
47         translate("Tunnel ID"),
48         translate("Optional, use when the SIXXS account has more than one tunnel"))
49 tunnelid.datatype = "string"
50 tunnelid.optional = true
51
52
53 local ip6prefix = section:taboption("general", Value, "ip6prefix",
54         translate("IPv6 prefix"),
55         translate("Routed IPv6 prefix for downstream interfaces"))
56 ip6prefix.datatype = "ip6addr"
57 ip6prefix.optional = true
58
59
60 heartbeat = s:taboption("general", ListValue, "heartbeat",
61         translate("Tunnel type"),
62         translate("Also see <a href=\"https://www.sixxs.net/faq/connectivity/?faq=comparison\">Tunneling Comparison</a> on SIXXS"))
63 heartbeat:value("0", translate("AYIYA"))
64 heartbeat:value("1", translate("Heartbeat"))
65 heartbeat.default = "0"
66
67
68 nat = section:taboption("general", Flag, "nat",
69         translate("Behind NAT"),
70         translate("The tunnel end-point is behind NAT, defaults to disabled and only applies to AYIYA"))
71 nat.optional = true
72 nat.default = nat.disabled
73
74
75 requiretls = section:taboption("general", Flag, "requiretls",
76         translate("Require TLS"),
77         translate("Connection to server fails when TLS cannot be used"))
78 requiretls.optional = true
79 requiretls.default = requiretls.disabled
80
81
82 verbose = section:taboption("advanced", Flag, "verbose",
83         translate("Verbose"),
84         translate("Verbose logging by aiccu daemon"))
85 verbose.optional = true
86 verbose.default = verbose.disabled
87
88
89 ntpsynctimeout = section:taboption("advanced", Value, "ntpsynctimeout",
90         translate("NTP sync time-out"),
91         translate("Wait for NTP sync that many seconds, seting to 0 disables waiting (optional)"))
92 ntpsynctimeout.datatype = "uinteger"
93 ntpsynctimeout.placeholder = "90"
94 ntpsynctimeout.optional = true
95
96
97 ip6addr = section:taboption("advanced", Value, "ip6addr",
98         translate("Local IPv6 address"),
99         translate("IPv6 address delegated to the local tunnel endpoint (optional)"))
100 ip6addr.datatype = "ip6addr"
101 ip6addr.optional = true
102
103
104 defaultroute = section:taboption("advanced", Flag, "defaultroute",
105         translate("Default route"),
106         translate("Whether to create an IPv6 default route over the tunnel"))
107 defaultroute.default = defaultroute.enabled
108 defaultroute.optional = true
109
110
111 sourcerouting = section:taboption("advanced", Flag, "sourcerouting",
112         translate("Source routing"),
113         translate("Whether to route only packets from delegated prefixes"))
114 sourcerouting.default = sourcerouting.enabled
115 sourcerouting.optional = true
116
117
118 metric = section:taboption("advanced", Value, "metric",
119         translate("Use gateway metric"))
120 metric.datatype = "uinteger"
121 metric.placeholder = "0"
122 metric:depends("defaultroute", defaultroute.enabled)
123
124
125 ttl = section:taboption("advanced", Value, "ttl",
126         translate("Use TTL on tunnel interface"))
127 ttl.datatype = "range(1,255)"
128 ttl.placeholder = "64"
129
130
131 mtu = section:taboption("advanced", Value, "mtu",
132         translate("Use MTU on tunnel interface"),
133         translate("minimum 1280, maximum 1480"))
134 mtu.datatype = "range(1280,1480)"
135 mtu.placeholder = "1280"
136