Welcome to mirror list, hosted at ThFree Co, Russian Federation.

proto_wireguard.lua « admin_network « cbi « model « luasrc « luci-proto-wireguard « protocols - github.com/openwrt/luci.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 64e256a517cbf5185d52a1488af15d132cf93187 (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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
-- Copyright 2016-2017 Dan Luedtke <mail@danrl.com>
-- Licensed to the public under the Apache License 2.0.


local map, section, net = ...
local ifname = net:get_interface():name()
local private_key, listen_port
local metric, mtu, preshared_key, description
local peers, public_key, allowed_ips, endpoint, persistent_keepalive


-- general ---------------------------------------------------------------------

private_key = section:taboption(
  "general",
  Value,
  "private_key",
  translate("Private Key"),
  translate("Required. Base64-encoded private key for this interface.")
)
private_key.password = true
private_key.datatype = "and(base64,rangelength(44,44))"
private_key.optional = false


listen_port = section:taboption(
  "general",
  Value,
  "listen_port",
  translate("Listen Port"),
  translate("Optional. UDP port used for outgoing and incoming packets.")
)
listen_port.datatype = "port"
listen_port.placeholder = translate("random")
listen_port.optional = true

addresses = section:taboption(
  "general",
  DynamicList,
  "addresses",
  translate("IP Addresses"),
  translate("Recommended. IP addresses of the WireGuard interface.")
)
addresses.datatype = "ipaddr"
addresses.optional = true


-- advanced --------------------------------------------------------------------

metric = section:taboption(
  "advanced",
  Value,
  "metric",
  translate("Metric"),
  translate("Optional")
)
metric.datatype = "uinteger"
metric.placeholder = "0"
metric.optional = true


mtu = section:taboption(
  "advanced",
  Value,
  "mtu",
  translate("MTU"),
  translate("Optional. Maximum Transmission Unit of tunnel interface.")
)
mtu.datatype = "range(1280,1420)"
mtu.placeholder = "1420"
mtu.optional = true

fwmark = section:taboption(
  "advanced",
  Value,
  "fwmark",
  translate("Firewall Mark"),
  translate("Optional. 32-bit mark for outgoing encrypted packets. " ..
            "Enter value in hex, starting with <code>0x</code>.")
)
fwmark.datatype = "hex(4)"
fwmark.optional = true


-- peers -----------------------------------------------------------------------

peers = map:section(
  TypedSection,
  "wireguard_" .. ifname,
  translate("Peers"),
  translate("Further information about WireGuard interfaces and peers " ..
            "at <a href=\"http://wireguard.com\">wireguard.com</a>.")
)
peers.template = "cbi/tsection"
peers.anonymous = true
peers.addremove = true


description = peers:option(
  Value,
  "description",
  translate("Description"),
  translate("Optional. Description of peer."))
description.placeholder = "My Peer"
description.datatype = "string"
description.optional = true


public_key = peers:option(
  Value,
  "public_key",
  translate("Public Key"),
  translate("Required. Base64-encoded public key of peer.")
)
public_key.datatype = "and(base64,rangelength(44,44))"
public_key.optional = false


preshared_key = peers:option(
  Value,
  "preshared_key",
  translate("Preshared Key"),
  translate("Optional. Base64-encoded preshared key. " ..
            "Adds in an additional layer of symmetric-key " ..
            "cryptography for post-quantum resistance.")
)
preshared_key.password = true
preshared_key.datatype = "and(base64,rangelength(44,44))"
preshared_key.optional = true


allowed_ips = peers:option(
  DynamicList,
  "allowed_ips",
  translate("Allowed IPs"),
  translate("Required. IP addresses and prefixes that this peer is allowed " ..
            "to use inside the tunnel. Usually the peer's tunnel IP " ..
            "addresses and the networks the peer routes through the tunnel.")
)
allowed_ips.datatype = "ipaddr"
allowed_ips.optional = false


route_allowed_ips = peers:option(
  Flag,
  "route_allowed_ips",
  translate("Route Allowed IPs"),
  translate("Optional. Create routes for Allowed IPs for this peer.")
)


endpoint_host = peers:option(
  Value,
  "endpoint_host",
  translate("Endpoint Host"),
  translate("Optional. Host of peer. Names are resolved " ..
            "prior to bringing up the interface."))
endpoint_host.placeholder = "vpn.example.com"
endpoint_host.datatype = "host"


endpoint_port = peers:option(
  Value,
  "endpoint_port",
  translate("Endpoint Port"),
  translate("Optional. Port of peer."))
endpoint_port.placeholder = "51820"
endpoint_port.datatype = "port"


persistent_keepalive = peers:option(
  Value,
  "persistent_keepalive",
  translate("Persistent Keep Alive"),
  translate("Optional. Seconds between keep alive messages. " ..
            "Default is 0 (disabled). Recommended value if " ..
            "this device is behind a NAT is 25."))
persistent_keepalive.datatype = "range(0,65535)"
persistent_keepalive.placeholder = "0"