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

@ -10,6 +10,7 @@ import (
"flag"
"fmt"
"net"
"net/netip"
"reflect"
"testing"
"time"
@ -42,7 +43,7 @@ func TestDialCall_DNSWasTrustworthy(t *testing.T) {
ip netaddr.IP // IP we pretended to dial
err error // the dial error or nil for success
}
mustIP := netaddr.MustParseIP
mustIP := netip.MustParseAddr
errFail := errors.New("some connect failure")
tests := []struct {
name string
@ -90,7 +91,7 @@ func TestDialCall_DNSWasTrustworthy(t *testing.T) {
func TestDialCall_uniqueIPs(t *testing.T) {
dc := &dialCall{}
mustIP := netaddr.MustParseIP
mustIP := netip.MustParseAddr
errFail := errors.New("some connect failure")
dc.noteDialResult(mustIP("2003::1"), errFail)
dc.noteDialResult(mustIP("2003::2"), errFail)
@ -116,10 +117,10 @@ func TestResolverAllHostStaticResult(t *testing.T) {
r := &Resolver{
SingleHost: "foo.bar",
SingleHostStaticResult: []netaddr.IP{
netaddr.MustParseIP("2001:4860:4860::8888"),
netaddr.MustParseIP("2001:4860:4860::8844"),
netaddr.MustParseIP("8.8.8.8"),
netaddr.MustParseIP("8.8.4.4"),
netip.MustParseAddr("2001:4860:4860::8888"),
netip.MustParseAddr("2001:4860:4860::8844"),
netip.MustParseAddr("8.8.8.8"),
netip.MustParseAddr("8.8.4.4"),
},
}
ip4, ip6, allIPs, err := r.LookupIP(context.Background(), "foo.bar")