From e0bd3cc70cfb776ad9b4f0b418923662d7b9b050 Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Fri, 30 Apr 2021 16:33:40 -0700 Subject: [PATCH] wgengine/magicsock: use netaddr.MustParseIPPrefix Delete our bespoke helper. Signed-off-by: Josh Bleecher Snyder --- wgengine/magicsock/magicsock_test.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/wgengine/magicsock/magicsock_test.go b/wgengine/magicsock/magicsock_test.go index 7caca8136..a98d48a45 100644 --- a/wgengine/magicsock/magicsock_test.go +++ b/wgengine/magicsock/magicsock_test.go @@ -453,7 +453,7 @@ func makeConfigs(t *testing.T, addrs []netaddr.IPPort) []wgcfg.Config { privKeys = append(privKeys, wgkey.Private(privKey)) 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 } -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 // wireguard-go, which is intimately intertwined with magicsock's own // lifecycle. We seem to be good at generating deadlocks here, so if