From 14683371ee6c00ab3c15d42741113f91e4c44946 Mon Sep 17 00:00:00 2001 From: Charlotte Brandhorst-Satzkorn <46385858+catzkorn@users.noreply.github.com> Date: Tue, 2 Apr 2024 13:32:30 -0700 Subject: [PATCH] tailscale: update tailfs file and package names (#11590) This change updates the tailfs file and package names to their new naming convention. Updates #tailscale/corp#16827 Signed-off-by: Charlotte Brandhorst-Satzkorn --- client/tailscale/localclient.go | 8 +-- client/tailscale/localclient_test.go | 6 +- cmd/derper/depaware.txt | 2 +- cmd/tailscale/cli/share.go | 6 +- cmd/tailscale/depaware.txt | 2 +- cmd/tailscaled/depaware.txt | 16 ++--- cmd/tailscaled/tailscaled.go | 8 +-- cmd/tailscaled/tailscaled_windows.go | 4 +- .../tailfs_clone.go => drive/drive_clone.go | 2 +- tailfs/tailfs_view.go => drive/drive_view.go | 2 +- .../driveimpl}/birthtiming.go | 2 +- .../driveimpl}/birthtiming_test.go | 2 +- .../driveimpl}/compositedav/compositedav.go | 4 +- .../driveimpl}/compositedav/propfind.go | 2 +- .../driveimpl}/compositedav/stat_cache.go | 0 .../compositedav/stat_cache_test.go | 0 .../driveimpl}/connlistener.go | 2 +- .../driveimpl}/connlistener_test.go | 2 +- .../driveimpl}/dirfs/dirfs.go | 2 +- .../driveimpl}/dirfs/dirfs_test.go | 2 +- .../driveimpl}/dirfs/mkdir.go | 2 +- .../driveimpl}/dirfs/openfile.go | 2 +- .../driveimpl}/dirfs/removeall.go | 0 .../driveimpl}/dirfs/rename.go | 0 .../driveimpl}/dirfs/stat.go | 2 +- .../driveimpl/drive_test.go | 32 +++++----- .../driveimpl}/fileserver.go | 4 +- .../driveimpl}/local_impl.go | 12 ++-- .../driveimpl}/remote_impl.go | 34 +++++------ .../driveimpl}/shared/pathutil.go | 0 .../driveimpl}/shared/pathutil_test.go | 0 .../driveimpl}/shared/readonlydir.go | 0 .../driveimpl}/shared/stat.go | 0 {tailfs => drive}/local.go | 12 ++-- {tailfs => drive}/remote.go | 2 +- {tailfs => drive}/remote_nonunix.go | 2 +- {tailfs => drive}/remote_permissions.go | 2 +- {tailfs => drive}/remote_permissions_test.go | 2 +- {tailfs => drive}/remote_unix.go | 2 +- ipn/backend.go | 4 +- ipn/ipn_clone.go | 6 +- ipn/ipn_view.go | 8 +-- ipn/ipnlocal/{tailfs.go => drive.go} | 40 ++++++------- .../{tailfs_test.go => drive_test.go} | 0 ipn/ipnlocal/local.go | 6 +- ipn/ipnlocal/local_test.go | 60 +++++++++---------- ipn/ipnlocal/peerapi.go | 4 +- ipn/localapi/localapi.go | 6 +- ipn/prefs.go | 6 +- tailcfg/tailcfg_test.go | 6 +- tsd/tsd.go | 10 ++-- .../tailscaled_deps_test_darwin.go | 2 +- .../tailscaled_deps_test_freebsd.go | 2 +- .../integration/tailscaled_deps_test_linux.go | 2 +- .../tailscaled_deps_test_openbsd.go | 2 +- .../tailscaled_deps_test_windows.go | 2 +- wgengine/netstack/netstack.go | 6 +- wgengine/userspace.go | 4 +- 58 files changed, 180 insertions(+), 180 deletions(-) rename tailfs/tailfs_clone.go => drive/drive_clone.go (98%) rename tailfs/tailfs_view.go => drive/drive_view.go (99%) rename {tailfs/tailfsimpl => drive/driveimpl}/birthtiming.go (98%) rename {tailfs/tailfsimpl => drive/driveimpl}/birthtiming_test.go (99%) rename {tailfs/tailfsimpl => drive/driveimpl}/compositedav/compositedav.go (98%) rename {tailfs/tailfsimpl => drive/driveimpl}/compositedav/propfind.go (97%) rename {tailfs/tailfsimpl => drive/driveimpl}/compositedav/stat_cache.go (100%) rename {tailfs/tailfsimpl => drive/driveimpl}/compositedav/stat_cache_test.go (100%) rename {tailfs/tailfsimpl => drive/driveimpl}/connlistener.go (98%) rename {tailfs/tailfsimpl => drive/driveimpl}/connlistener_test.go (98%) rename {tailfs/tailfsimpl => drive/driveimpl}/dirfs/dirfs.go (98%) rename {tailfs/tailfsimpl => drive/driveimpl}/dirfs/dirfs_test.go (99%) rename {tailfs/tailfsimpl => drive/driveimpl}/dirfs/mkdir.go (94%) rename {tailfs/tailfsimpl => drive/driveimpl}/dirfs/openfile.go (97%) rename {tailfs/tailfsimpl => drive/driveimpl}/dirfs/removeall.go (100%) rename {tailfs/tailfsimpl => drive/driveimpl}/dirfs/rename.go (100%) rename {tailfs/tailfsimpl => drive/driveimpl}/dirfs/stat.go (94%) rename tailfs/tailfsimpl/tailfs_test.go => drive/driveimpl/drive_test.go (93%) rename {tailfs/tailfsimpl => drive/driveimpl}/fileserver.go (98%) rename {tailfs/tailfsimpl => drive/driveimpl}/local_impl.go (90%) rename {tailfs/tailfsimpl => drive/driveimpl}/remote_impl.go (93%) rename {tailfs/tailfsimpl => drive/driveimpl}/shared/pathutil.go (100%) rename {tailfs/tailfsimpl => drive/driveimpl}/shared/pathutil_test.go (100%) rename {tailfs/tailfsimpl => drive/driveimpl}/shared/readonlydir.go (100%) rename {tailfs/tailfsimpl => drive/driveimpl}/shared/stat.go (100%) rename {tailfs => drive}/local.go (74%) rename {tailfs => drive}/remote.go (99%) rename {tailfs => drive}/remote_nonunix.go (96%) rename {tailfs => drive}/remote_permissions.go (98%) rename {tailfs => drive}/remote_permissions_test.go (98%) rename {tailfs => drive}/remote_unix.go (97%) rename ipn/ipnlocal/{tailfs.go => drive.go} (89%) rename ipn/ipnlocal/{tailfs_test.go => drive_test.go} (100%) diff --git a/client/tailscale/localclient.go b/client/tailscale/localclient.go index 644d5d87e..533f35330 100644 --- a/client/tailscale/localclient.go +++ b/client/tailscale/localclient.go @@ -28,6 +28,7 @@ import ( "go4.org/mem" "tailscale.com/client/tailscale/apitype" + "tailscale.com/drive" "tailscale.com/envknob" "tailscale.com/ipn" "tailscale.com/ipn/ipnstate" @@ -35,7 +36,6 @@ import ( "tailscale.com/paths" "tailscale.com/safesocket" "tailscale.com/tailcfg" - "tailscale.com/tailfs" "tailscale.com/tka" "tailscale.com/types/key" "tailscale.com/types/tkatype" @@ -1429,7 +1429,7 @@ func (lc *LocalClient) TailFSSetFileServerAddr(ctx context.Context, addr string) // TailFSShareSet adds or updates the given share in the list of shares that // TailFS will serve to remote nodes. If a share with the same name already // exists, the existing share is replaced/updated. -func (lc *LocalClient) TailFSShareSet(ctx context.Context, share *tailfs.Share) error { +func (lc *LocalClient) TailFSShareSet(ctx context.Context, share *drive.Share) error { _, err := lc.send(ctx, "PUT", "/localapi/v0/tailfs/shares", http.StatusCreated, jsonBody(share)) return err } @@ -1459,12 +1459,12 @@ func (lc *LocalClient) TailFSShareRename(ctx context.Context, oldName, newName s // TailFSShareList returns the list of shares that TailFS is currently serving // to remote nodes. -func (lc *LocalClient) TailFSShareList(ctx context.Context) ([]*tailfs.Share, error) { +func (lc *LocalClient) TailFSShareList(ctx context.Context) ([]*drive.Share, error) { result, err := lc.get200(ctx, "/localapi/v0/tailfs/shares") if err != nil { return nil, err } - var shares []*tailfs.Share + var shares []*drive.Share err = json.Unmarshal(result, &shares) return shares, err } diff --git a/client/tailscale/localclient_test.go b/client/tailscale/localclient_test.go index f55d33a37..a5f4e289f 100644 --- a/client/tailscale/localclient_test.go +++ b/client/tailscale/localclient_test.go @@ -34,9 +34,9 @@ func TestDeps(t *testing.T) { deptest.DepChecker{ BadDeps: map[string]string{ // Make sure we don't again accidentally bring in a dependency on - // TailFS or its transitive dependencies - "tailscale.com/tailfs/tailfsimpl": "https://github.com/tailscale/tailscale/pull/10631", - "github.com/studio-b12/gowebdav": "https://github.com/tailscale/tailscale/pull/10631", + // drive or its transitive dependencies + "tailscale.com/drive/driveimpl": "https://github.com/tailscale/tailscale/pull/10631", + "github.com/studio-b12/gowebdav": "https://github.com/tailscale/tailscale/pull/10631", }, }.Check(t) } diff --git a/cmd/derper/depaware.txt b/cmd/derper/depaware.txt index c3243ddbd..0b6df2561 100644 --- a/cmd/derper/depaware.txt +++ b/cmd/derper/depaware.txt @@ -86,6 +86,7 @@ tailscale.com/cmd/derper dependencies: (generated by github.com/tailscale/depawa tailscale.com/derp from tailscale.com/cmd/derper+ tailscale.com/derp/derphttp from tailscale.com/cmd/derper tailscale.com/disco from tailscale.com/derp + tailscale.com/drive from tailscale.com/client/tailscale+ tailscale.com/envknob from tailscale.com/client/tailscale+ tailscale.com/health from tailscale.com/net/tlsdial tailscale.com/hostinfo from tailscale.com/net/interfaces+ @@ -114,7 +115,6 @@ tailscale.com/cmd/derper dependencies: (generated by github.com/tailscale/depawa 💣 tailscale.com/safesocket from tailscale.com/client/tailscale tailscale.com/syncs from tailscale.com/cmd/derper+ tailscale.com/tailcfg from tailscale.com/client/tailscale+ - tailscale.com/tailfs from tailscale.com/client/tailscale+ tailscale.com/tka from tailscale.com/client/tailscale+ W tailscale.com/tsconst from tailscale.com/net/interfaces tailscale.com/tstime from tailscale.com/derp+ diff --git a/cmd/tailscale/cli/share.go b/cmd/tailscale/cli/share.go index b9481e2eb..fb2493fd6 100644 --- a/cmd/tailscale/cli/share.go +++ b/cmd/tailscale/cli/share.go @@ -10,7 +10,7 @@ import ( "strings" "github.com/peterbourgon/ff/v3/ffcli" - "tailscale.com/tailfs" + "tailscale.com/drive" ) const ( @@ -69,7 +69,7 @@ func runShareSet(ctx context.Context, args []string) error { name, path := args[0], args[1] - err := localClient.TailFSShareSet(ctx, &tailfs.Share{ + err := localClient.TailFSShareSet(ctx, &drive.Share{ Name: name, Path: path, }) @@ -145,7 +145,7 @@ func runShareList(ctx context.Context, args []string) error { func buildShareLongHelp() string { longHelpAs := "" - if tailfs.AllowShareAs() { + if drive.AllowShareAs() { longHelpAs = shareLongHelpAs } return fmt.Sprintf(shareLongHelpBase, longHelpAs) diff --git a/cmd/tailscale/depaware.txt b/cmd/tailscale/depaware.txt index f9abb56fb..24ca03520 100644 --- a/cmd/tailscale/depaware.txt +++ b/cmd/tailscale/depaware.txt @@ -84,6 +84,7 @@ tailscale.com/cmd/tailscale dependencies: (generated by github.com/tailscale/dep tailscale.com/derp from tailscale.com/derp/derphttp tailscale.com/derp/derphttp from tailscale.com/net/netcheck tailscale.com/disco from tailscale.com/derp + tailscale.com/drive from tailscale.com/client/tailscale+ tailscale.com/envknob from tailscale.com/client/tailscale+ tailscale.com/health from tailscale.com/net/tlsdial tailscale.com/health/healthmsg from tailscale.com/cmd/tailscale/cli @@ -118,7 +119,6 @@ tailscale.com/cmd/tailscale dependencies: (generated by github.com/tailscale/dep 💣 tailscale.com/safesocket from tailscale.com/client/tailscale+ tailscale.com/syncs from tailscale.com/cmd/tailscale/cli+ tailscale.com/tailcfg from tailscale.com/client/tailscale+ - tailscale.com/tailfs from tailscale.com/cmd/tailscale/cli+ tailscale.com/tka from tailscale.com/client/tailscale+ W tailscale.com/tsconst from tailscale.com/net/interfaces tailscale.com/tstime from tailscale.com/control/controlhttp+ diff --git a/cmd/tailscaled/depaware.txt b/cmd/tailscaled/depaware.txt index 71426e42a..83afbcd2e 100644 --- a/cmd/tailscaled/depaware.txt +++ b/cmd/tailscaled/depaware.txt @@ -88,7 +88,7 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de W github.com/dblohm7/wingoes/internal from github.com/dblohm7/wingoes/com W 💣 github.com/dblohm7/wingoes/pe from tailscale.com/util/osdiag+ LW 💣 github.com/digitalocean/go-smbios/smbios from tailscale.com/posture - 💣 github.com/djherbis/times from tailscale.com/tailfs/tailfsimpl + 💣 github.com/djherbis/times from tailscale.com/drive/driveimpl github.com/fxamacker/cbor/v2 from tailscale.com/tka github.com/gaissmai/bart from tailscale.com/net/tstun W 💣 github.com/go-ole/go-ole from github.com/go-ole/go-ole/oleutil+ @@ -111,7 +111,7 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de L github.com/insomniacslk/dhcp/iana from github.com/insomniacslk/dhcp/dhcpv4 L github.com/insomniacslk/dhcp/interfaces from github.com/insomniacslk/dhcp/dhcpv4 L github.com/insomniacslk/dhcp/rfc1035label from github.com/insomniacslk/dhcp/dhcpv4 - github.com/jellydator/ttlcache/v3 from tailscale.com/tailfs/tailfsimpl/compositedav + github.com/jellydator/ttlcache/v3 from tailscale.com/drive/driveimpl/compositedav L github.com/jmespath/go-jmespath from github.com/aws/aws-sdk-go-v2/service/ssm L github.com/josharian/native from github.com/mdlayher/netlink+ L 💣 github.com/jsimonetti/rtnetlink from tailscale.com/net/interfaces+ @@ -172,7 +172,7 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de github.com/tailscale/wireguard-go/rwcancel from github.com/tailscale/wireguard-go/device+ github.com/tailscale/wireguard-go/tai64n from github.com/tailscale/wireguard-go/device 💣 github.com/tailscale/wireguard-go/tun from github.com/tailscale/wireguard-go/device+ - github.com/tailscale/xnet/webdav from tailscale.com/tailfs/tailfsimpl+ + github.com/tailscale/xnet/webdav from tailscale.com/drive/driveimpl+ github.com/tailscale/xnet/webdav/internal/xml from github.com/tailscale/xnet/webdav github.com/tcnksm/go-httpstat from tailscale.com/net/netcheck LD github.com/u-root/u-root/pkg/termios from tailscale.com/ssh/tailssh @@ -251,6 +251,11 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de tailscale.com/doctor/ethtool from tailscale.com/ipn/ipnlocal 💣 tailscale.com/doctor/permissions from tailscale.com/ipn/ipnlocal tailscale.com/doctor/routetable from tailscale.com/ipn/ipnlocal + tailscale.com/drive from tailscale.com/client/tailscale+ + tailscale.com/drive/driveimpl from tailscale.com/cmd/tailscaled + tailscale.com/drive/driveimpl/compositedav from tailscale.com/drive/driveimpl + tailscale.com/drive/driveimpl/dirfs from tailscale.com/drive/driveimpl+ + tailscale.com/drive/driveimpl/shared from tailscale.com/drive/driveimpl+ tailscale.com/envknob from tailscale.com/client/tailscale+ tailscale.com/health from tailscale.com/control/controlclient+ tailscale.com/health/healthmsg from tailscale.com/ipn/ipnlocal @@ -320,11 +325,6 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de tailscale.com/syncs from tailscale.com/cmd/tailscaled+ tailscale.com/tailcfg from tailscale.com/client/tailscale+ tailscale.com/taildrop from tailscale.com/ipn/ipnlocal+ - tailscale.com/tailfs from tailscale.com/client/tailscale+ - tailscale.com/tailfs/tailfsimpl from tailscale.com/cmd/tailscaled - tailscale.com/tailfs/tailfsimpl/compositedav from tailscale.com/tailfs/tailfsimpl - tailscale.com/tailfs/tailfsimpl/dirfs from tailscale.com/tailfs/tailfsimpl+ - tailscale.com/tailfs/tailfsimpl/shared from tailscale.com/tailfs/tailfsimpl+ LD tailscale.com/tempfork/gliderlabs/ssh from tailscale.com/ssh/tailssh tailscale.com/tempfork/heap from tailscale.com/wgengine/magicsock tailscale.com/tka from tailscale.com/client/tailscale+ diff --git a/cmd/tailscaled/tailscaled.go b/cmd/tailscaled/tailscaled.go index 8c100f3be..6100c8125 100644 --- a/cmd/tailscaled/tailscaled.go +++ b/cmd/tailscaled/tailscaled.go @@ -33,6 +33,7 @@ import ( "tailscale.com/client/tailscale" "tailscale.com/cmd/tailscaled/childproc" "tailscale.com/control/controlclient" + "tailscale.com/drive/driveimpl" "tailscale.com/envknob" "tailscale.com/ipn/conffile" "tailscale.com/ipn/ipnlocal" @@ -52,7 +53,6 @@ import ( "tailscale.com/paths" "tailscale.com/safesocket" "tailscale.com/syncs" - "tailscale.com/tailfs/tailfsimpl" "tailscale.com/tsd" "tailscale.com/tsweb/varz" "tailscale.com/types/flagtype" @@ -407,7 +407,7 @@ func run() (err error) { debugMux = newDebugMux() } - sys.Set(tailfsimpl.NewFileSystemForRemote(logf)) + sys.Set(driveimpl.NewFileSystemForRemote(logf)) return startIPNServer(context.Background(), logf, pol.PublicID, sys) } @@ -650,7 +650,7 @@ func tryEngine(logf logger.Logf, sys *tsd.System, name string) (onlyNetstack boo Dialer: sys.Dialer.Get(), SetSubsystem: sys.Set, ControlKnobs: sys.ControlKnobs(), - TailFSForLocal: tailfsimpl.NewFileSystemForLocal(logf), + TailFSForLocal: driveimpl.NewFileSystemForLocal(logf), } onlyNetstack = name == "userspace-networking" @@ -847,7 +847,7 @@ func serveTailFS(args []string) error { if len(args)%2 != 0 { return errors.New("need pairs") } - s, err := tailfsimpl.NewFileServer() + s, err := driveimpl.NewFileServer() if err != nil { return fmt.Errorf("unable to start tailfs FileServer: %v", err) } diff --git a/cmd/tailscaled/tailscaled_windows.go b/cmd/tailscaled/tailscaled_windows.go index 8d1ac37a2..bf1973caa 100644 --- a/cmd/tailscaled/tailscaled_windows.go +++ b/cmd/tailscaled/tailscaled_windows.go @@ -42,13 +42,13 @@ import ( "golang.org/x/sys/windows/svc/eventlog" "golang.zx2c4.com/wintun" "golang.zx2c4.com/wireguard/windows/tunnel/winipcfg" + "tailscale.com/drive/driveimpl" "tailscale.com/envknob" "tailscale.com/logpolicy" "tailscale.com/logtail/backoff" "tailscale.com/net/dns" "tailscale.com/net/netmon" "tailscale.com/net/tstun" - "tailscale.com/tailfs/tailfsimpl" "tailscale.com/tsd" "tailscale.com/types/logger" "tailscale.com/types/logid" @@ -316,7 +316,7 @@ func beWindowsSubprocess() bool { } sys.Set(netMon) - sys.Set(tailfsimpl.NewFileSystemForRemote(log.Printf)) + sys.Set(driveimpl.NewFileSystemForRemote(log.Printf)) publicLogID, _ := logid.ParsePublicID(logID) err = startIPNServer(ctx, log.Printf, publicLogID, sys) diff --git a/tailfs/tailfs_clone.go b/drive/drive_clone.go similarity index 98% rename from tailfs/tailfs_clone.go rename to drive/drive_clone.go index a708c7bb7..927f3b81c 100644 --- a/tailfs/tailfs_clone.go +++ b/drive/drive_clone.go @@ -3,7 +3,7 @@ // Code generated by tailscale.com/cmd/cloner; DO NOT EDIT. -package tailfs +package drive // Clone makes a deep copy of Share. // The result aliases no memory with the original. diff --git a/tailfs/tailfs_view.go b/drive/drive_view.go similarity index 99% rename from tailfs/tailfs_view.go rename to drive/drive_view.go index 3d38f5072..a6adfbc70 100644 --- a/tailfs/tailfs_view.go +++ b/drive/drive_view.go @@ -3,7 +3,7 @@ // Code generated by tailscale/cmd/viewer; DO NOT EDIT. -package tailfs +package drive import ( "encoding/json" diff --git a/tailfs/tailfsimpl/birthtiming.go b/drive/driveimpl/birthtiming.go similarity index 98% rename from tailfs/tailfsimpl/birthtiming.go rename to drive/driveimpl/birthtiming.go index 8e7f8c965..d55ea0b83 100644 --- a/tailfs/tailfsimpl/birthtiming.go +++ b/drive/driveimpl/birthtiming.go @@ -1,7 +1,7 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause -package tailfsimpl +package driveimpl import ( "context" diff --git a/tailfs/tailfsimpl/birthtiming_test.go b/drive/driveimpl/birthtiming_test.go similarity index 99% rename from tailfs/tailfsimpl/birthtiming_test.go rename to drive/driveimpl/birthtiming_test.go index 7054c783b..a43ffa33d 100644 --- a/tailfs/tailfsimpl/birthtiming_test.go +++ b/drive/driveimpl/birthtiming_test.go @@ -5,7 +5,7 @@ //go:build windows || darwin -package tailfsimpl +package driveimpl import ( "context" diff --git a/tailfs/tailfsimpl/compositedav/compositedav.go b/drive/driveimpl/compositedav/compositedav.go similarity index 98% rename from tailfs/tailfsimpl/compositedav/compositedav.go rename to drive/driveimpl/compositedav/compositedav.go index 1cf507e8b..9bcba158e 100644 --- a/tailfs/tailfsimpl/compositedav/compositedav.go +++ b/drive/driveimpl/compositedav/compositedav.go @@ -17,8 +17,8 @@ import ( "sync" "github.com/tailscale/xnet/webdav" - "tailscale.com/tailfs/tailfsimpl/dirfs" - "tailscale.com/tailfs/tailfsimpl/shared" + "tailscale.com/drive/driveimpl/dirfs" + "tailscale.com/drive/driveimpl/shared" "tailscale.com/tstime" "tailscale.com/types/logger" ) diff --git a/tailfs/tailfsimpl/compositedav/propfind.go b/drive/driveimpl/compositedav/propfind.go similarity index 97% rename from tailfs/tailfsimpl/compositedav/propfind.go rename to drive/driveimpl/compositedav/propfind.go index 7a9a8075a..868a1d2b2 100644 --- a/tailfs/tailfsimpl/compositedav/propfind.go +++ b/drive/driveimpl/compositedav/propfind.go @@ -10,7 +10,7 @@ import ( "net/http" "regexp" - "tailscale.com/tailfs/tailfsimpl/shared" + "tailscale.com/drive/driveimpl/shared" ) var ( diff --git a/tailfs/tailfsimpl/compositedav/stat_cache.go b/drive/driveimpl/compositedav/stat_cache.go similarity index 100% rename from tailfs/tailfsimpl/compositedav/stat_cache.go rename to drive/driveimpl/compositedav/stat_cache.go diff --git a/tailfs/tailfsimpl/compositedav/stat_cache_test.go b/drive/driveimpl/compositedav/stat_cache_test.go similarity index 100% rename from tailfs/tailfsimpl/compositedav/stat_cache_test.go rename to drive/driveimpl/compositedav/stat_cache_test.go diff --git a/tailfs/tailfsimpl/connlistener.go b/drive/driveimpl/connlistener.go similarity index 98% rename from tailfs/tailfsimpl/connlistener.go rename to drive/driveimpl/connlistener.go index 6ddb1adab..e1fcb3b67 100644 --- a/tailfs/tailfsimpl/connlistener.go +++ b/drive/driveimpl/connlistener.go @@ -1,7 +1,7 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause -package tailfsimpl +package driveimpl import ( "log" diff --git a/tailfs/tailfsimpl/connlistener_test.go b/drive/driveimpl/connlistener_test.go similarity index 98% rename from tailfs/tailfsimpl/connlistener_test.go rename to drive/driveimpl/connlistener_test.go index 6267d837e..d8666448a 100644 --- a/tailfs/tailfsimpl/connlistener_test.go +++ b/drive/driveimpl/connlistener_test.go @@ -1,7 +1,7 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause -package tailfsimpl +package driveimpl import ( "log" diff --git a/tailfs/tailfsimpl/dirfs/dirfs.go b/drive/driveimpl/dirfs/dirfs.go similarity index 98% rename from tailfs/tailfsimpl/dirfs/dirfs.go rename to drive/driveimpl/dirfs/dirfs.go index 21017dfd9..c1f28bb9d 100644 --- a/tailfs/tailfsimpl/dirfs/dirfs.go +++ b/drive/driveimpl/dirfs/dirfs.go @@ -10,7 +10,7 @@ import ( "strings" "time" - "tailscale.com/tailfs/tailfsimpl/shared" + "tailscale.com/drive/driveimpl/shared" "tailscale.com/tstime" ) diff --git a/tailfs/tailfsimpl/dirfs/dirfs_test.go b/drive/driveimpl/dirfs/dirfs_test.go similarity index 99% rename from tailfs/tailfsimpl/dirfs/dirfs_test.go rename to drive/driveimpl/dirfs/dirfs_test.go index 9dd054da0..4d83765d9 100644 --- a/tailfs/tailfsimpl/dirfs/dirfs_test.go +++ b/drive/driveimpl/dirfs/dirfs_test.go @@ -15,7 +15,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/tailscale/xnet/webdav" - "tailscale.com/tailfs/tailfsimpl/shared" + "tailscale.com/drive/driveimpl/shared" "tailscale.com/tstest" ) diff --git a/tailfs/tailfsimpl/dirfs/mkdir.go b/drive/driveimpl/dirfs/mkdir.go similarity index 94% rename from tailfs/tailfsimpl/dirfs/mkdir.go rename to drive/driveimpl/dirfs/mkdir.go index 295033e80..2fb763dd5 100644 --- a/tailfs/tailfsimpl/dirfs/mkdir.go +++ b/drive/driveimpl/dirfs/mkdir.go @@ -7,7 +7,7 @@ import ( "context" "os" - "tailscale.com/tailfs/tailfsimpl/shared" + "tailscale.com/drive/driveimpl/shared" ) // Mkdir implements webdav.FileSystem. All attempts to Mkdir a directory that diff --git a/tailfs/tailfsimpl/dirfs/openfile.go b/drive/driveimpl/dirfs/openfile.go similarity index 97% rename from tailfs/tailfsimpl/dirfs/openfile.go rename to drive/driveimpl/dirfs/openfile.go index bd8dedd55..9b678719b 100644 --- a/tailfs/tailfsimpl/dirfs/openfile.go +++ b/drive/driveimpl/dirfs/openfile.go @@ -9,7 +9,7 @@ import ( "os" "github.com/tailscale/xnet/webdav" - "tailscale.com/tailfs/tailfsimpl/shared" + "tailscale.com/drive/driveimpl/shared" ) // OpenFile implements interface webdav.Filesystem. diff --git a/tailfs/tailfsimpl/dirfs/removeall.go b/drive/driveimpl/dirfs/removeall.go similarity index 100% rename from tailfs/tailfsimpl/dirfs/removeall.go rename to drive/driveimpl/dirfs/removeall.go diff --git a/tailfs/tailfsimpl/dirfs/rename.go b/drive/driveimpl/dirfs/rename.go similarity index 100% rename from tailfs/tailfsimpl/dirfs/rename.go rename to drive/driveimpl/dirfs/rename.go diff --git a/tailfs/tailfsimpl/dirfs/stat.go b/drive/driveimpl/dirfs/stat.go similarity index 94% rename from tailfs/tailfsimpl/dirfs/stat.go rename to drive/driveimpl/dirfs/stat.go index 5b51414a6..2e4243bed 100644 --- a/tailfs/tailfsimpl/dirfs/stat.go +++ b/drive/driveimpl/dirfs/stat.go @@ -8,7 +8,7 @@ import ( "io/fs" "os" - "tailscale.com/tailfs/tailfsimpl/shared" + "tailscale.com/drive/driveimpl/shared" ) // Stat implements webdav.FileSystem. diff --git a/tailfs/tailfsimpl/tailfs_test.go b/drive/driveimpl/drive_test.go similarity index 93% rename from tailfs/tailfsimpl/tailfs_test.go rename to drive/driveimpl/drive_test.go index 96b7b05a7..317c44c4f 100644 --- a/tailfs/tailfsimpl/tailfs_test.go +++ b/drive/driveimpl/drive_test.go @@ -1,7 +1,7 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause -package tailfsimpl +package driveimpl import ( "fmt" @@ -20,8 +20,8 @@ import ( "github.com/google/go-cmp/cmp" "github.com/studio-b12/gowebdav" - "tailscale.com/tailfs" - "tailscale.com/tailfs/tailfsimpl/shared" + "tailscale.com/drive" + "tailscale.com/drive/driveimpl/shared" "tailscale.com/tstest" ) @@ -38,7 +38,7 @@ const ( func init() { // set AllowShareAs() to false so that we don't try to use sub-processes // for access files on disk. - tailfs.DisallowShareAs = true + drive.DisallowShareAs = true } // The tests in this file simulate real-life TailFS scenarios, but without @@ -51,9 +51,9 @@ func TestDirectoryListing(t *testing.T) { s.checkDirList("domain should contain its only remote", shared.Join(domain), remote1) s.checkDirList("remote with no shares should be empty", shared.Join(domain, remote1)) - s.addShare(remote1, share11, tailfs.PermissionReadWrite) + s.addShare(remote1, share11, drive.PermissionReadWrite) s.checkDirList("remote with one share should contain that share", shared.Join(domain, remote1), share11) - s.addShare(remote1, share12, tailfs.PermissionReadOnly) + s.addShare(remote1, share12, drive.PermissionReadOnly) s.checkDirList("remote with two shares should contain both in lexicographical order", shared.Join(domain, remote1), share12, share11) s.writeFile("writing file to read/write remote should succeed", remote1, share11, file111, "hello world", true) s.checkDirList("remote share should contain file", shared.Join(domain, remote1, share11), file111) @@ -76,12 +76,12 @@ func TestFileManipulation(t *testing.T) { s := newSystem(t) s.addRemote(remote1) - s.addShare(remote1, share11, tailfs.PermissionReadWrite) + s.addShare(remote1, share11, drive.PermissionReadWrite) s.writeFile("writing file to read/write remote should succeed", remote1, share11, file111, "hello world", true) s.checkFileStatus(remote1, share11, file111) s.checkFileContents(remote1, share11, file111) - s.addShare(remote1, share12, tailfs.PermissionReadOnly) + s.addShare(remote1, share12, drive.PermissionReadOnly) s.writeFile("writing file to read-only remote should fail", remote1, share12, file111, "hello world", false) s.writeFile("writing file to non-existent remote should fail", "non-existent", share11, file111, "hello world", false) @@ -98,7 +98,7 @@ type remote struct { fs *FileSystemForRemote fileServer *FileServer shares map[string]string - permissions map[string]tailfs.Permission + permissions map[string]drive.Permission mu sync.RWMutex } @@ -175,15 +175,15 @@ func (s *system) addRemote(name string) { fileServer: fileServer, fs: NewFileSystemForRemote(log.Printf), shares: make(map[string]string), - permissions: make(map[string]tailfs.Permission), + permissions: make(map[string]drive.Permission), } r.fs.SetFileServerAddr(fileServer.Addr()) go http.Serve(l, r) s.remotes[name] = r - remotes := make([]*tailfs.Remote, 0, len(s.remotes)) + remotes := make([]*drive.Remote, 0, len(s.remotes)) for name, r := range s.remotes { - remotes = append(remotes, &tailfs.Remote{ + remotes = append(remotes, &drive.Remote{ Name: name, URL: fmt.Sprintf("http://%s", r.l.Addr()), }) @@ -197,7 +197,7 @@ func (s *system) addRemote(name string) { }) } -func (s *system) addShare(remoteName, shareName string, permission tailfs.Permission) { +func (s *system) addShare(remoteName, shareName string, permission drive.Permission) { r, ok := s.remotes[remoteName] if !ok { s.t.Fatalf("unknown remote %q", remoteName) @@ -207,14 +207,14 @@ func (s *system) addShare(remoteName, shareName string, permission tailfs.Permis r.shares[shareName] = f r.permissions[shareName] = permission - shares := make([]*tailfs.Share, 0, len(r.shares)) + shares := make([]*drive.Share, 0, len(r.shares)) for shareName, folder := range r.shares { - shares = append(shares, &tailfs.Share{ + shares = append(shares, &drive.Share{ Name: shareName, Path: folder, }) } - slices.SortFunc(shares, tailfs.CompareShares) + slices.SortFunc(shares, drive.CompareShares) r.fs.SetShares(shares) r.fileServer.SetShares(r.shares) } diff --git a/tailfs/tailfsimpl/fileserver.go b/drive/driveimpl/fileserver.go similarity index 98% rename from tailfs/tailfsimpl/fileserver.go rename to drive/driveimpl/fileserver.go index 73ea08b6c..d502a92c0 100644 --- a/tailfs/tailfsimpl/fileserver.go +++ b/drive/driveimpl/fileserver.go @@ -1,7 +1,7 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause -package tailfsimpl +package driveimpl import ( "net" @@ -9,7 +9,7 @@ import ( "sync" "github.com/tailscale/xnet/webdav" - "tailscale.com/tailfs/tailfsimpl/shared" + "tailscale.com/drive/driveimpl/shared" ) // FileServer is a standalone WebDAV server that dynamically serves up shares. diff --git a/tailfs/tailfsimpl/local_impl.go b/drive/driveimpl/local_impl.go similarity index 90% rename from tailfs/tailfsimpl/local_impl.go rename to drive/driveimpl/local_impl.go index 00ca25910..117f67bcd 100644 --- a/tailfs/tailfsimpl/local_impl.go +++ b/drive/driveimpl/local_impl.go @@ -1,8 +1,8 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause -// Package tailfsimpl provides an implementation of package tailfs. -package tailfsimpl +// Package driveimpl provides an implementation of package drive. +package driveimpl import ( "log" @@ -10,9 +10,9 @@ import ( "net/http" "time" - "tailscale.com/tailfs" - "tailscale.com/tailfs/tailfsimpl/compositedav" - "tailscale.com/tailfs/tailfsimpl/dirfs" + "tailscale.com/drive" + "tailscale.com/drive/driveimpl/compositedav" + "tailscale.com/drive/driveimpl/dirfs" "tailscale.com/types/logger" ) @@ -69,7 +69,7 @@ func (s *FileSystemForLocal) HandleConn(conn net.Conn, remoteAddr net.Addr) erro // SetRemotes sets the complete set of remotes on the given tailnet domain // using a map of name -> url. If transport is specified, that transport // will be used to connect to these remotes. -func (s *FileSystemForLocal) SetRemotes(domain string, remotes []*tailfs.Remote, transport http.RoundTripper) { +func (s *FileSystemForLocal) SetRemotes(domain string, remotes []*drive.Remote, transport http.RoundTripper) { children := make([]*compositedav.Child, 0, len(remotes)) for _, remote := range remotes { children = append(children, &compositedav.Child{ diff --git a/tailfs/tailfsimpl/remote_impl.go b/drive/driveimpl/remote_impl.go similarity index 93% rename from tailfs/tailfsimpl/remote_impl.go rename to drive/driveimpl/remote_impl.go index d5901b73f..0a9633f19 100644 --- a/tailfs/tailfsimpl/remote_impl.go +++ b/drive/driveimpl/remote_impl.go @@ -1,7 +1,7 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause -package tailfsimpl +package driveimpl import ( "bufio" @@ -23,11 +23,11 @@ import ( "time" "github.com/tailscale/xnet/webdav" + "tailscale.com/drive" + "tailscale.com/drive/driveimpl/compositedav" + "tailscale.com/drive/driveimpl/dirfs" + "tailscale.com/drive/driveimpl/shared" "tailscale.com/safesocket" - "tailscale.com/tailfs" - "tailscale.com/tailfs/tailfsimpl/compositedav" - "tailscale.com/tailfs/tailfsimpl/dirfs" - "tailscale.com/tailfs/tailfsimpl/shared" "tailscale.com/types/logger" ) @@ -53,7 +53,7 @@ type FileSystemForRemote struct { // them, acquire a read lock before reading any of them. mu sync.RWMutex fileServerAddr string - shares []*tailfs.Share + shares []*drive.Share children map[string]*compositedav.Child userServers map[string]*userServer } @@ -67,9 +67,9 @@ func (s *FileSystemForRemote) SetFileServerAddr(addr string) { // SetShares implements tailfs.FileSystemForRemote. Shares must be sorted // according to tailfs.CompareShares. -func (s *FileSystemForRemote) SetShares(shares []*tailfs.Share) { +func (s *FileSystemForRemote) SetShares(shares []*drive.Share) { userServers := make(map[string]*userServer) - if tailfs.AllowShareAs() { + if drive.AllowShareAs() { // Set up per-user server by running the current executable as an // unprivileged user in order to avoid privilege escalation. executable, err := os.Executable() @@ -112,7 +112,7 @@ func (s *FileSystemForRemote) SetShares(shares []*tailfs.Share) { s.closeChildren(oldChildren) } -func (s *FileSystemForRemote) buildChild(share *tailfs.Share) *compositedav.Child { +func (s *FileSystemForRemote) buildChild(share *drive.Share) *compositedav.Child { return &compositedav.Child{ Child: &dirfs.Child{ Name: share.Name, @@ -133,8 +133,8 @@ func (s *FileSystemForRemote) buildChild(share *tailfs.Share) *compositedav.Chil shareName := string(shareNameBytes) s.mu.RLock() - var share *tailfs.Share - i, shareFound := slices.BinarySearchFunc(s.shares, shareName, func(s *tailfs.Share, name string) int { + var share *drive.Share + i, shareFound := slices.BinarySearchFunc(s.shares, shareName, func(s *drive.Share, name string) int { return strings.Compare(s.Name, name) }) if shareFound { @@ -149,7 +149,7 @@ func (s *FileSystemForRemote) buildChild(share *tailfs.Share) *compositedav.Chil } var addr string - if !tailfs.AllowShareAs() { + if !drive.AllowShareAs() { addr = fileServerAddr } else { userServer, found := userServers[share.As] @@ -177,17 +177,17 @@ func (s *FileSystemForRemote) buildChild(share *tailfs.Share) *compositedav.Chil } // ServeHTTPWithPerms implements tailfs.FileSystemForRemote. -func (s *FileSystemForRemote) ServeHTTPWithPerms(permissions tailfs.Permissions, w http.ResponseWriter, r *http.Request) { +func (s *FileSystemForRemote) ServeHTTPWithPerms(permissions drive.Permissions, w http.ResponseWriter, r *http.Request) { isWrite := writeMethods[r.Method] if isWrite { share := shared.CleanAndSplit(r.URL.Path)[0] switch permissions.For(share) { - case tailfs.PermissionNone: + case drive.PermissionNone: // If we have no permissions to this share, treat it as not found // to avoid leaking any information about the share's existence. http.Error(w, "not found", http.StatusNotFound) return - case tailfs.PermissionReadOnly: + case drive.PermissionReadOnly: http.Error(w, "permission denied", http.StatusForbidden) return } @@ -200,7 +200,7 @@ func (s *FileSystemForRemote) ServeHTTPWithPerms(permissions tailfs.Permissions, children := make([]*compositedav.Child, 0, len(childrenMap)) // filter out shares to which the connecting principal has no access for name, child := range childrenMap { - if permissions.For(name) == tailfs.PermissionNone { + if permissions.For(name) == drive.PermissionNone { continue } @@ -247,7 +247,7 @@ func (s *FileSystemForRemote) Close() error { // content is served as that Share.As user. type userServer struct { logf logger.Logf - shares []*tailfs.Share + shares []*drive.Share username string executable string diff --git a/tailfs/tailfsimpl/shared/pathutil.go b/drive/driveimpl/shared/pathutil.go similarity index 100% rename from tailfs/tailfsimpl/shared/pathutil.go rename to drive/driveimpl/shared/pathutil.go diff --git a/tailfs/tailfsimpl/shared/pathutil_test.go b/drive/driveimpl/shared/pathutil_test.go similarity index 100% rename from tailfs/tailfsimpl/shared/pathutil_test.go rename to drive/driveimpl/shared/pathutil_test.go diff --git a/tailfs/tailfsimpl/shared/readonlydir.go b/drive/driveimpl/shared/readonlydir.go similarity index 100% rename from tailfs/tailfsimpl/shared/readonlydir.go rename to drive/driveimpl/shared/readonlydir.go diff --git a/tailfs/tailfsimpl/shared/stat.go b/drive/driveimpl/shared/stat.go similarity index 100% rename from tailfs/tailfsimpl/shared/stat.go rename to drive/driveimpl/shared/stat.go diff --git a/tailfs/local.go b/drive/local.go similarity index 74% rename from tailfs/local.go rename to drive/local.go index 67f0c3fe5..b6a83dd09 100644 --- a/tailfs/local.go +++ b/drive/local.go @@ -1,13 +1,13 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause -// Package tailfs provides a filesystem that allows sharing folders between -// Tailscale nodes using WebDAV. The actual implementation of the core TailFS -// functionality lives in package tailfsimpl. These packages are separated to -// allow users of tailfs to refer to the interfaces without having a hard -// dependency on tailfs, so that programs which don't actually use tailfs can +// Package drive provides a filesystem that allows sharing folders between +// Tailscale nodes using WebDAV. The actual implementation of the core drive +// functionality lives in package driveimpl. These packages are separated to +// allow users of drive to refer to the interfaces without having a hard +// dependency on drive, so that programs which don't actually use drive can // avoid its transitive dependencies. -package tailfs +package drive import ( "net" diff --git a/tailfs/remote.go b/drive/remote.go similarity index 99% rename from tailfs/remote.go rename to drive/remote.go index 42c5b22b7..083c7a8a2 100644 --- a/tailfs/remote.go +++ b/drive/remote.go @@ -1,7 +1,7 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause -package tailfs +package drive //go:generate go run tailscale.com/cmd/viewer --type=Share --clonefunc diff --git a/tailfs/remote_nonunix.go b/drive/remote_nonunix.go similarity index 96% rename from tailfs/remote_nonunix.go rename to drive/remote_nonunix.go index 5eb32f557..d1153c592 100644 --- a/tailfs/remote_nonunix.go +++ b/drive/remote_nonunix.go @@ -3,7 +3,7 @@ //go:build !unix -package tailfs +package drive func doAllowShareAs() bool { // On non-UNIX platforms, we use the GUI application (e.g. Windows taskbar diff --git a/tailfs/remote_permissions.go b/drive/remote_permissions.go similarity index 98% rename from tailfs/remote_permissions.go rename to drive/remote_permissions.go index 701fdbaee..2188ea3c6 100644 --- a/tailfs/remote_permissions.go +++ b/drive/remote_permissions.go @@ -1,7 +1,7 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause -package tailfs +package drive import ( "encoding/json" diff --git a/tailfs/remote_permissions_test.go b/drive/remote_permissions_test.go similarity index 98% rename from tailfs/remote_permissions_test.go rename to drive/remote_permissions_test.go index 68d012c19..ff039c800 100644 --- a/tailfs/remote_permissions_test.go +++ b/drive/remote_permissions_test.go @@ -1,7 +1,7 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause -package tailfs +package drive import ( "encoding/json" diff --git a/tailfs/remote_unix.go b/drive/remote_unix.go similarity index 97% rename from tailfs/remote_unix.go rename to drive/remote_unix.go index ed172e8be..0e41524db 100644 --- a/tailfs/remote_unix.go +++ b/drive/remote_unix.go @@ -3,7 +3,7 @@ //go:build unix -package tailfs +package drive import "tailscale.com/version" diff --git a/ipn/backend.go b/ipn/backend.go index c4c64b9ee..da7fb6f28 100644 --- a/ipn/backend.go +++ b/ipn/backend.go @@ -8,9 +8,9 @@ import ( "strings" "time" + "tailscale.com/drive" "tailscale.com/ipn/ipnstate" "tailscale.com/tailcfg" - "tailscale.com/tailfs" "tailscale.com/types/empty" "tailscale.com/types/key" "tailscale.com/types/netmap" @@ -136,7 +136,7 @@ type Notify struct { // the identity of the unprivileged user that is running the application. A // nil value here means that we're not broadcasting shares information, an // empty value means that there are no shares. - TailFSShares views.SliceView[*tailfs.Share, tailfs.ShareView] + TailFSShares views.SliceView[*drive.Share, drive.ShareView] // type is mirrored in xcode/Shared/IPN.swift } diff --git a/ipn/ipn_clone.go b/ipn/ipn_clone.go index e448bd065..a08530fad 100644 --- a/ipn/ipn_clone.go +++ b/ipn/ipn_clone.go @@ -9,8 +9,8 @@ import ( "maps" "net/netip" + "tailscale.com/drive" "tailscale.com/tailcfg" - "tailscale.com/tailfs" "tailscale.com/types/persist" "tailscale.com/types/preftype" ) @@ -26,7 +26,7 @@ func (src *Prefs) Clone() *Prefs { dst.AdvertiseTags = append(src.AdvertiseTags[:0:0], src.AdvertiseTags...) dst.AdvertiseRoutes = append(src.AdvertiseRoutes[:0:0], src.AdvertiseRoutes...) if src.TailFSShares != nil { - dst.TailFSShares = make([]*tailfs.Share, len(src.TailFSShares)) + dst.TailFSShares = make([]*drive.Share, len(src.TailFSShares)) for i := range dst.TailFSShares { dst.TailFSShares[i] = src.TailFSShares[i].Clone() } @@ -63,7 +63,7 @@ var _PrefsCloneNeedsRegeneration = Prefs(struct { AppConnector AppConnectorPrefs PostureChecking bool NetfilterKind string - TailFSShares []*tailfs.Share + TailFSShares []*drive.Share Persist *persist.Persist }{}) diff --git a/ipn/ipn_view.go b/ipn/ipn_view.go index b156e37ef..df3409c35 100644 --- a/ipn/ipn_view.go +++ b/ipn/ipn_view.go @@ -10,8 +10,8 @@ import ( "errors" "net/netip" + "tailscale.com/drive" "tailscale.com/tailcfg" - "tailscale.com/tailfs" "tailscale.com/types/persist" "tailscale.com/types/preftype" "tailscale.com/types/views" @@ -92,8 +92,8 @@ func (v PrefsView) AutoUpdate() AutoUpdatePrefs { return v.ж.AutoUpda func (v PrefsView) AppConnector() AppConnectorPrefs { return v.ж.AppConnector } func (v PrefsView) PostureChecking() bool { return v.ж.PostureChecking } func (v PrefsView) NetfilterKind() string { return v.ж.NetfilterKind } -func (v PrefsView) TailFSShares() views.SliceView[*tailfs.Share, tailfs.ShareView] { - return views.SliceOfViews[*tailfs.Share, tailfs.ShareView](v.ж.TailFSShares) +func (v PrefsView) TailFSShares() views.SliceView[*drive.Share, drive.ShareView] { + return views.SliceOfViews[*drive.Share, drive.ShareView](v.ж.TailFSShares) } func (v PrefsView) Persist() persist.PersistView { return v.ж.Persist.View() } @@ -125,7 +125,7 @@ var _PrefsViewNeedsRegeneration = Prefs(struct { AppConnector AppConnectorPrefs PostureChecking bool NetfilterKind string - TailFSShares []*tailfs.Share + TailFSShares []*drive.Share Persist *persist.Persist }{}) diff --git a/ipn/ipnlocal/tailfs.go b/ipn/ipnlocal/drive.go similarity index 89% rename from ipn/ipnlocal/tailfs.go rename to ipn/ipnlocal/drive.go index 4fd1b95af..a065513ef 100644 --- a/ipn/ipnlocal/tailfs.go +++ b/ipn/ipnlocal/drive.go @@ -11,9 +11,9 @@ import ( "slices" "strings" + "tailscale.com/drive" "tailscale.com/ipn" "tailscale.com/tailcfg" - "tailscale.com/tailfs" "tailscale.com/types/netmap" "tailscale.com/types/views" ) @@ -73,7 +73,7 @@ func (b *LocalBackend) TailFSSetFileServerAddr(addr string) error { // replaces the existing share if one with the same name already exists. To // avoid potential incompatibilities across file systems, share names are // limited to alphanumeric characters and the underscore _. -func (b *LocalBackend) TailFSSetShare(share *tailfs.Share) error { +func (b *LocalBackend) TailFSSetShare(share *drive.Share) error { var err error share.Name, err = normalizeShareName(share.Name) if err != nil { @@ -108,7 +108,7 @@ func normalizeShareName(name string) (string, error) { return name, nil } -func (b *LocalBackend) tailFSSetShareLocked(share *tailfs.Share) (views.SliceView[*tailfs.Share, tailfs.ShareView], error) { +func (b *LocalBackend) tailFSSetShareLocked(share *drive.Share) (views.SliceView[*drive.Share, drive.ShareView], error) { existingShares := b.pm.prefs.TailFSShares() fs, ok := b.sys.TailFSForRemote.GetOK() @@ -117,7 +117,7 @@ func (b *LocalBackend) tailFSSetShareLocked(share *tailfs.Share) (views.SliceVie } addedShare := false - var shares []*tailfs.Share + var shares []*drive.Share for i := 0; i < existingShares.Len(); i++ { existing := existingShares.At(i) if existing.Name() != share.Name { @@ -167,7 +167,7 @@ func (b *LocalBackend) TailFSRenameShare(oldName, newName string) error { return nil } -func (b *LocalBackend) tailFSRenameShareLocked(oldName, newName string) (views.SliceView[*tailfs.Share, tailfs.ShareView], error) { +func (b *LocalBackend) tailFSRenameShareLocked(oldName, newName string) (views.SliceView[*drive.Share, drive.ShareView], error) { existingShares := b.pm.prefs.TailFSShares() fs, ok := b.sys.TailFSForRemote.GetOK() @@ -176,7 +176,7 @@ func (b *LocalBackend) tailFSRenameShareLocked(oldName, newName string) (views.S } found := false - var shares []*tailfs.Share + var shares []*drive.Share for i := 0; i < existingShares.Len(); i++ { existing := existingShares.At(i) if existing.Name() == newName { @@ -196,7 +196,7 @@ func (b *LocalBackend) tailFSRenameShareLocked(oldName, newName string) (views.S return existingShares, os.ErrNotExist } - slices.SortFunc(shares, tailfs.CompareShares) + slices.SortFunc(shares, drive.CompareShares) err := b.tailFSSetSharesLocked(shares) if err != nil { return existingShares, err @@ -228,7 +228,7 @@ func (b *LocalBackend) TailFSRemoveShare(name string) error { return nil } -func (b *LocalBackend) tailFSRemoveShareLocked(name string) (views.SliceView[*tailfs.Share, tailfs.ShareView], error) { +func (b *LocalBackend) tailFSRemoveShareLocked(name string) (views.SliceView[*drive.Share, drive.ShareView], error) { existingShares := b.pm.prefs.TailFSShares() fs, ok := b.sys.TailFSForRemote.GetOK() @@ -237,7 +237,7 @@ func (b *LocalBackend) tailFSRemoveShareLocked(name string) (views.SliceView[*ta } found := false - var shares []*tailfs.Share + var shares []*drive.Share for i := 0; i < existingShares.Len(); i++ { existing := existingShares.At(i) if existing.Name() != name { @@ -260,7 +260,7 @@ func (b *LocalBackend) tailFSRemoveShareLocked(name string) (views.SliceView[*ta return b.pm.prefs.TailFSShares(), nil } -func (b *LocalBackend) tailFSSetSharesLocked(shares []*tailfs.Share) error { +func (b *LocalBackend) tailFSSetSharesLocked(shares []*drive.Share) error { prefs := b.pm.prefs.AsStruct() prefs.ApplyEdits(&ipn.MaskedPrefs{ Prefs: ipn.Prefs{ @@ -273,10 +273,10 @@ func (b *LocalBackend) tailFSSetSharesLocked(shares []*tailfs.Share) error { // tailFSNotifyShares notifies IPN bus listeners (e.g. Mac Application process) // about the latest list of shares. -func (b *LocalBackend) tailFSNotifyShares(shares views.SliceView[*tailfs.Share, tailfs.ShareView]) { +func (b *LocalBackend) tailFSNotifyShares(shares views.SliceView[*drive.Share, drive.ShareView]) { // Ensures shares is not nil to distinguish "no shares" from "not notifying shares" if shares.IsNil() { - shares = views.SliceOfViews(make([]*tailfs.Share, 0)) + shares = views.SliceOfViews(make([]*drive.Share, 0)) } b.send(ipn.Notify{TailFSShares: shares}) } @@ -284,7 +284,7 @@ func (b *LocalBackend) tailFSNotifyShares(shares views.SliceView[*tailfs.Share, // tailFSNotifyCurrentSharesLocked sends an ipn.Notify if the current set of // shares has changed since the last notification. func (b *LocalBackend) tailFSNotifyCurrentSharesLocked() { - var shares views.SliceView[*tailfs.Share, tailfs.ShareView] + var shares views.SliceView[*drive.Share, drive.ShareView] if b.tailFSSharingEnabledLocked() { // Only populate shares if sharing is enabled. shares = b.pm.prefs.TailFSShares() @@ -297,7 +297,7 @@ func (b *LocalBackend) tailFSNotifyCurrentSharesLocked() { } } -func tailFSShareViewsEqual(a *views.SliceView[*tailfs.Share, tailfs.ShareView], b views.SliceView[*tailfs.Share, tailfs.ShareView]) bool { +func tailFSShareViewsEqual(a *views.SliceView[*drive.Share, drive.ShareView], b views.SliceView[*drive.Share, drive.ShareView]) bool { if a == nil { return false } @@ -307,7 +307,7 @@ func tailFSShareViewsEqual(a *views.SliceView[*tailfs.Share, tailfs.ShareView], } for i := 0; i < a.Len(); i++ { - if !tailfs.ShareViewsEqual(a.At(i), b.At(i)) { + if !drive.ShareViewsEqual(a.At(i), b.At(i)) { return false } } @@ -316,7 +316,7 @@ func tailFSShareViewsEqual(a *views.SliceView[*tailfs.Share, tailfs.ShareView], } // TailFSGetShares() gets the current list of TailFS shares, sorted by name. -func (b *LocalBackend) TailFSGetShares() views.SliceView[*tailfs.Share, tailfs.ShareView] { +func (b *LocalBackend) TailFSGetShares() views.SliceView[*drive.Share, drive.ShareView] { b.mu.Lock() defer b.mu.Unlock() @@ -331,7 +331,7 @@ func (b *LocalBackend) updateTailFSPeersLocked(nm *netmap.NetworkMap) { return } - var tailFSRemotes []*tailfs.Remote + var tailFSRemotes []*drive.Remote if b.tailFSAccessEnabledLocked() { // Only populate peers if access is enabled, otherwise leave blank. tailFSRemotes = b.tailFSRemotesFromPeers(nm) @@ -340,8 +340,8 @@ func (b *LocalBackend) updateTailFSPeersLocked(nm *netmap.NetworkMap) { fs.SetRemotes(b.netMap.Domain, tailFSRemotes, &tailFSTransport{b: b}) } -func (b *LocalBackend) tailFSRemotesFromPeers(nm *netmap.NetworkMap) []*tailfs.Remote { - tailFSRemotes := make([]*tailfs.Remote, 0, len(nm.Peers)) +func (b *LocalBackend) tailFSRemotesFromPeers(nm *netmap.NetworkMap) []*drive.Remote { + tailFSRemotes := make([]*drive.Remote, 0, len(nm.Peers)) for _, p := range nm.Peers { // Exclude mullvad exit nodes from list of TailFS peers // TODO(oxtoacart) - once we have a better mechanism for finding only accessible sharers @@ -352,7 +352,7 @@ func (b *LocalBackend) tailFSRemotesFromPeers(nm *netmap.NetworkMap) []*tailfs.R peerID := p.ID() url := fmt.Sprintf("%s/%s", peerAPIBase(nm, p), tailFSPrefix[1:]) - tailFSRemotes = append(tailFSRemotes, &tailfs.Remote{ + tailFSRemotes = append(tailFSRemotes, &drive.Remote{ Name: p.DisplayName(false), URL: url, Available: func() bool { diff --git a/ipn/ipnlocal/tailfs_test.go b/ipn/ipnlocal/drive_test.go similarity index 100% rename from ipn/ipnlocal/tailfs_test.go rename to ipn/ipnlocal/drive_test.go diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go index 77982eb31..b954afffc 100644 --- a/ipn/ipnlocal/local.go +++ b/ipn/ipnlocal/local.go @@ -43,6 +43,7 @@ import ( "tailscale.com/doctor/ethtool" "tailscale.com/doctor/permissions" "tailscale.com/doctor/routetable" + "tailscale.com/drive" "tailscale.com/envknob" "tailscale.com/health" "tailscale.com/health/healthmsg" @@ -69,7 +70,6 @@ import ( "tailscale.com/syncs" "tailscale.com/tailcfg" "tailscale.com/taildrop" - "tailscale.com/tailfs" "tailscale.com/tka" "tailscale.com/tsd" "tailscale.com/tstime" @@ -318,7 +318,7 @@ type LocalBackend struct { // lastNotifiedTailFSShares keeps track of the last set of shares that we // notified about. - lastNotifiedTailFSShares atomic.Pointer[views.SliceView[*tailfs.Share, tailfs.ShareView]] + lastNotifiedTailFSShares atomic.Pointer[views.SliceView[*drive.Share, drive.ShareView]] // outgoingFiles keeps track of Taildrop outgoing files keyed to their OutgoingFile.ID outgoingFiles map[string]*ipn.OutgoingFile @@ -447,7 +447,7 @@ func NewLocalBackend(logf logger.Logf, logID logid.PublicID, sys *tsd.System, lo if ok { currentShares := b.pm.prefs.TailFSShares() if currentShares.Len() > 0 { - var shares []*tailfs.Share + var shares []*drive.Share for i := 0; i < currentShares.Len(); i++ { shares = append(shares, currentShares.At(i).AsStruct()) } diff --git a/ipn/ipnlocal/local_test.go b/ipn/ipnlocal/local_test.go index 8906bf939..2713fff7d 100644 --- a/ipn/ipnlocal/local_test.go +++ b/ipn/ipnlocal/local_test.go @@ -24,13 +24,13 @@ import ( "tailscale.com/appc" "tailscale.com/appc/appctest" "tailscale.com/control/controlclient" + "tailscale.com/drive" + "tailscale.com/drive/driveimpl" "tailscale.com/ipn" "tailscale.com/ipn/store/mem" "tailscale.com/net/interfaces" "tailscale.com/net/tsaddr" "tailscale.com/tailcfg" - "tailscale.com/tailfs" - "tailscale.com/tailfs/tailfsimpl" "tailscale.com/tsd" "tailscale.com/tstest" "tailscale.com/types/dnstype" @@ -2250,20 +2250,20 @@ func TestTailFSManageShares(t *testing.T) { tests := []struct { name string disabled bool - existing []*tailfs.Share - add *tailfs.Share + existing []*drive.Share + add *drive.Share remove string rename [2]string expect any }{ { name: "append", - existing: []*tailfs.Share{ + existing: []*drive.Share{ {Name: "b"}, {Name: "d"}, }, - add: &tailfs.Share{Name: " E "}, - expect: []*tailfs.Share{ + add: &drive.Share{Name: " E "}, + expect: []*drive.Share{ {Name: "b"}, {Name: "d"}, {Name: "e"}, @@ -2271,12 +2271,12 @@ func TestTailFSManageShares(t *testing.T) { }, { name: "prepend", - existing: []*tailfs.Share{ + existing: []*drive.Share{ {Name: "b"}, {Name: "d"}, }, - add: &tailfs.Share{Name: " A "}, - expect: []*tailfs.Share{ + add: &drive.Share{Name: " A "}, + expect: []*drive.Share{ {Name: "a"}, {Name: "b"}, {Name: "d"}, @@ -2284,12 +2284,12 @@ func TestTailFSManageShares(t *testing.T) { }, { name: "insert", - existing: []*tailfs.Share{ + existing: []*drive.Share{ {Name: "b"}, {Name: "d"}, }, - add: &tailfs.Share{Name: " C "}, - expect: []*tailfs.Share{ + add: &drive.Share{Name: " C "}, + expect: []*drive.Share{ {Name: "b"}, {Name: "c"}, {Name: "d"}, @@ -2297,43 +2297,43 @@ func TestTailFSManageShares(t *testing.T) { }, { name: "replace", - existing: []*tailfs.Share{ + existing: []*drive.Share{ {Name: "b", Path: "i"}, {Name: "d"}, }, - add: &tailfs.Share{Name: " B ", Path: "ii"}, - expect: []*tailfs.Share{ + add: &drive.Share{Name: " B ", Path: "ii"}, + expect: []*drive.Share{ {Name: "b", Path: "ii"}, {Name: "d"}, }, }, { name: "add_bad_name", - add: &tailfs.Share{Name: "$"}, + add: &drive.Share{Name: "$"}, expect: ErrInvalidShareName, }, { name: "add_disabled", disabled: true, - add: &tailfs.Share{Name: "a"}, + add: &drive.Share{Name: "a"}, expect: ErrTailFSNotEnabled, }, { name: "remove", - existing: []*tailfs.Share{ + existing: []*drive.Share{ {Name: "a"}, {Name: "b"}, {Name: "c"}, }, remove: "b", - expect: []*tailfs.Share{ + expect: []*drive.Share{ {Name: "a"}, {Name: "c"}, }, }, { name: "remove_non_existing", - existing: []*tailfs.Share{ + existing: []*drive.Share{ {Name: "a"}, {Name: "b"}, {Name: "c"}, @@ -2349,19 +2349,19 @@ func TestTailFSManageShares(t *testing.T) { }, { name: "rename", - existing: []*tailfs.Share{ + existing: []*drive.Share{ {Name: "a"}, {Name: "b"}, }, rename: [2]string{"a", " C "}, - expect: []*tailfs.Share{ + expect: []*drive.Share{ {Name: "b"}, {Name: "c"}, }, }, { name: "rename_not_exist", - existing: []*tailfs.Share{ + existing: []*drive.Share{ {Name: "a"}, {Name: "b"}, }, @@ -2370,7 +2370,7 @@ func TestTailFSManageShares(t *testing.T) { }, { name: "rename_exists", - existing: []*tailfs.Share{ + existing: []*drive.Share{ {Name: "a"}, {Name: "b"}, }, @@ -2390,9 +2390,9 @@ func TestTailFSManageShares(t *testing.T) { }, } - tailfs.DisallowShareAs = true + drive.DisallowShareAs = true t.Cleanup(func() { - tailfs.DisallowShareAs = false + drive.DisallowShareAs = false }) for _, tt := range tests { @@ -2406,14 +2406,14 @@ func TestTailFSManageShares(t *testing.T) { self := b.netMap.SelfNode.AsStruct() self.CapMap = tailcfg.NodeCapMap{tailcfg.NodeAttrsTailFSShare: nil} b.netMap.SelfNode = self.View() - b.sys.Set(tailfsimpl.NewFileSystemForRemote(b.logf)) + b.sys.Set(driveimpl.NewFileSystemForRemote(b.logf)) } b.mu.Unlock() ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) t.Cleanup(cancel) - result := make(chan views.SliceView[*tailfs.Share, tailfs.ShareView], 1) + result := make(chan views.SliceView[*drive.Share, drive.ShareView], 1) var wg sync.WaitGroup wg.Add(1) @@ -2447,7 +2447,7 @@ func TestTailFSManageShares(t *testing.T) { if !errors.Is(err, e) { t.Errorf("expected error, want: %v got: %v", e, err) } - case []*tailfs.Share: + case []*drive.Share: if err != nil { t.Errorf("unexpected error: %v", err) } else { diff --git a/ipn/ipnlocal/peerapi.go b/ipn/ipnlocal/peerapi.go index 6843292b2..4fffe76c5 100644 --- a/ipn/ipnlocal/peerapi.go +++ b/ipn/ipnlocal/peerapi.go @@ -29,6 +29,7 @@ import ( "github.com/kortschak/wol" "golang.org/x/net/dns/dnsmessage" "golang.org/x/net/http/httpguts" + "tailscale.com/drive" "tailscale.com/envknob" "tailscale.com/health" "tailscale.com/hostinfo" @@ -39,7 +40,6 @@ import ( "tailscale.com/net/sockstats" "tailscale.com/tailcfg" "tailscale.com/taildrop" - "tailscale.com/tailfs" "tailscale.com/types/views" "tailscale.com/util/clientmetric" "tailscale.com/util/httphdr" @@ -1161,7 +1161,7 @@ func (h *peerAPIHandler) handleServeTailFS(w http.ResponseWriter, r *http.Reques rawPerms = append(rawPerms, []byte(cap)) } - p, err := tailfs.ParsePermissions(rawPerms) + p, err := drive.ParsePermissions(rawPerms) if err != nil { h.logf("tailfs: error parsing permissions: %w", err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) diff --git a/ipn/localapi/localapi.go b/ipn/localapi/localapi.go index 53e5770f1..a10668a18 100644 --- a/ipn/localapi/localapi.go +++ b/ipn/localapi/localapi.go @@ -34,6 +34,7 @@ import ( "github.com/google/uuid" "tailscale.com/client/tailscale/apitype" "tailscale.com/clientupdate" + "tailscale.com/drive" "tailscale.com/envknob" "tailscale.com/health" "tailscale.com/hostinfo" @@ -47,7 +48,6 @@ import ( "tailscale.com/net/portmapper" "tailscale.com/tailcfg" "tailscale.com/taildrop" - "tailscale.com/tailfs" "tailscale.com/tka" "tailscale.com/tstime" "tailscale.com/types/key" @@ -2765,7 +2765,7 @@ func (h *Handler) serveShares(w http.ResponseWriter, r *http.Request) { } switch r.Method { case "PUT": - var share tailfs.Share + var share drive.Share err := json.NewDecoder(r.Body).Decode(&share) if err != nil { http.Error(w, err.Error(), http.StatusBadRequest) @@ -2781,7 +2781,7 @@ func (h *Handler) serveShares(w http.ResponseWriter, r *http.Request) { http.Error(w, "not a directory", http.StatusBadRequest) return } - if tailfs.AllowShareAs() { + if drive.AllowShareAs() { // share as the connected user username, err := h.getUsername() if err != nil { diff --git a/ipn/prefs.go b/ipn/prefs.go index 0055b7fb2..266cd9dda 100644 --- a/ipn/prefs.go +++ b/ipn/prefs.go @@ -18,11 +18,11 @@ import ( "strings" "tailscale.com/atomicfile" + "tailscale.com/drive" "tailscale.com/ipn/ipnstate" "tailscale.com/net/netaddr" "tailscale.com/net/tsaddr" "tailscale.com/tailcfg" - "tailscale.com/tailfs" "tailscale.com/types/opt" "tailscale.com/types/persist" "tailscale.com/types/preftype" @@ -227,7 +227,7 @@ type Prefs struct { // TailFSShares are the configured TailFSShares, stored in increasing order // by name. - TailFSShares []*tailfs.Share + TailFSShares []*drive.Share // The Persist field is named 'Config' in the file for backward // compatibility with earlier versions. @@ -564,7 +564,7 @@ func (p *Prefs) Equals(p2 *Prefs) bool { p.AutoUpdate.Equals(p2.AutoUpdate) && p.AppConnector == p2.AppConnector && p.PostureChecking == p2.PostureChecking && - slices.EqualFunc(p.TailFSShares, p2.TailFSShares, tailfs.SharesEqual) && + slices.EqualFunc(p.TailFSShares, p2.TailFSShares, drive.SharesEqual) && p.NetfilterKind == p2.NetfilterKind } diff --git a/tailcfg/tailcfg_test.go b/tailcfg/tailcfg_test.go index 9934f3e52..2940084d7 100644 --- a/tailcfg/tailcfg_test.go +++ b/tailcfg/tailcfg_test.go @@ -848,9 +848,9 @@ func TestDeps(t *testing.T) { deptest.DepChecker{ BadDeps: map[string]string{ // Make sure we don't again accidentally bring in a dependency on - // TailFS or its transitive dependencies - "tailscale.com/tailfs/tailfsimpl": "https://github.com/tailscale/tailscale/pull/10631", - "github.com/studio-b12/gowebdav": "https://github.com/tailscale/tailscale/pull/10631", + // drive or its transitive dependencies + "tailscale.com/drive/driveimpl": "https://github.com/tailscale/tailscale/pull/10631", + "github.com/studio-b12/gowebdav": "https://github.com/tailscale/tailscale/pull/10631", }, }.Check(t) } diff --git a/tsd/tsd.go b/tsd/tsd.go index 21ebb6a4a..ef369f8b8 100644 --- a/tsd/tsd.go +++ b/tsd/tsd.go @@ -22,6 +22,7 @@ import ( "reflect" "tailscale.com/control/controlknobs" + "tailscale.com/drive" "tailscale.com/ipn" "tailscale.com/ipn/conffile" "tailscale.com/net/dns" @@ -29,7 +30,6 @@ import ( "tailscale.com/net/tsdial" "tailscale.com/net/tstun" "tailscale.com/proxymap" - "tailscale.com/tailfs" "tailscale.com/types/netmap" "tailscale.com/wgengine" "tailscale.com/wgengine/magicsock" @@ -48,8 +48,8 @@ type System struct { Tun SubSystem[*tstun.Wrapper] StateStore SubSystem[ipn.StateStore] Netstack SubSystem[NetstackImpl] // actually a *netstack.Impl - TailFSForLocal SubSystem[tailfs.FileSystemForLocal] - TailFSForRemote SubSystem[tailfs.FileSystemForRemote] + TailFSForLocal SubSystem[drive.FileSystemForLocal] + TailFSForRemote SubSystem[drive.FileSystemForRemote] // InitialConfig is initial server config, if any. // It is nil if the node is not in declarative mode. @@ -101,9 +101,9 @@ func (s *System) Set(v any) { s.StateStore.Set(v) case NetstackImpl: s.Netstack.Set(v) - case tailfs.FileSystemForLocal: + case drive.FileSystemForLocal: s.TailFSForLocal.Set(v) - case tailfs.FileSystemForRemote: + case drive.FileSystemForRemote: s.TailFSForRemote.Set(v) default: panic(fmt.Sprintf("unknown type %T", v)) diff --git a/tstest/integration/tailscaled_deps_test_darwin.go b/tstest/integration/tailscaled_deps_test_darwin.go index ad47de941..3d5ec99f9 100644 --- a/tstest/integration/tailscaled_deps_test_darwin.go +++ b/tstest/integration/tailscaled_deps_test_darwin.go @@ -15,6 +15,7 @@ import ( _ "tailscale.com/cmd/tailscaled/childproc" _ "tailscale.com/control/controlclient" _ "tailscale.com/derp/derphttp" + _ "tailscale.com/drive/driveimpl" _ "tailscale.com/envknob" _ "tailscale.com/ipn" _ "tailscale.com/ipn/conffile" @@ -38,7 +39,6 @@ import ( _ "tailscale.com/ssh/tailssh" _ "tailscale.com/syncs" _ "tailscale.com/tailcfg" - _ "tailscale.com/tailfs/tailfsimpl" _ "tailscale.com/tsd" _ "tailscale.com/tsweb/varz" _ "tailscale.com/types/flagtype" diff --git a/tstest/integration/tailscaled_deps_test_freebsd.go b/tstest/integration/tailscaled_deps_test_freebsd.go index ad47de941..3d5ec99f9 100644 --- a/tstest/integration/tailscaled_deps_test_freebsd.go +++ b/tstest/integration/tailscaled_deps_test_freebsd.go @@ -15,6 +15,7 @@ import ( _ "tailscale.com/cmd/tailscaled/childproc" _ "tailscale.com/control/controlclient" _ "tailscale.com/derp/derphttp" + _ "tailscale.com/drive/driveimpl" _ "tailscale.com/envknob" _ "tailscale.com/ipn" _ "tailscale.com/ipn/conffile" @@ -38,7 +39,6 @@ import ( _ "tailscale.com/ssh/tailssh" _ "tailscale.com/syncs" _ "tailscale.com/tailcfg" - _ "tailscale.com/tailfs/tailfsimpl" _ "tailscale.com/tsd" _ "tailscale.com/tsweb/varz" _ "tailscale.com/types/flagtype" diff --git a/tstest/integration/tailscaled_deps_test_linux.go b/tstest/integration/tailscaled_deps_test_linux.go index ad47de941..3d5ec99f9 100644 --- a/tstest/integration/tailscaled_deps_test_linux.go +++ b/tstest/integration/tailscaled_deps_test_linux.go @@ -15,6 +15,7 @@ import ( _ "tailscale.com/cmd/tailscaled/childproc" _ "tailscale.com/control/controlclient" _ "tailscale.com/derp/derphttp" + _ "tailscale.com/drive/driveimpl" _ "tailscale.com/envknob" _ "tailscale.com/ipn" _ "tailscale.com/ipn/conffile" @@ -38,7 +39,6 @@ import ( _ "tailscale.com/ssh/tailssh" _ "tailscale.com/syncs" _ "tailscale.com/tailcfg" - _ "tailscale.com/tailfs/tailfsimpl" _ "tailscale.com/tsd" _ "tailscale.com/tsweb/varz" _ "tailscale.com/types/flagtype" diff --git a/tstest/integration/tailscaled_deps_test_openbsd.go b/tstest/integration/tailscaled_deps_test_openbsd.go index ad47de941..3d5ec99f9 100644 --- a/tstest/integration/tailscaled_deps_test_openbsd.go +++ b/tstest/integration/tailscaled_deps_test_openbsd.go @@ -15,6 +15,7 @@ import ( _ "tailscale.com/cmd/tailscaled/childproc" _ "tailscale.com/control/controlclient" _ "tailscale.com/derp/derphttp" + _ "tailscale.com/drive/driveimpl" _ "tailscale.com/envknob" _ "tailscale.com/ipn" _ "tailscale.com/ipn/conffile" @@ -38,7 +39,6 @@ import ( _ "tailscale.com/ssh/tailssh" _ "tailscale.com/syncs" _ "tailscale.com/tailcfg" - _ "tailscale.com/tailfs/tailfsimpl" _ "tailscale.com/tsd" _ "tailscale.com/tsweb/varz" _ "tailscale.com/types/flagtype" diff --git a/tstest/integration/tailscaled_deps_test_windows.go b/tstest/integration/tailscaled_deps_test_windows.go index 0f84a46b2..240c58c13 100644 --- a/tstest/integration/tailscaled_deps_test_windows.go +++ b/tstest/integration/tailscaled_deps_test_windows.go @@ -22,6 +22,7 @@ import ( _ "tailscale.com/cmd/tailscaled/childproc" _ "tailscale.com/control/controlclient" _ "tailscale.com/derp/derphttp" + _ "tailscale.com/drive/driveimpl" _ "tailscale.com/envknob" _ "tailscale.com/ipn" _ "tailscale.com/ipn/conffile" @@ -45,7 +46,6 @@ import ( _ "tailscale.com/safesocket" _ "tailscale.com/syncs" _ "tailscale.com/tailcfg" - _ "tailscale.com/tailfs/tailfsimpl" _ "tailscale.com/tsd" _ "tailscale.com/tsweb/varz" _ "tailscale.com/types/flagtype" diff --git a/wgengine/netstack/netstack.go b/wgengine/netstack/netstack.go index 7e7beca3e..46de3ebb4 100644 --- a/wgengine/netstack/netstack.go +++ b/wgengine/netstack/netstack.go @@ -36,6 +36,7 @@ import ( "gvisor.dev/gvisor/pkg/tcpip/transport/tcp" "gvisor.dev/gvisor/pkg/tcpip/transport/udp" "gvisor.dev/gvisor/pkg/waiter" + "tailscale.com/drive" "tailscale.com/envknob" "tailscale.com/ipn/ipnlocal" "tailscale.com/metrics" @@ -48,7 +49,6 @@ import ( "tailscale.com/proxymap" "tailscale.com/syncs" "tailscale.com/tailcfg" - "tailscale.com/tailfs" "tailscale.com/types/ipproto" "tailscale.com/types/logger" "tailscale.com/types/netmap" @@ -189,7 +189,7 @@ type Impl struct { ctxCancel context.CancelFunc // called on Close lb *ipnlocal.LocalBackend // or nil dns *dns.Manager - tailFSForLocal tailfs.FileSystemForLocal // or nil + tailFSForLocal drive.FileSystemForLocal // or nil peerapiPort4Atomic atomic.Uint32 // uint16 port number for IPv4 peerapi peerapiPort6Atomic atomic.Uint32 // uint16 port number for IPv6 peerapi @@ -248,7 +248,7 @@ const nicID = 1 const maxUDPPacketSize = tstun.MaxPacketSize // Create creates and populates a new Impl. -func Create(logf logger.Logf, tundev *tstun.Wrapper, e wgengine.Engine, mc *magicsock.Conn, dialer *tsdial.Dialer, dns *dns.Manager, pm *proxymap.Mapper, tailFSForLocal tailfs.FileSystemForLocal) (*Impl, error) { +func Create(logf logger.Logf, tundev *tstun.Wrapper, e wgengine.Engine, mc *magicsock.Conn, dialer *tsdial.Dialer, dns *dns.Manager, pm *proxymap.Mapper, tailFSForLocal drive.FileSystemForLocal) (*Impl, error) { if mc == nil { return nil, errors.New("nil magicsock.Conn") } diff --git a/wgengine/userspace.go b/wgengine/userspace.go index b35e792bd..2ad48a15a 100644 --- a/wgengine/userspace.go +++ b/wgengine/userspace.go @@ -21,6 +21,7 @@ import ( "github.com/tailscale/wireguard-go/device" "github.com/tailscale/wireguard-go/tun" "tailscale.com/control/controlknobs" + "tailscale.com/drive" "tailscale.com/envknob" "tailscale.com/health" "tailscale.com/ipn/ipnstate" @@ -35,7 +36,6 @@ import ( "tailscale.com/net/tstun" "tailscale.com/syncs" "tailscale.com/tailcfg" - "tailscale.com/tailfs" "tailscale.com/tstime/mono" "tailscale.com/types/dnstype" "tailscale.com/types/ipproto" @@ -206,7 +206,7 @@ type Config struct { // TailFSForLocal, if populated, will cause the engine to expose a TailFS // listener at 100.100.100.100:8080. - TailFSForLocal tailfs.FileSystemForLocal + TailFSForLocal drive.FileSystemForLocal } // NewFakeUserspaceEngine returns a new userspace engine for testing.