1 -- Copyright 2016 Dan Luedtke <mail@danrl.com>
2 -- Licensed to the public under the Apache License 2.0.
5 local map, section, net = ...
6 local ifname = net:get_interface():name()
7 local private_key, listen_port
8 local metric, mtu, preshared_key
9 local peers, public_key, allowed_ips, endpoint, persistent_keepalive
12 -- general ---------------------------------------------------------------------
14 private_key = section:taboption(
18 translate("Private Key"),
19 translate("Required. Base64-encoded private key for this interface.")
21 private_key.password = true
22 private_key.datatype = "rangelength(44, 44)"
23 private_key.optional = false
26 listen_port = section:taboption(
30 translate("Listen Port"),
31 translate("Optional. UDP port used for outgoing and incoming packets.")
33 listen_port.datatype = "port"
34 listen_port.placeholder = "51820"
35 listen_port.optional = true
38 -- advanced --------------------------------------------------------------------
40 metric = section:taboption(
45 translate("Optional.")
47 metric.datatype = "uinteger"
48 metric.placeholder = "0"
49 metric.optional = true
52 mtu = section:taboption(
57 translate("Optional. Maximum Transmission Unit of tunnel interface.")
59 mtu.datatype = "range(1280,1423)"
60 mtu.placeholder = "1423"
64 preshared_key = section:taboption(
68 translate("Preshared Key"),
69 translate("Optional. Adds in an additional layer of symmetric-key " ..
70 "cryptography for post-quantum resistance.")
72 preshared_key.password = true
73 preshared_key.datatype = "rangelength(44, 44)"
74 preshared_key.optional = true
77 -- peers -----------------------------------------------------------------------
81 "wireguard_" .. ifname,
83 translate("Further information about WireGuard interfaces and peers " ..
84 "at <a href=\"http://wireguard.io\">wireguard.io</a>.")
86 peers.template = "cbi/tsection"
87 peers.anonymous = true
88 peers.addremove = true
91 public_key = peers:option(
94 translate("Public Key"),
95 translate("Required. Public key of peer.")
97 public_key.datatype = "rangelength(44, 44)"
98 public_key.optional = false
101 allowed_ips = peers:option(
104 translate("Allowed IPs"),
105 translate("Required. IP addresses and prefixes that this peer is allowed " ..
106 "to use inside the tunnel. Usually the peer's tunnel IP " ..
107 "addresses and the networks the peer routes through the tunnel.")
109 allowed_ips.datatype = "ipaddr"
110 allowed_ips.optional = false
113 route_allowed_ips = peers:option(
116 translate("Route Allowed IPs"),
117 translate("Optional. Create routes for Allowed IPs for this peer.")
121 endpoint_host = peers:option(
124 translate("Endpoint Host"),
125 translate("Optional. Host of peer. Names are resolved " ..
126 "prior to bringing up the interface."))
127 endpoint_host.placeholder = "vpn.example.com"
128 endpoint_host.datatype = "host"
131 endpoint_port = peers:option(
134 translate("Endpoint Port"),
135 translate("Optional. Port of peer."))
136 endpoint_port.placeholder = "51820"
137 endpoint_port.datatype = "port"
140 persistent_keepalive = peers:option(
142 "persistent_keepalive",
143 translate("Persistent Keep Alive"),
144 translate("Optional. Seconds between keep alive messages. " ..
145 "Default is 0 (disabled). Recommended value if " ..
146 "this device is behind a NAT is 25."))
147 persistent_keepalive.datatype = "range(0, 65535)"
148 persistent_keepalive.placeholder = "0"