all: use various net/netip parse funcs directly

Mechanical change with perl+goimports.

Changed {Must,}Parse{IP,IPPrefix,IPPort} to their netip variants, then
goimports -d .

Finally, removed the net/netaddr wrappers, to prevent future use.

Updates #5162

Change-Id: I59c0e38b5fbca5a935d701645789cddf3d7863ad
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2022-07-25 20:55:44 -07:00
committed by Brad Fitzpatrick
parent 730ca4203c
commit 6a396731eb
84 changed files with 401 additions and 355 deletions

View File

@ -467,7 +467,7 @@ func nodeMight6(n *tailcfg.DERPNode) bool {
if n.IPv6 == "" {
return true
}
ip, _ := netaddr.ParseIP(n.IPv6)
ip, _ := netip.ParseAddr(n.IPv6)
return ip.Is6()
}
@ -479,7 +479,7 @@ func nodeMight4(n *tailcfg.DERPNode) bool {
if n.IPv4 == "" {
return true
}
ip, _ := netaddr.ParseIP(n.IPv4)
ip, _ := netip.ParseAddr(n.IPv4)
return ip.Is4()
}
@ -1290,7 +1290,7 @@ func (c *Client) nodeAddr(ctx context.Context, n *tailcfg.DERPNode, proto probeP
return
}
if n.STUNTestIP != "" {
ip, err := netaddr.ParseIP(n.STUNTestIP)
ip, err := netip.ParseAddr(n.STUNTestIP)
if err != nil {
return
}
@ -1306,7 +1306,7 @@ func (c *Client) nodeAddr(ctx context.Context, n *tailcfg.DERPNode, proto probeP
switch proto {
case probeIPv4:
if n.IPv4 != "" {
ip, _ := netaddr.ParseIP(n.IPv4)
ip, _ := netip.ParseAddr(n.IPv4)
if !ip.Is4() {
return
}
@ -1314,7 +1314,7 @@ func (c *Client) nodeAddr(ctx context.Context, n *tailcfg.DERPNode, proto probeP
}
case probeIPv6:
if n.IPv6 != "" {
ip, _ := netaddr.ParseIP(n.IPv6)
ip, _ := netip.ParseAddr(n.IPv6)
if !ip.Is6() {
return
}