luci-app-cjdns: import package from SeattleMeshnet/meshbox
[feed/routing.git] / luci-app-cjdns / luasrc / model / cbi / cjdns / iptunnel.lua
1 uci = require "luci.model.uci"
2 cursor = uci:cursor_state()
3
4 m = Map("cjdns", translate("cjdns"),
5 translate("Implements an encrypted IPv6 network using public-key \
6 cryptography for address allocation and a distributed hash table for \
7 routing. This provides near-zero-configuration networking, and prevents \
8 many of the security and scalability issues that plague existing \
9 networks."))
10
11 m.on_after_commit = function(self)
12 os.execute("/etc/init.d/cjdns restart")
13 end
14
15 -- Outgoing
16 outgoing = m:section(TypedSection, "iptunnel_outgoing", translate("Outgoing IP Tunnel Connections"),
17 translate("Enter the public keys of the nodes that will provide Internet access."))
18 outgoing.anonymous = true
19 outgoing.addremove = true
20 outgoing.template = "cbi/tblsection"
21
22 outgoing:option(Value, "public_key", translate("Public Key")).size = 55
23
24 -- Allowed
25 allowed = m:section(TypedSection, "iptunnel_allowed", translate("Allowed IP Tunnel Connections"),
26 translate("Enter the public key of the node you will provide Internet access to, along with the \
27 IPv4 and/or IPv6 address you will assign them."))
28 allowed.anonymous = true
29 allowed.addremove = true
30
31 public_key = allowed:option(Value, "public_key", translate("Public Key"))
32 public_key.template = "cjdns/value"
33 public_key.size = 55
34
35 ipv4 = allowed:option(Value, "ipv4", translate("IPv4"))
36 ipv4.template = "cjdns/value"
37 ipv4.datatype = 'ipaddr'
38 ipv4.size = 55
39
40 ipv6 = allowed:option(Value, "ipv6", translate("IPv6"),
41 translate("IPv6 addresses should be entered <em>without</em> brackets here, e.g. <code>2001:123:ab::10</code>."))
42 ipv6.template = "cjdns/value"
43 ipv6.datatype = 'ip6addr'
44 ipv6.size = 55
45
46 return m