mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-19 05:02:34 +00:00
wgengine/magicsock: use netaddr.ParseIPPort instead of net.ResolveUDPAddr
This commit is contained in:
parent
f7124c7f06
commit
47b4a19786
@ -2245,17 +2245,12 @@ func (c *Conn) CreateEndpoint(pubKey [32]byte, addrs string) (conn.Endpoint, err
|
|||||||
|
|
||||||
if addrs != "" {
|
if addrs != "" {
|
||||||
for _, ep := range strings.Split(addrs, ",") {
|
for _, ep := range strings.Split(addrs, ",") {
|
||||||
ua, err := net.ResolveUDPAddr("udp", ep)
|
ipp, err := netaddr.ParseIPPort(ep)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
ipp, ok := netaddr.FromStdAddr(ua.IP, ua.Port, ua.Zone)
|
|
||||||
if !ok {
|
|
||||||
return nil, fmt.Errorf("bogus address %q", ep)
|
return nil, fmt.Errorf("bogus address %q", ep)
|
||||||
}
|
}
|
||||||
ua.IP = ipp.IP.IPAddr().IP // makes IPv4 addresses 4 bytes long
|
|
||||||
a.ipPorts = append(a.ipPorts, ipp)
|
a.ipPorts = append(a.ipPorts, ipp)
|
||||||
a.addrs = append(a.addrs, *ua)
|
a.addrs = append(a.addrs, *ipp.UDPAddr())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user