mirror of
https://git.zx2c4.com/wireguard-go
synced 2025-09-18 20:57:50 +02:00
wgcfg: fix bug preventing IPv6 addresses from working
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
30908fdc5d
commit
024d6ea4c2
@ -6,7 +6,6 @@
|
||||
package wgcfg
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"strings"
|
||||
@ -46,9 +45,8 @@ func (conf *Config) ToUAPI() (string, error) {
|
||||
}
|
||||
var ip net.IP
|
||||
for _, iterip := range ips {
|
||||
iterip = iterip.To4()
|
||||
if iterip != nil {
|
||||
ip = iterip
|
||||
if ip4 := iterip.To4(); ip4 != nil {
|
||||
ip = ip4
|
||||
break
|
||||
}
|
||||
if ip == nil {
|
||||
@ -56,7 +54,7 @@ func (conf *Config) ToUAPI() (string, error) {
|
||||
}
|
||||
}
|
||||
if ip == nil {
|
||||
return "", errors.New("Unable to resolve IP address of endpoint")
|
||||
return "", fmt.Errorf("unable to resolve IP address of endpoint %q (%v)", ep.Host, ips)
|
||||
}
|
||||
resolvedEndpoint := Endpoint{ip.String(), ep.Port}
|
||||
reps = append(reps, resolvedEndpoint.String())
|
||||
|
Loading…
Reference in New Issue
Block a user