aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/conf
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-05-09 16:15:01 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-05-09 16:18:42 +0200
commitb711580b07f56d2a4d7ba49c0f937066c9003911 (patch)
treeb1754bc5b08e2168aa75e5a8935c3f56639e5605 /conf
parentui: networks -> addresses (diff)
downloadwireguard-windows-b711580b07f56d2a4d7ba49c0f937066c9003911.tar.xz
wireguard-windows-b711580b07f56d2a4d7ba49c0f937066c9003911.zip
conf: don't verify scope as part of ip checking
Diffstat (limited to 'conf')
-rw-r--r--conf/parser.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/conf/parser.go b/conf/parser.go
index b9ceb20e..a8ccca07 100644
--- a/conf/parser.go
+++ b/conf/parser.go
@@ -80,7 +80,11 @@ func parseEndpoint(s string) (*Endpoint, error) {
if host[0] == '[' || host[len(host)-1] == ']' || hostColon > 0 {
err := &ParseError{"Brackets must contain an IPv6 address", host}
if len(host) > 3 && host[0] == '[' && host[len(host)-1] == ']' && hostColon > 0 {
- maybeV6 := net.ParseIP(host[1 : len(host)-1])
+ end := len(host) - 1
+ if i := strings.LastIndexByte(host, '%'); i > 1 {
+ end = i
+ }
+ maybeV6 := net.ParseIP(host[1:end])
if maybeV6 == nil || len(maybeV6) != net.IPv6len {
return nil, err
}