wgengine/magicsock: use netaddr.MustParseIPPrefix

Delete our bespoke helper.

Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
This commit is contained in:
Josh Bleecher Snyder 2021-04-30 16:33:40 -07:00
parent bc68e22c5b
commit e0bd3cc70c
1 changed files with 1 additions and 10 deletions

View File

@ -453,7 +453,7 @@ func makeConfigs(t *testing.T, addrs []netaddr.IPPort) []wgcfg.Config {
privKeys = append(privKeys, wgkey.Private(privKey)) privKeys = append(privKeys, wgkey.Private(privKey))
addresses = append(addresses, []netaddr.IPPrefix{ addresses = append(addresses, []netaddr.IPPrefix{
parseCIDR(t, fmt.Sprintf("1.0.0.%d/32", i+1)), netaddr.MustParseIPPrefix(fmt.Sprintf("1.0.0.%d/32", i+1)),
}) })
} }
@ -481,15 +481,6 @@ func makeConfigs(t *testing.T, addrs []netaddr.IPPort) []wgcfg.Config {
return cfgs return cfgs
} }
func parseCIDR(t *testing.T, addr string) netaddr.IPPrefix {
t.Helper()
cidr, err := netaddr.ParseIPPrefix(addr)
if err != nil {
t.Fatal(err)
}
return cidr
}
// TestDeviceStartStop exercises the startup and shutdown logic of // TestDeviceStartStop exercises the startup and shutdown logic of
// wireguard-go, which is intimately intertwined with magicsock's own // wireguard-go, which is intimately intertwined with magicsock's own
// lifecycle. We seem to be good at generating deadlocks here, so if // lifecycle. We seem to be good at generating deadlocks here, so if