mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-12 05:37:32 +00:00
net/netaddr: start migrating to net/netip via new netaddr adapter package
Updates #5162 Change-Id: Id7bdec303b25471f69d542f8ce43805328d56c12 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
7b1a91dfd3
commit
7eaf5e509f
@@ -30,10 +30,10 @@ import (
|
||||
"time"
|
||||
|
||||
"go4.org/mem"
|
||||
"inet.af/netaddr"
|
||||
"tailscale.com/ipn"
|
||||
"tailscale.com/ipn/ipnstate"
|
||||
"tailscale.com/ipn/store"
|
||||
"tailscale.com/net/netaddr"
|
||||
"tailscale.com/safesocket"
|
||||
"tailscale.com/tailcfg"
|
||||
"tailscale.com/tstest"
|
||||
|
@@ -11,7 +11,6 @@ import (
|
||||
// Otherwise cmd/go never sees that we depend on these packages'
|
||||
// transitive deps when we run "go install tailscaled" in a child
|
||||
// process and can cache a prior success when a dependency changes.
|
||||
_ "inet.af/netaddr"
|
||||
_ "tailscale.com/chirp"
|
||||
_ "tailscale.com/cmd/tailscaled/childproc"
|
||||
_ "tailscale.com/control/controlclient"
|
||||
@@ -24,6 +23,7 @@ import (
|
||||
_ "tailscale.com/logtail"
|
||||
_ "tailscale.com/net/dns"
|
||||
_ "tailscale.com/net/interfaces"
|
||||
_ "tailscale.com/net/netaddr"
|
||||
_ "tailscale.com/net/netns"
|
||||
_ "tailscale.com/net/portmapper"
|
||||
_ "tailscale.com/net/proxymux"
|
||||
|
@@ -11,7 +11,6 @@ import (
|
||||
// Otherwise cmd/go never sees that we depend on these packages'
|
||||
// transitive deps when we run "go install tailscaled" in a child
|
||||
// process and can cache a prior success when a dependency changes.
|
||||
_ "inet.af/netaddr"
|
||||
_ "tailscale.com/chirp"
|
||||
_ "tailscale.com/cmd/tailscaled/childproc"
|
||||
_ "tailscale.com/control/controlclient"
|
||||
@@ -24,6 +23,7 @@ import (
|
||||
_ "tailscale.com/logtail"
|
||||
_ "tailscale.com/net/dns"
|
||||
_ "tailscale.com/net/interfaces"
|
||||
_ "tailscale.com/net/netaddr"
|
||||
_ "tailscale.com/net/netns"
|
||||
_ "tailscale.com/net/portmapper"
|
||||
_ "tailscale.com/net/proxymux"
|
||||
|
@@ -11,7 +11,6 @@ import (
|
||||
// Otherwise cmd/go never sees that we depend on these packages'
|
||||
// transitive deps when we run "go install tailscaled" in a child
|
||||
// process and can cache a prior success when a dependency changes.
|
||||
_ "inet.af/netaddr"
|
||||
_ "tailscale.com/chirp"
|
||||
_ "tailscale.com/cmd/tailscaled/childproc"
|
||||
_ "tailscale.com/control/controlclient"
|
||||
@@ -24,6 +23,7 @@ import (
|
||||
_ "tailscale.com/logtail"
|
||||
_ "tailscale.com/net/dns"
|
||||
_ "tailscale.com/net/interfaces"
|
||||
_ "tailscale.com/net/netaddr"
|
||||
_ "tailscale.com/net/netns"
|
||||
_ "tailscale.com/net/portmapper"
|
||||
_ "tailscale.com/net/proxymux"
|
||||
|
@@ -11,7 +11,6 @@ import (
|
||||
// Otherwise cmd/go never sees that we depend on these packages'
|
||||
// transitive deps when we run "go install tailscaled" in a child
|
||||
// process and can cache a prior success when a dependency changes.
|
||||
_ "inet.af/netaddr"
|
||||
_ "tailscale.com/chirp"
|
||||
_ "tailscale.com/cmd/tailscaled/childproc"
|
||||
_ "tailscale.com/control/controlclient"
|
||||
@@ -24,6 +23,7 @@ import (
|
||||
_ "tailscale.com/logtail"
|
||||
_ "tailscale.com/net/dns"
|
||||
_ "tailscale.com/net/interfaces"
|
||||
_ "tailscale.com/net/netaddr"
|
||||
_ "tailscale.com/net/netns"
|
||||
_ "tailscale.com/net/portmapper"
|
||||
_ "tailscale.com/net/proxymux"
|
||||
|
@@ -16,7 +16,6 @@ import (
|
||||
_ "golang.org/x/sys/windows/svc/eventlog"
|
||||
_ "golang.org/x/sys/windows/svc/mgr"
|
||||
_ "golang.zx2c4.com/wireguard/windows/tunnel/winipcfg"
|
||||
_ "inet.af/netaddr"
|
||||
_ "tailscale.com/cmd/tailscaled/childproc"
|
||||
_ "tailscale.com/control/controlclient"
|
||||
_ "tailscale.com/derp/derphttp"
|
||||
@@ -29,6 +28,7 @@ import (
|
||||
_ "tailscale.com/logtail/backoff"
|
||||
_ "tailscale.com/net/dns"
|
||||
_ "tailscale.com/net/interfaces"
|
||||
_ "tailscale.com/net/netaddr"
|
||||
_ "tailscale.com/net/netns"
|
||||
_ "tailscale.com/net/portmapper"
|
||||
_ "tailscale.com/net/proxymux"
|
||||
|
@@ -27,7 +27,7 @@ import (
|
||||
|
||||
"github.com/klauspost/compress/zstd"
|
||||
"go4.org/mem"
|
||||
"inet.af/netaddr"
|
||||
"tailscale.com/net/netaddr"
|
||||
"tailscale.com/net/tsaddr"
|
||||
"tailscale.com/smallzstd"
|
||||
"tailscale.com/tailcfg"
|
||||
@@ -475,7 +475,7 @@ func (s *Server) serveRegister(w http.ResponseWriter, r *http.Request, mkey key.
|
||||
machineAuthorized := true // TODO: add Server.RequireMachineAuth
|
||||
|
||||
v4Prefix := netaddr.IPPrefixFrom(netaddr.IPv4(100, 64, uint8(tailcfg.NodeID(user.ID)>>8), uint8(tailcfg.NodeID(user.ID))), 32)
|
||||
v6Prefix := netaddr.IPPrefixFrom(tsaddr.Tailscale4To6(v4Prefix.IP()), 128)
|
||||
v6Prefix := netaddr.IPPrefixFrom(tsaddr.Tailscale4To6(v4Prefix.Addr()), 128)
|
||||
|
||||
allowedIPs := []netaddr.IPPrefix{
|
||||
v4Prefix,
|
||||
@@ -761,7 +761,7 @@ func (s *Server) MapResponse(req *tailcfg.MapRequest) (res *tailcfg.MapResponse,
|
||||
})
|
||||
|
||||
v4Prefix := netaddr.IPPrefixFrom(netaddr.IPv4(100, 64, uint8(tailcfg.NodeID(user.ID)>>8), uint8(tailcfg.NodeID(user.ID))), 32)
|
||||
v6Prefix := netaddr.IPPrefixFrom(tsaddr.Tailscale4To6(v4Prefix.IP()), 128)
|
||||
v6Prefix := netaddr.IPPrefixFrom(tsaddr.Tailscale4To6(v4Prefix.Addr()), 128)
|
||||
|
||||
res.Node.Addresses = []netaddr.IPPrefix{
|
||||
v4Prefix,
|
||||
@@ -865,7 +865,7 @@ func keepClientEndpoint(ep string) bool {
|
||||
// the incoming JSON response.
|
||||
return false
|
||||
}
|
||||
ip := ipp.IP()
|
||||
ip := ipp.Addr()
|
||||
if ip.Zone() != "" {
|
||||
return false
|
||||
}
|
||||
|
@@ -9,8 +9,8 @@ import (
|
||||
"runtime"
|
||||
"testing"
|
||||
|
||||
"inet.af/netaddr"
|
||||
"tailscale.com/net/interfaces"
|
||||
"tailscale.com/net/netaddr"
|
||||
)
|
||||
|
||||
func deriveBindhost(t *testing.T) string {
|
||||
@@ -26,7 +26,7 @@ func deriveBindhost(t *testing.T) string {
|
||||
if ret != "" || i.Name != ifName {
|
||||
return
|
||||
}
|
||||
ret = prefix.IP().String()
|
||||
ret = prefix.Addr().String()
|
||||
})
|
||||
if ret != "" {
|
||||
return ret
|
||||
|
@@ -25,7 +25,7 @@ import (
|
||||
|
||||
"golang.org/x/crypto/ssh"
|
||||
"golang.org/x/net/proxy"
|
||||
"inet.af/netaddr"
|
||||
"tailscale.com/net/netaddr"
|
||||
"tailscale.com/tailcfg"
|
||||
"tailscale.com/tstest/integration"
|
||||
"tailscale.com/tstest/integration/testcontrol"
|
||||
|
@@ -18,7 +18,7 @@ import (
|
||||
"time"
|
||||
|
||||
"golang.org/x/crypto/ssh"
|
||||
"inet.af/netaddr"
|
||||
"tailscale.com/net/netaddr"
|
||||
)
|
||||
|
||||
const timeout = 15 * time.Second
|
||||
|
@@ -28,7 +28,7 @@ import (
|
||||
expect "github.com/tailscale/goexpect"
|
||||
"golang.org/x/crypto/ssh"
|
||||
"golang.org/x/sync/semaphore"
|
||||
"inet.af/netaddr"
|
||||
"tailscale.com/net/netaddr"
|
||||
"tailscale.com/tstest"
|
||||
"tailscale.com/tstest/integration"
|
||||
"tailscale.com/types/logger"
|
||||
|
Reference in New Issue
Block a user