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:

committed by
Brad Fitzpatrick

parent
730ca4203c
commit
6a396731eb
@ -7,6 +7,7 @@ package tailcfg
|
||||
import (
|
||||
"encoding"
|
||||
"encoding/json"
|
||||
"net/netip"
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
@ -41,7 +42,7 @@ func TestHostinfoEqual(t *testing.T) {
|
||||
|
||||
nets := func(strs ...string) (ns []netaddr.IPPrefix) {
|
||||
for _, s := range strs {
|
||||
n, err := netaddr.ParseIPPrefix(s)
|
||||
n, err := netip.ParsePrefix(s)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@ -224,12 +225,12 @@ func TestHostinfoHowEqual(t *testing.T) {
|
||||
a: &Hostinfo{
|
||||
IPNVersion: "1",
|
||||
ShieldsUp: false,
|
||||
RoutableIPs: []netaddr.IPPrefix{netaddr.MustParseIPPrefix("1.2.3.0/24")},
|
||||
RoutableIPs: []netaddr.IPPrefix{netip.MustParsePrefix("1.2.3.0/24")},
|
||||
},
|
||||
b: &Hostinfo{
|
||||
IPNVersion: "2",
|
||||
ShieldsUp: true,
|
||||
RoutableIPs: []netaddr.IPPrefix{netaddr.MustParseIPPrefix("1.2.3.0/25")},
|
||||
RoutableIPs: []netaddr.IPPrefix{netip.MustParsePrefix("1.2.3.0/25")},
|
||||
},
|
||||
want: []string{"IPNVersion", "ShieldsUp", "RoutableIPs"},
|
||||
},
|
||||
|
Reference in New Issue
Block a user