luci-proto-wireguard: Escape IPv6 endpoints with [] in generated wireguard config
Signed-off-by: Jonathan Duncan <JonathanDuncan@gmail.com>
This commit is contained in:
parent
d7e905e83a
commit
527453ff48
1 changed files with 5 additions and 0 deletions
|
@ -700,6 +700,11 @@ return network.registerProtocol('wireguard', {
|
||||||
eport = this.section.formvalue(section_id, 'endpoint_port'),
|
eport = this.section.formvalue(section_id, 'endpoint_port'),
|
||||||
keep = this.section.formvalue(section_id, 'persistent_keepalive');
|
keep = this.section.formvalue(section_id, 'persistent_keepalive');
|
||||||
|
|
||||||
|
// If endpoint is IPv6 we must escape it with []
|
||||||
|
if (endpoint.indexOf(':') > 0) {
|
||||||
|
endpoint = '['+endpoint+']';
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'[Interface]',
|
'[Interface]',
|
||||||
'PrivateKey = ' + prv,
|
'PrivateKey = ' + prv,
|
||||||
|
|
Loading…
Reference in a new issue