mirror of
https://github.com/tailscale/tailscale.git
synced 2025-10-09 16:11:23 +00:00
all: migrate more code code to net/netip directly
Instead of going through the tailscale.com/net/netaddr transitional wrappers. Updates #5162 Change-Id: I3dafd1c2effa1a6caa9b7151ecf6edd1a3fda3dd Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
eb32847d85
commit
8725b14056
@@ -1031,7 +1031,8 @@ func (c *Client) measureHTTPSLatency(ctx context.Context, reg *tailcfg.DERPRegio
|
||||
defer tcpConn.Close()
|
||||
|
||||
if ta, ok := tlsConn.RemoteAddr().(*net.TCPAddr); ok {
|
||||
ip, _ = netaddr.FromStdIP(ta.IP)
|
||||
ip, _ = netip.AddrFromSlice(ta.IP)
|
||||
ip = ip.Unmap()
|
||||
}
|
||||
if ip == (netip.Addr{}) {
|
||||
return 0, ip, fmt.Errorf("no unexpected RemoteAddr %#v", tlsConn.RemoteAddr())
|
||||
@@ -1328,8 +1329,8 @@ func (c *Client) nodeAddr(ctx context.Context, n *tailcfg.DERPNode, proto probeP
|
||||
addrs, _ := net.DefaultResolver.LookupIPAddr(ctx, n.HostName)
|
||||
for _, a := range addrs {
|
||||
if (a.IP.To4() != nil) == (proto == probeIPv4) {
|
||||
na, _ := netaddr.FromStdIP(a.IP.To4())
|
||||
return netip.AddrPortFrom(na, uint16(port))
|
||||
na, _ := netip.AddrFromSlice(a.IP.To4())
|
||||
return netip.AddrPortFrom(na.Unmap(), uint16(port))
|
||||
}
|
||||
}
|
||||
return
|
||||
|
Reference in New Issue
Block a user