mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-12 05:37:32 +00:00
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
@@ -18,6 +18,7 @@ import (
|
||||
"log"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/netip"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
@@ -830,7 +831,7 @@ func (n *testNode) AwaitIPs() []netaddr.IP {
|
||||
addrs = make([]netaddr.IP, len(ipslice))
|
||||
|
||||
for i, ip := range ipslice {
|
||||
netIP, err := netaddr.ParseIP(ip)
|
||||
netIP, err := netip.ParseAddr(ip)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@@ -19,6 +19,7 @@ import (
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/netip"
|
||||
"net/url"
|
||||
"sort"
|
||||
"strings"
|
||||
@@ -859,7 +860,7 @@ func filterInvalidIPv6Endpoints(eps []string) []string {
|
||||
}
|
||||
|
||||
func keepClientEndpoint(ep string) bool {
|
||||
ipp, err := netaddr.ParseIPPort(ep)
|
||||
ipp, err := netip.ParseAddrPort(ep)
|
||||
if err != nil {
|
||||
// Shouldn't have made it this far if we unmarshalled
|
||||
// the incoming JSON response.
|
||||
|
@@ -14,6 +14,7 @@ import (
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/netip"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
@@ -240,5 +241,5 @@ outer:
|
||||
}
|
||||
|
||||
func bytes2Netaddr(inp []byte) netaddr.IP {
|
||||
return netaddr.MustParseIP(string(bytes.TrimSpace(inp)))
|
||||
return netip.MustParseAddr(string(bytes.TrimSpace(inp)))
|
||||
}
|
||||
|
@@ -13,6 +13,7 @@ import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/netip"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
@@ -452,7 +453,7 @@ func (h *Harness) testDistro(t *testing.T, d Distro, ipm ipMapping) {
|
||||
t.Fatalf("can't get IP: %v", err)
|
||||
}
|
||||
|
||||
netaddr.MustParseIP(string(bytes.TrimSpace(ipBytes)))
|
||||
netip.MustParseAddr(string(bytes.TrimSpace(ipBytes)))
|
||||
})
|
||||
|
||||
t.Run("ping-"+tt.ipProto, func(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user