mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-25 19:15:34 +00:00
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 <charlotte@tailscale.com>
This commit is contained in:
parent
1c259100b0
commit
14683371ee
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
"go4.org/mem"
|
"go4.org/mem"
|
||||||
"tailscale.com/client/tailscale/apitype"
|
"tailscale.com/client/tailscale/apitype"
|
||||||
|
"tailscale.com/drive"
|
||||||
"tailscale.com/envknob"
|
"tailscale.com/envknob"
|
||||||
"tailscale.com/ipn"
|
"tailscale.com/ipn"
|
||||||
"tailscale.com/ipn/ipnstate"
|
"tailscale.com/ipn/ipnstate"
|
||||||
@ -35,7 +36,6 @@
|
|||||||
"tailscale.com/paths"
|
"tailscale.com/paths"
|
||||||
"tailscale.com/safesocket"
|
"tailscale.com/safesocket"
|
||||||
"tailscale.com/tailcfg"
|
"tailscale.com/tailcfg"
|
||||||
"tailscale.com/tailfs"
|
|
||||||
"tailscale.com/tka"
|
"tailscale.com/tka"
|
||||||
"tailscale.com/types/key"
|
"tailscale.com/types/key"
|
||||||
"tailscale.com/types/tkatype"
|
"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
|
// 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
|
// TailFS will serve to remote nodes. If a share with the same name already
|
||||||
// exists, the existing share is replaced/updated.
|
// 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))
|
_, err := lc.send(ctx, "PUT", "/localapi/v0/tailfs/shares", http.StatusCreated, jsonBody(share))
|
||||||
return err
|
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
|
// TailFSShareList returns the list of shares that TailFS is currently serving
|
||||||
// to remote nodes.
|
// 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")
|
result, err := lc.get200(ctx, "/localapi/v0/tailfs/shares")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
var shares []*tailfs.Share
|
var shares []*drive.Share
|
||||||
err = json.Unmarshal(result, &shares)
|
err = json.Unmarshal(result, &shares)
|
||||||
return shares, err
|
return shares, err
|
||||||
}
|
}
|
||||||
|
@ -34,9 +34,9 @@ func TestDeps(t *testing.T) {
|
|||||||
deptest.DepChecker{
|
deptest.DepChecker{
|
||||||
BadDeps: map[string]string{
|
BadDeps: map[string]string{
|
||||||
// Make sure we don't again accidentally bring in a dependency on
|
// Make sure we don't again accidentally bring in a dependency on
|
||||||
// TailFS or its transitive dependencies
|
// drive or its transitive dependencies
|
||||||
"tailscale.com/tailfs/tailfsimpl": "https://github.com/tailscale/tailscale/pull/10631",
|
"tailscale.com/drive/driveimpl": "https://github.com/tailscale/tailscale/pull/10631",
|
||||||
"github.com/studio-b12/gowebdav": "https://github.com/tailscale/tailscale/pull/10631",
|
"github.com/studio-b12/gowebdav": "https://github.com/tailscale/tailscale/pull/10631",
|
||||||
},
|
},
|
||||||
}.Check(t)
|
}.Check(t)
|
||||||
}
|
}
|
||||||
|
@ -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 from tailscale.com/cmd/derper+
|
||||||
tailscale.com/derp/derphttp from tailscale.com/cmd/derper
|
tailscale.com/derp/derphttp from tailscale.com/cmd/derper
|
||||||
tailscale.com/disco from tailscale.com/derp
|
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/envknob from tailscale.com/client/tailscale+
|
||||||
tailscale.com/health from tailscale.com/net/tlsdial
|
tailscale.com/health from tailscale.com/net/tlsdial
|
||||||
tailscale.com/hostinfo from tailscale.com/net/interfaces+
|
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/safesocket from tailscale.com/client/tailscale
|
||||||
tailscale.com/syncs from tailscale.com/cmd/derper+
|
tailscale.com/syncs from tailscale.com/cmd/derper+
|
||||||
tailscale.com/tailcfg from tailscale.com/client/tailscale+
|
tailscale.com/tailcfg from tailscale.com/client/tailscale+
|
||||||
tailscale.com/tailfs from tailscale.com/client/tailscale+
|
|
||||||
tailscale.com/tka from tailscale.com/client/tailscale+
|
tailscale.com/tka from tailscale.com/client/tailscale+
|
||||||
W tailscale.com/tsconst from tailscale.com/net/interfaces
|
W tailscale.com/tsconst from tailscale.com/net/interfaces
|
||||||
tailscale.com/tstime from tailscale.com/derp+
|
tailscale.com/tstime from tailscale.com/derp+
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/peterbourgon/ff/v3/ffcli"
|
"github.com/peterbourgon/ff/v3/ffcli"
|
||||||
"tailscale.com/tailfs"
|
"tailscale.com/drive"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -69,7 +69,7 @@ func runShareSet(ctx context.Context, args []string) error {
|
|||||||
|
|
||||||
name, path := args[0], args[1]
|
name, path := args[0], args[1]
|
||||||
|
|
||||||
err := localClient.TailFSShareSet(ctx, &tailfs.Share{
|
err := localClient.TailFSShareSet(ctx, &drive.Share{
|
||||||
Name: name,
|
Name: name,
|
||||||
Path: path,
|
Path: path,
|
||||||
})
|
})
|
||||||
@ -145,7 +145,7 @@ func runShareList(ctx context.Context, args []string) error {
|
|||||||
|
|
||||||
func buildShareLongHelp() string {
|
func buildShareLongHelp() string {
|
||||||
longHelpAs := ""
|
longHelpAs := ""
|
||||||
if tailfs.AllowShareAs() {
|
if drive.AllowShareAs() {
|
||||||
longHelpAs = shareLongHelpAs
|
longHelpAs = shareLongHelpAs
|
||||||
}
|
}
|
||||||
return fmt.Sprintf(shareLongHelpBase, longHelpAs)
|
return fmt.Sprintf(shareLongHelpBase, longHelpAs)
|
||||||
|
@ -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 from tailscale.com/derp/derphttp
|
||||||
tailscale.com/derp/derphttp from tailscale.com/net/netcheck
|
tailscale.com/derp/derphttp from tailscale.com/net/netcheck
|
||||||
tailscale.com/disco from tailscale.com/derp
|
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/envknob from tailscale.com/client/tailscale+
|
||||||
tailscale.com/health from tailscale.com/net/tlsdial
|
tailscale.com/health from tailscale.com/net/tlsdial
|
||||||
tailscale.com/health/healthmsg from tailscale.com/cmd/tailscale/cli
|
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/safesocket from tailscale.com/client/tailscale+
|
||||||
tailscale.com/syncs from tailscale.com/cmd/tailscale/cli+
|
tailscale.com/syncs from tailscale.com/cmd/tailscale/cli+
|
||||||
tailscale.com/tailcfg from tailscale.com/client/tailscale+
|
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+
|
tailscale.com/tka from tailscale.com/client/tailscale+
|
||||||
W tailscale.com/tsconst from tailscale.com/net/interfaces
|
W tailscale.com/tsconst from tailscale.com/net/interfaces
|
||||||
tailscale.com/tstime from tailscale.com/control/controlhttp+
|
tailscale.com/tstime from tailscale.com/control/controlhttp+
|
||||||
|
@ -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/internal from github.com/dblohm7/wingoes/com
|
||||||
W 💣 github.com/dblohm7/wingoes/pe from tailscale.com/util/osdiag+
|
W 💣 github.com/dblohm7/wingoes/pe from tailscale.com/util/osdiag+
|
||||||
LW 💣 github.com/digitalocean/go-smbios/smbios from tailscale.com/posture
|
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/fxamacker/cbor/v2 from tailscale.com/tka
|
||||||
github.com/gaissmai/bart from tailscale.com/net/tstun
|
github.com/gaissmai/bart from tailscale.com/net/tstun
|
||||||
W 💣 github.com/go-ole/go-ole from github.com/go-ole/go-ole/oleutil+
|
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/iana from github.com/insomniacslk/dhcp/dhcpv4
|
||||||
L github.com/insomniacslk/dhcp/interfaces 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
|
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/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/josharian/native from github.com/mdlayher/netlink+
|
||||||
L 💣 github.com/jsimonetti/rtnetlink from tailscale.com/net/interfaces+
|
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/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/tai64n from github.com/tailscale/wireguard-go/device
|
||||||
💣 github.com/tailscale/wireguard-go/tun 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/tailscale/xnet/webdav/internal/xml from github.com/tailscale/xnet/webdav
|
||||||
github.com/tcnksm/go-httpstat from tailscale.com/net/netcheck
|
github.com/tcnksm/go-httpstat from tailscale.com/net/netcheck
|
||||||
LD github.com/u-root/u-root/pkg/termios from tailscale.com/ssh/tailssh
|
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/ethtool from tailscale.com/ipn/ipnlocal
|
||||||
💣 tailscale.com/doctor/permissions 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/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/envknob from tailscale.com/client/tailscale+
|
||||||
tailscale.com/health from tailscale.com/control/controlclient+
|
tailscale.com/health from tailscale.com/control/controlclient+
|
||||||
tailscale.com/health/healthmsg from tailscale.com/ipn/ipnlocal
|
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/syncs from tailscale.com/cmd/tailscaled+
|
||||||
tailscale.com/tailcfg from tailscale.com/client/tailscale+
|
tailscale.com/tailcfg from tailscale.com/client/tailscale+
|
||||||
tailscale.com/taildrop from tailscale.com/ipn/ipnlocal+
|
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
|
LD tailscale.com/tempfork/gliderlabs/ssh from tailscale.com/ssh/tailssh
|
||||||
tailscale.com/tempfork/heap from tailscale.com/wgengine/magicsock
|
tailscale.com/tempfork/heap from tailscale.com/wgengine/magicsock
|
||||||
tailscale.com/tka from tailscale.com/client/tailscale+
|
tailscale.com/tka from tailscale.com/client/tailscale+
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
"tailscale.com/client/tailscale"
|
"tailscale.com/client/tailscale"
|
||||||
"tailscale.com/cmd/tailscaled/childproc"
|
"tailscale.com/cmd/tailscaled/childproc"
|
||||||
"tailscale.com/control/controlclient"
|
"tailscale.com/control/controlclient"
|
||||||
|
"tailscale.com/drive/driveimpl"
|
||||||
"tailscale.com/envknob"
|
"tailscale.com/envknob"
|
||||||
"tailscale.com/ipn/conffile"
|
"tailscale.com/ipn/conffile"
|
||||||
"tailscale.com/ipn/ipnlocal"
|
"tailscale.com/ipn/ipnlocal"
|
||||||
@ -52,7 +53,6 @@
|
|||||||
"tailscale.com/paths"
|
"tailscale.com/paths"
|
||||||
"tailscale.com/safesocket"
|
"tailscale.com/safesocket"
|
||||||
"tailscale.com/syncs"
|
"tailscale.com/syncs"
|
||||||
"tailscale.com/tailfs/tailfsimpl"
|
|
||||||
"tailscale.com/tsd"
|
"tailscale.com/tsd"
|
||||||
"tailscale.com/tsweb/varz"
|
"tailscale.com/tsweb/varz"
|
||||||
"tailscale.com/types/flagtype"
|
"tailscale.com/types/flagtype"
|
||||||
@ -407,7 +407,7 @@ func run() (err error) {
|
|||||||
debugMux = newDebugMux()
|
debugMux = newDebugMux()
|
||||||
}
|
}
|
||||||
|
|
||||||
sys.Set(tailfsimpl.NewFileSystemForRemote(logf))
|
sys.Set(driveimpl.NewFileSystemForRemote(logf))
|
||||||
|
|
||||||
return startIPNServer(context.Background(), logf, pol.PublicID, sys)
|
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(),
|
Dialer: sys.Dialer.Get(),
|
||||||
SetSubsystem: sys.Set,
|
SetSubsystem: sys.Set,
|
||||||
ControlKnobs: sys.ControlKnobs(),
|
ControlKnobs: sys.ControlKnobs(),
|
||||||
TailFSForLocal: tailfsimpl.NewFileSystemForLocal(logf),
|
TailFSForLocal: driveimpl.NewFileSystemForLocal(logf),
|
||||||
}
|
}
|
||||||
|
|
||||||
onlyNetstack = name == "userspace-networking"
|
onlyNetstack = name == "userspace-networking"
|
||||||
@ -847,7 +847,7 @@ func serveTailFS(args []string) error {
|
|||||||
if len(args)%2 != 0 {
|
if len(args)%2 != 0 {
|
||||||
return errors.New("need <sharename> <path> pairs")
|
return errors.New("need <sharename> <path> pairs")
|
||||||
}
|
}
|
||||||
s, err := tailfsimpl.NewFileServer()
|
s, err := driveimpl.NewFileServer()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to start tailfs FileServer: %v", err)
|
return fmt.Errorf("unable to start tailfs FileServer: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -42,13 +42,13 @@
|
|||||||
"golang.org/x/sys/windows/svc/eventlog"
|
"golang.org/x/sys/windows/svc/eventlog"
|
||||||
"golang.zx2c4.com/wintun"
|
"golang.zx2c4.com/wintun"
|
||||||
"golang.zx2c4.com/wireguard/windows/tunnel/winipcfg"
|
"golang.zx2c4.com/wireguard/windows/tunnel/winipcfg"
|
||||||
|
"tailscale.com/drive/driveimpl"
|
||||||
"tailscale.com/envknob"
|
"tailscale.com/envknob"
|
||||||
"tailscale.com/logpolicy"
|
"tailscale.com/logpolicy"
|
||||||
"tailscale.com/logtail/backoff"
|
"tailscale.com/logtail/backoff"
|
||||||
"tailscale.com/net/dns"
|
"tailscale.com/net/dns"
|
||||||
"tailscale.com/net/netmon"
|
"tailscale.com/net/netmon"
|
||||||
"tailscale.com/net/tstun"
|
"tailscale.com/net/tstun"
|
||||||
"tailscale.com/tailfs/tailfsimpl"
|
|
||||||
"tailscale.com/tsd"
|
"tailscale.com/tsd"
|
||||||
"tailscale.com/types/logger"
|
"tailscale.com/types/logger"
|
||||||
"tailscale.com/types/logid"
|
"tailscale.com/types/logid"
|
||||||
@ -316,7 +316,7 @@ func beWindowsSubprocess() bool {
|
|||||||
}
|
}
|
||||||
sys.Set(netMon)
|
sys.Set(netMon)
|
||||||
|
|
||||||
sys.Set(tailfsimpl.NewFileSystemForRemote(log.Printf))
|
sys.Set(driveimpl.NewFileSystemForRemote(log.Printf))
|
||||||
|
|
||||||
publicLogID, _ := logid.ParsePublicID(logID)
|
publicLogID, _ := logid.ParsePublicID(logID)
|
||||||
err = startIPNServer(ctx, log.Printf, publicLogID, sys)
|
err = startIPNServer(ctx, log.Printf, publicLogID, sys)
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
// Code generated by tailscale.com/cmd/cloner; DO NOT EDIT.
|
// Code generated by tailscale.com/cmd/cloner; DO NOT EDIT.
|
||||||
|
|
||||||
package tailfs
|
package drive
|
||||||
|
|
||||||
// Clone makes a deep copy of Share.
|
// Clone makes a deep copy of Share.
|
||||||
// The result aliases no memory with the original.
|
// The result aliases no memory with the original.
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
// Code generated by tailscale/cmd/viewer; DO NOT EDIT.
|
// Code generated by tailscale/cmd/viewer; DO NOT EDIT.
|
||||||
|
|
||||||
package tailfs
|
package drive
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) Tailscale Inc & AUTHORS
|
// Copyright (c) Tailscale Inc & AUTHORS
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
package tailfsimpl
|
package driveimpl
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
//go:build windows || darwin
|
//go:build windows || darwin
|
||||||
|
|
||||||
package tailfsimpl
|
package driveimpl
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
@ -17,8 +17,8 @@
|
|||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/tailscale/xnet/webdav"
|
"github.com/tailscale/xnet/webdav"
|
||||||
"tailscale.com/tailfs/tailfsimpl/dirfs"
|
"tailscale.com/drive/driveimpl/dirfs"
|
||||||
"tailscale.com/tailfs/tailfsimpl/shared"
|
"tailscale.com/drive/driveimpl/shared"
|
||||||
"tailscale.com/tstime"
|
"tailscale.com/tstime"
|
||||||
"tailscale.com/types/logger"
|
"tailscale.com/types/logger"
|
||||||
)
|
)
|
@ -10,7 +10,7 @@
|
|||||||
"net/http"
|
"net/http"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
|
||||||
"tailscale.com/tailfs/tailfsimpl/shared"
|
"tailscale.com/drive/driveimpl/shared"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) Tailscale Inc & AUTHORS
|
// Copyright (c) Tailscale Inc & AUTHORS
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
package tailfsimpl
|
package driveimpl
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) Tailscale Inc & AUTHORS
|
// Copyright (c) Tailscale Inc & AUTHORS
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
package tailfsimpl
|
package driveimpl
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
@ -10,7 +10,7 @@
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"tailscale.com/tailfs/tailfsimpl/shared"
|
"tailscale.com/drive/driveimpl/shared"
|
||||||
"tailscale.com/tstime"
|
"tailscale.com/tstime"
|
||||||
)
|
)
|
||||||
|
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
"github.com/google/go-cmp/cmp"
|
"github.com/google/go-cmp/cmp"
|
||||||
"github.com/tailscale/xnet/webdav"
|
"github.com/tailscale/xnet/webdav"
|
||||||
"tailscale.com/tailfs/tailfsimpl/shared"
|
"tailscale.com/drive/driveimpl/shared"
|
||||||
"tailscale.com/tstest"
|
"tailscale.com/tstest"
|
||||||
)
|
)
|
||||||
|
|
@ -7,7 +7,7 @@
|
|||||||
"context"
|
"context"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"tailscale.com/tailfs/tailfsimpl/shared"
|
"tailscale.com/drive/driveimpl/shared"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Mkdir implements webdav.FileSystem. All attempts to Mkdir a directory that
|
// Mkdir implements webdav.FileSystem. All attempts to Mkdir a directory that
|
@ -9,7 +9,7 @@
|
|||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/tailscale/xnet/webdav"
|
"github.com/tailscale/xnet/webdav"
|
||||||
"tailscale.com/tailfs/tailfsimpl/shared"
|
"tailscale.com/drive/driveimpl/shared"
|
||||||
)
|
)
|
||||||
|
|
||||||
// OpenFile implements interface webdav.Filesystem.
|
// OpenFile implements interface webdav.Filesystem.
|
@ -8,7 +8,7 @@
|
|||||||
"io/fs"
|
"io/fs"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"tailscale.com/tailfs/tailfsimpl/shared"
|
"tailscale.com/drive/driveimpl/shared"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Stat implements webdav.FileSystem.
|
// Stat implements webdav.FileSystem.
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) Tailscale Inc & AUTHORS
|
// Copyright (c) Tailscale Inc & AUTHORS
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
package tailfsimpl
|
package driveimpl
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -20,8 +20,8 @@
|
|||||||
|
|
||||||
"github.com/google/go-cmp/cmp"
|
"github.com/google/go-cmp/cmp"
|
||||||
"github.com/studio-b12/gowebdav"
|
"github.com/studio-b12/gowebdav"
|
||||||
"tailscale.com/tailfs"
|
"tailscale.com/drive"
|
||||||
"tailscale.com/tailfs/tailfsimpl/shared"
|
"tailscale.com/drive/driveimpl/shared"
|
||||||
"tailscale.com/tstest"
|
"tailscale.com/tstest"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -38,7 +38,7 @@
|
|||||||
func init() {
|
func init() {
|
||||||
// set AllowShareAs() to false so that we don't try to use sub-processes
|
// set AllowShareAs() to false so that we don't try to use sub-processes
|
||||||
// for access files on disk.
|
// for access files on disk.
|
||||||
tailfs.DisallowShareAs = true
|
drive.DisallowShareAs = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// The tests in this file simulate real-life TailFS scenarios, but without
|
// 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("domain should contain its only remote", shared.Join(domain), remote1)
|
||||||
s.checkDirList("remote with no shares should be empty", 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.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.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.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)
|
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 := newSystem(t)
|
||||||
|
|
||||||
s.addRemote(remote1)
|
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.writeFile("writing file to read/write remote should succeed", remote1, share11, file111, "hello world", true)
|
||||||
s.checkFileStatus(remote1, share11, file111)
|
s.checkFileStatus(remote1, share11, file111)
|
||||||
s.checkFileContents(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 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)
|
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
|
fs *FileSystemForRemote
|
||||||
fileServer *FileServer
|
fileServer *FileServer
|
||||||
shares map[string]string
|
shares map[string]string
|
||||||
permissions map[string]tailfs.Permission
|
permissions map[string]drive.Permission
|
||||||
mu sync.RWMutex
|
mu sync.RWMutex
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,15 +175,15 @@ func (s *system) addRemote(name string) {
|
|||||||
fileServer: fileServer,
|
fileServer: fileServer,
|
||||||
fs: NewFileSystemForRemote(log.Printf),
|
fs: NewFileSystemForRemote(log.Printf),
|
||||||
shares: make(map[string]string),
|
shares: make(map[string]string),
|
||||||
permissions: make(map[string]tailfs.Permission),
|
permissions: make(map[string]drive.Permission),
|
||||||
}
|
}
|
||||||
r.fs.SetFileServerAddr(fileServer.Addr())
|
r.fs.SetFileServerAddr(fileServer.Addr())
|
||||||
go http.Serve(l, r)
|
go http.Serve(l, r)
|
||||||
s.remotes[name] = 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 {
|
for name, r := range s.remotes {
|
||||||
remotes = append(remotes, &tailfs.Remote{
|
remotes = append(remotes, &drive.Remote{
|
||||||
Name: name,
|
Name: name,
|
||||||
URL: fmt.Sprintf("http://%s", r.l.Addr()),
|
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]
|
r, ok := s.remotes[remoteName]
|
||||||
if !ok {
|
if !ok {
|
||||||
s.t.Fatalf("unknown remote %q", remoteName)
|
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.shares[shareName] = f
|
||||||
r.permissions[shareName] = permission
|
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 {
|
for shareName, folder := range r.shares {
|
||||||
shares = append(shares, &tailfs.Share{
|
shares = append(shares, &drive.Share{
|
||||||
Name: shareName,
|
Name: shareName,
|
||||||
Path: folder,
|
Path: folder,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
slices.SortFunc(shares, tailfs.CompareShares)
|
slices.SortFunc(shares, drive.CompareShares)
|
||||||
r.fs.SetShares(shares)
|
r.fs.SetShares(shares)
|
||||||
r.fileServer.SetShares(r.shares)
|
r.fileServer.SetShares(r.shares)
|
||||||
}
|
}
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) Tailscale Inc & AUTHORS
|
// Copyright (c) Tailscale Inc & AUTHORS
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
package tailfsimpl
|
package driveimpl
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
||||||
@ -9,7 +9,7 @@
|
|||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/tailscale/xnet/webdav"
|
"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.
|
// FileServer is a standalone WebDAV server that dynamically serves up shares.
|
@ -1,8 +1,8 @@
|
|||||||
// Copyright (c) Tailscale Inc & AUTHORS
|
// Copyright (c) Tailscale Inc & AUTHORS
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
// Package tailfsimpl provides an implementation of package tailfs.
|
// Package driveimpl provides an implementation of package drive.
|
||||||
package tailfsimpl
|
package driveimpl
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
@ -10,9 +10,9 @@
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"tailscale.com/tailfs"
|
"tailscale.com/drive"
|
||||||
"tailscale.com/tailfs/tailfsimpl/compositedav"
|
"tailscale.com/drive/driveimpl/compositedav"
|
||||||
"tailscale.com/tailfs/tailfsimpl/dirfs"
|
"tailscale.com/drive/driveimpl/dirfs"
|
||||||
"tailscale.com/types/logger"
|
"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
|
// SetRemotes sets the complete set of remotes on the given tailnet domain
|
||||||
// using a map of name -> url. If transport is specified, that transport
|
// using a map of name -> url. If transport is specified, that transport
|
||||||
// will be used to connect to these remotes.
|
// 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))
|
children := make([]*compositedav.Child, 0, len(remotes))
|
||||||
for _, remote := range remotes {
|
for _, remote := range remotes {
|
||||||
children = append(children, &compositedav.Child{
|
children = append(children, &compositedav.Child{
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) Tailscale Inc & AUTHORS
|
// Copyright (c) Tailscale Inc & AUTHORS
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
package tailfsimpl
|
package driveimpl
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
@ -23,11 +23,11 @@
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/tailscale/xnet/webdav"
|
"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/safesocket"
|
||||||
"tailscale.com/tailfs"
|
|
||||||
"tailscale.com/tailfs/tailfsimpl/compositedav"
|
|
||||||
"tailscale.com/tailfs/tailfsimpl/dirfs"
|
|
||||||
"tailscale.com/tailfs/tailfsimpl/shared"
|
|
||||||
"tailscale.com/types/logger"
|
"tailscale.com/types/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ type FileSystemForRemote struct {
|
|||||||
// them, acquire a read lock before reading any of them.
|
// them, acquire a read lock before reading any of them.
|
||||||
mu sync.RWMutex
|
mu sync.RWMutex
|
||||||
fileServerAddr string
|
fileServerAddr string
|
||||||
shares []*tailfs.Share
|
shares []*drive.Share
|
||||||
children map[string]*compositedav.Child
|
children map[string]*compositedav.Child
|
||||||
userServers map[string]*userServer
|
userServers map[string]*userServer
|
||||||
}
|
}
|
||||||
@ -67,9 +67,9 @@ func (s *FileSystemForRemote) SetFileServerAddr(addr string) {
|
|||||||
|
|
||||||
// SetShares implements tailfs.FileSystemForRemote. Shares must be sorted
|
// SetShares implements tailfs.FileSystemForRemote. Shares must be sorted
|
||||||
// according to tailfs.CompareShares.
|
// according to tailfs.CompareShares.
|
||||||
func (s *FileSystemForRemote) SetShares(shares []*tailfs.Share) {
|
func (s *FileSystemForRemote) SetShares(shares []*drive.Share) {
|
||||||
userServers := make(map[string]*userServer)
|
userServers := make(map[string]*userServer)
|
||||||
if tailfs.AllowShareAs() {
|
if drive.AllowShareAs() {
|
||||||
// Set up per-user server by running the current executable as an
|
// Set up per-user server by running the current executable as an
|
||||||
// unprivileged user in order to avoid privilege escalation.
|
// unprivileged user in order to avoid privilege escalation.
|
||||||
executable, err := os.Executable()
|
executable, err := os.Executable()
|
||||||
@ -112,7 +112,7 @@ func (s *FileSystemForRemote) SetShares(shares []*tailfs.Share) {
|
|||||||
s.closeChildren(oldChildren)
|
s.closeChildren(oldChildren)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FileSystemForRemote) buildChild(share *tailfs.Share) *compositedav.Child {
|
func (s *FileSystemForRemote) buildChild(share *drive.Share) *compositedav.Child {
|
||||||
return &compositedav.Child{
|
return &compositedav.Child{
|
||||||
Child: &dirfs.Child{
|
Child: &dirfs.Child{
|
||||||
Name: share.Name,
|
Name: share.Name,
|
||||||
@ -133,8 +133,8 @@ func (s *FileSystemForRemote) buildChild(share *tailfs.Share) *compositedav.Chil
|
|||||||
shareName := string(shareNameBytes)
|
shareName := string(shareNameBytes)
|
||||||
|
|
||||||
s.mu.RLock()
|
s.mu.RLock()
|
||||||
var share *tailfs.Share
|
var share *drive.Share
|
||||||
i, shareFound := slices.BinarySearchFunc(s.shares, shareName, func(s *tailfs.Share, name string) int {
|
i, shareFound := slices.BinarySearchFunc(s.shares, shareName, func(s *drive.Share, name string) int {
|
||||||
return strings.Compare(s.Name, name)
|
return strings.Compare(s.Name, name)
|
||||||
})
|
})
|
||||||
if shareFound {
|
if shareFound {
|
||||||
@ -149,7 +149,7 @@ func (s *FileSystemForRemote) buildChild(share *tailfs.Share) *compositedav.Chil
|
|||||||
}
|
}
|
||||||
|
|
||||||
var addr string
|
var addr string
|
||||||
if !tailfs.AllowShareAs() {
|
if !drive.AllowShareAs() {
|
||||||
addr = fileServerAddr
|
addr = fileServerAddr
|
||||||
} else {
|
} else {
|
||||||
userServer, found := userServers[share.As]
|
userServer, found := userServers[share.As]
|
||||||
@ -177,17 +177,17 @@ func (s *FileSystemForRemote) buildChild(share *tailfs.Share) *compositedav.Chil
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ServeHTTPWithPerms implements tailfs.FileSystemForRemote.
|
// 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]
|
isWrite := writeMethods[r.Method]
|
||||||
if isWrite {
|
if isWrite {
|
||||||
share := shared.CleanAndSplit(r.URL.Path)[0]
|
share := shared.CleanAndSplit(r.URL.Path)[0]
|
||||||
switch permissions.For(share) {
|
switch permissions.For(share) {
|
||||||
case tailfs.PermissionNone:
|
case drive.PermissionNone:
|
||||||
// If we have no permissions to this share, treat it as not found
|
// If we have no permissions to this share, treat it as not found
|
||||||
// to avoid leaking any information about the share's existence.
|
// to avoid leaking any information about the share's existence.
|
||||||
http.Error(w, "not found", http.StatusNotFound)
|
http.Error(w, "not found", http.StatusNotFound)
|
||||||
return
|
return
|
||||||
case tailfs.PermissionReadOnly:
|
case drive.PermissionReadOnly:
|
||||||
http.Error(w, "permission denied", http.StatusForbidden)
|
http.Error(w, "permission denied", http.StatusForbidden)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -200,7 +200,7 @@ func (s *FileSystemForRemote) ServeHTTPWithPerms(permissions tailfs.Permissions,
|
|||||||
children := make([]*compositedav.Child, 0, len(childrenMap))
|
children := make([]*compositedav.Child, 0, len(childrenMap))
|
||||||
// filter out shares to which the connecting principal has no access
|
// filter out shares to which the connecting principal has no access
|
||||||
for name, child := range childrenMap {
|
for name, child := range childrenMap {
|
||||||
if permissions.For(name) == tailfs.PermissionNone {
|
if permissions.For(name) == drive.PermissionNone {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,7 +247,7 @@ func (s *FileSystemForRemote) Close() error {
|
|||||||
// content is served as that Share.As user.
|
// content is served as that Share.As user.
|
||||||
type userServer struct {
|
type userServer struct {
|
||||||
logf logger.Logf
|
logf logger.Logf
|
||||||
shares []*tailfs.Share
|
shares []*drive.Share
|
||||||
username string
|
username string
|
||||||
executable string
|
executable string
|
||||||
|
|
@ -1,13 +1,13 @@
|
|||||||
// Copyright (c) Tailscale Inc & AUTHORS
|
// Copyright (c) Tailscale Inc & AUTHORS
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
// Package tailfs provides a filesystem that allows sharing folders between
|
// Package drive provides a filesystem that allows sharing folders between
|
||||||
// Tailscale nodes using WebDAV. The actual implementation of the core TailFS
|
// Tailscale nodes using WebDAV. The actual implementation of the core drive
|
||||||
// functionality lives in package tailfsimpl. These packages are separated to
|
// functionality lives in package driveimpl. These packages are separated to
|
||||||
// allow users of tailfs to refer to the interfaces without having a hard
|
// allow users of drive to refer to the interfaces without having a hard
|
||||||
// dependency on tailfs, so that programs which don't actually use tailfs can
|
// dependency on drive, so that programs which don't actually use drive can
|
||||||
// avoid its transitive dependencies.
|
// avoid its transitive dependencies.
|
||||||
package tailfs
|
package drive
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) Tailscale Inc & AUTHORS
|
// Copyright (c) Tailscale Inc & AUTHORS
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
package tailfs
|
package drive
|
||||||
|
|
||||||
//go:generate go run tailscale.com/cmd/viewer --type=Share --clonefunc
|
//go:generate go run tailscale.com/cmd/viewer --type=Share --clonefunc
|
||||||
|
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
//go:build !unix
|
//go:build !unix
|
||||||
|
|
||||||
package tailfs
|
package drive
|
||||||
|
|
||||||
func doAllowShareAs() bool {
|
func doAllowShareAs() bool {
|
||||||
// On non-UNIX platforms, we use the GUI application (e.g. Windows taskbar
|
// On non-UNIX platforms, we use the GUI application (e.g. Windows taskbar
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) Tailscale Inc & AUTHORS
|
// Copyright (c) Tailscale Inc & AUTHORS
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
package tailfs
|
package drive
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) Tailscale Inc & AUTHORS
|
// Copyright (c) Tailscale Inc & AUTHORS
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
package tailfs
|
package drive
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
//go:build unix
|
//go:build unix
|
||||||
|
|
||||||
package tailfs
|
package drive
|
||||||
|
|
||||||
import "tailscale.com/version"
|
import "tailscale.com/version"
|
||||||
|
|
@ -8,9 +8,9 @@
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"tailscale.com/drive"
|
||||||
"tailscale.com/ipn/ipnstate"
|
"tailscale.com/ipn/ipnstate"
|
||||||
"tailscale.com/tailcfg"
|
"tailscale.com/tailcfg"
|
||||||
"tailscale.com/tailfs"
|
|
||||||
"tailscale.com/types/empty"
|
"tailscale.com/types/empty"
|
||||||
"tailscale.com/types/key"
|
"tailscale.com/types/key"
|
||||||
"tailscale.com/types/netmap"
|
"tailscale.com/types/netmap"
|
||||||
@ -136,7 +136,7 @@ type Notify struct {
|
|||||||
// the identity of the unprivileged user that is running the application. A
|
// the identity of the unprivileged user that is running the application. A
|
||||||
// nil value here means that we're not broadcasting shares information, an
|
// nil value here means that we're not broadcasting shares information, an
|
||||||
// empty value means that there are no shares.
|
// 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
|
// type is mirrored in xcode/Shared/IPN.swift
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
"maps"
|
"maps"
|
||||||
"net/netip"
|
"net/netip"
|
||||||
|
|
||||||
|
"tailscale.com/drive"
|
||||||
"tailscale.com/tailcfg"
|
"tailscale.com/tailcfg"
|
||||||
"tailscale.com/tailfs"
|
|
||||||
"tailscale.com/types/persist"
|
"tailscale.com/types/persist"
|
||||||
"tailscale.com/types/preftype"
|
"tailscale.com/types/preftype"
|
||||||
)
|
)
|
||||||
@ -26,7 +26,7 @@ func (src *Prefs) Clone() *Prefs {
|
|||||||
dst.AdvertiseTags = append(src.AdvertiseTags[:0:0], src.AdvertiseTags...)
|
dst.AdvertiseTags = append(src.AdvertiseTags[:0:0], src.AdvertiseTags...)
|
||||||
dst.AdvertiseRoutes = append(src.AdvertiseRoutes[:0:0], src.AdvertiseRoutes...)
|
dst.AdvertiseRoutes = append(src.AdvertiseRoutes[:0:0], src.AdvertiseRoutes...)
|
||||||
if src.TailFSShares != nil {
|
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 {
|
for i := range dst.TailFSShares {
|
||||||
dst.TailFSShares[i] = src.TailFSShares[i].Clone()
|
dst.TailFSShares[i] = src.TailFSShares[i].Clone()
|
||||||
}
|
}
|
||||||
@ -63,7 +63,7 @@ func (src *Prefs) Clone() *Prefs {
|
|||||||
AppConnector AppConnectorPrefs
|
AppConnector AppConnectorPrefs
|
||||||
PostureChecking bool
|
PostureChecking bool
|
||||||
NetfilterKind string
|
NetfilterKind string
|
||||||
TailFSShares []*tailfs.Share
|
TailFSShares []*drive.Share
|
||||||
Persist *persist.Persist
|
Persist *persist.Persist
|
||||||
}{})
|
}{})
|
||||||
|
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
"errors"
|
"errors"
|
||||||
"net/netip"
|
"net/netip"
|
||||||
|
|
||||||
|
"tailscale.com/drive"
|
||||||
"tailscale.com/tailcfg"
|
"tailscale.com/tailcfg"
|
||||||
"tailscale.com/tailfs"
|
|
||||||
"tailscale.com/types/persist"
|
"tailscale.com/types/persist"
|
||||||
"tailscale.com/types/preftype"
|
"tailscale.com/types/preftype"
|
||||||
"tailscale.com/types/views"
|
"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) AppConnector() AppConnectorPrefs { return v.ж.AppConnector }
|
||||||
func (v PrefsView) PostureChecking() bool { return v.ж.PostureChecking }
|
func (v PrefsView) PostureChecking() bool { return v.ж.PostureChecking }
|
||||||
func (v PrefsView) NetfilterKind() string { return v.ж.NetfilterKind }
|
func (v PrefsView) NetfilterKind() string { return v.ж.NetfilterKind }
|
||||||
func (v PrefsView) TailFSShares() views.SliceView[*tailfs.Share, tailfs.ShareView] {
|
func (v PrefsView) TailFSShares() views.SliceView[*drive.Share, drive.ShareView] {
|
||||||
return views.SliceOfViews[*tailfs.Share, tailfs.ShareView](v.ж.TailFSShares)
|
return views.SliceOfViews[*drive.Share, drive.ShareView](v.ж.TailFSShares)
|
||||||
}
|
}
|
||||||
func (v PrefsView) Persist() persist.PersistView { return v.ж.Persist.View() }
|
func (v PrefsView) Persist() persist.PersistView { return v.ж.Persist.View() }
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ func (v PrefsView) Persist() persist.PersistView { return v.ж.Persist.View() }
|
|||||||
AppConnector AppConnectorPrefs
|
AppConnector AppConnectorPrefs
|
||||||
PostureChecking bool
|
PostureChecking bool
|
||||||
NetfilterKind string
|
NetfilterKind string
|
||||||
TailFSShares []*tailfs.Share
|
TailFSShares []*drive.Share
|
||||||
Persist *persist.Persist
|
Persist *persist.Persist
|
||||||
}{})
|
}{})
|
||||||
|
|
||||||
|
@ -11,9 +11,9 @@
|
|||||||
"slices"
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"tailscale.com/drive"
|
||||||
"tailscale.com/ipn"
|
"tailscale.com/ipn"
|
||||||
"tailscale.com/tailcfg"
|
"tailscale.com/tailcfg"
|
||||||
"tailscale.com/tailfs"
|
|
||||||
"tailscale.com/types/netmap"
|
"tailscale.com/types/netmap"
|
||||||
"tailscale.com/types/views"
|
"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
|
// replaces the existing share if one with the same name already exists. To
|
||||||
// avoid potential incompatibilities across file systems, share names are
|
// avoid potential incompatibilities across file systems, share names are
|
||||||
// limited to alphanumeric characters and the underscore _.
|
// 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
|
var err error
|
||||||
share.Name, err = normalizeShareName(share.Name)
|
share.Name, err = normalizeShareName(share.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -108,7 +108,7 @@ func normalizeShareName(name string) (string, error) {
|
|||||||
return name, nil
|
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()
|
existingShares := b.pm.prefs.TailFSShares()
|
||||||
|
|
||||||
fs, ok := b.sys.TailFSForRemote.GetOK()
|
fs, ok := b.sys.TailFSForRemote.GetOK()
|
||||||
@ -117,7 +117,7 @@ func (b *LocalBackend) tailFSSetShareLocked(share *tailfs.Share) (views.SliceVie
|
|||||||
}
|
}
|
||||||
|
|
||||||
addedShare := false
|
addedShare := false
|
||||||
var shares []*tailfs.Share
|
var shares []*drive.Share
|
||||||
for i := 0; i < existingShares.Len(); i++ {
|
for i := 0; i < existingShares.Len(); i++ {
|
||||||
existing := existingShares.At(i)
|
existing := existingShares.At(i)
|
||||||
if existing.Name() != share.Name {
|
if existing.Name() != share.Name {
|
||||||
@ -167,7 +167,7 @@ func (b *LocalBackend) TailFSRenameShare(oldName, newName string) error {
|
|||||||
return nil
|
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()
|
existingShares := b.pm.prefs.TailFSShares()
|
||||||
|
|
||||||
fs, ok := b.sys.TailFSForRemote.GetOK()
|
fs, ok := b.sys.TailFSForRemote.GetOK()
|
||||||
@ -176,7 +176,7 @@ func (b *LocalBackend) tailFSRenameShareLocked(oldName, newName string) (views.S
|
|||||||
}
|
}
|
||||||
|
|
||||||
found := false
|
found := false
|
||||||
var shares []*tailfs.Share
|
var shares []*drive.Share
|
||||||
for i := 0; i < existingShares.Len(); i++ {
|
for i := 0; i < existingShares.Len(); i++ {
|
||||||
existing := existingShares.At(i)
|
existing := existingShares.At(i)
|
||||||
if existing.Name() == newName {
|
if existing.Name() == newName {
|
||||||
@ -196,7 +196,7 @@ func (b *LocalBackend) tailFSRenameShareLocked(oldName, newName string) (views.S
|
|||||||
return existingShares, os.ErrNotExist
|
return existingShares, os.ErrNotExist
|
||||||
}
|
}
|
||||||
|
|
||||||
slices.SortFunc(shares, tailfs.CompareShares)
|
slices.SortFunc(shares, drive.CompareShares)
|
||||||
err := b.tailFSSetSharesLocked(shares)
|
err := b.tailFSSetSharesLocked(shares)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return existingShares, err
|
return existingShares, err
|
||||||
@ -228,7 +228,7 @@ func (b *LocalBackend) TailFSRemoveShare(name string) error {
|
|||||||
return nil
|
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()
|
existingShares := b.pm.prefs.TailFSShares()
|
||||||
|
|
||||||
fs, ok := b.sys.TailFSForRemote.GetOK()
|
fs, ok := b.sys.TailFSForRemote.GetOK()
|
||||||
@ -237,7 +237,7 @@ func (b *LocalBackend) tailFSRemoveShareLocked(name string) (views.SliceView[*ta
|
|||||||
}
|
}
|
||||||
|
|
||||||
found := false
|
found := false
|
||||||
var shares []*tailfs.Share
|
var shares []*drive.Share
|
||||||
for i := 0; i < existingShares.Len(); i++ {
|
for i := 0; i < existingShares.Len(); i++ {
|
||||||
existing := existingShares.At(i)
|
existing := existingShares.At(i)
|
||||||
if existing.Name() != name {
|
if existing.Name() != name {
|
||||||
@ -260,7 +260,7 @@ func (b *LocalBackend) tailFSRemoveShareLocked(name string) (views.SliceView[*ta
|
|||||||
return b.pm.prefs.TailFSShares(), nil
|
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 := b.pm.prefs.AsStruct()
|
||||||
prefs.ApplyEdits(&ipn.MaskedPrefs{
|
prefs.ApplyEdits(&ipn.MaskedPrefs{
|
||||||
Prefs: ipn.Prefs{
|
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)
|
// tailFSNotifyShares notifies IPN bus listeners (e.g. Mac Application process)
|
||||||
// about the latest list of shares.
|
// 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"
|
// Ensures shares is not nil to distinguish "no shares" from "not notifying shares"
|
||||||
if shares.IsNil() {
|
if shares.IsNil() {
|
||||||
shares = views.SliceOfViews(make([]*tailfs.Share, 0))
|
shares = views.SliceOfViews(make([]*drive.Share, 0))
|
||||||
}
|
}
|
||||||
b.send(ipn.Notify{TailFSShares: shares})
|
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
|
// tailFSNotifyCurrentSharesLocked sends an ipn.Notify if the current set of
|
||||||
// shares has changed since the last notification.
|
// shares has changed since the last notification.
|
||||||
func (b *LocalBackend) tailFSNotifyCurrentSharesLocked() {
|
func (b *LocalBackend) tailFSNotifyCurrentSharesLocked() {
|
||||||
var shares views.SliceView[*tailfs.Share, tailfs.ShareView]
|
var shares views.SliceView[*drive.Share, drive.ShareView]
|
||||||
if b.tailFSSharingEnabledLocked() {
|
if b.tailFSSharingEnabledLocked() {
|
||||||
// Only populate shares if sharing is enabled.
|
// Only populate shares if sharing is enabled.
|
||||||
shares = b.pm.prefs.TailFSShares()
|
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 {
|
if a == nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -307,7 +307,7 @@ func tailFSShareViewsEqual(a *views.SliceView[*tailfs.Share, tailfs.ShareView],
|
|||||||
}
|
}
|
||||||
|
|
||||||
for i := 0; i < a.Len(); i++ {
|
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
|
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.
|
// 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()
|
b.mu.Lock()
|
||||||
defer b.mu.Unlock()
|
defer b.mu.Unlock()
|
||||||
|
|
||||||
@ -331,7 +331,7 @@ func (b *LocalBackend) updateTailFSPeersLocked(nm *netmap.NetworkMap) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var tailFSRemotes []*tailfs.Remote
|
var tailFSRemotes []*drive.Remote
|
||||||
if b.tailFSAccessEnabledLocked() {
|
if b.tailFSAccessEnabledLocked() {
|
||||||
// Only populate peers if access is enabled, otherwise leave blank.
|
// Only populate peers if access is enabled, otherwise leave blank.
|
||||||
tailFSRemotes = b.tailFSRemotesFromPeers(nm)
|
tailFSRemotes = b.tailFSRemotesFromPeers(nm)
|
||||||
@ -340,8 +340,8 @@ func (b *LocalBackend) updateTailFSPeersLocked(nm *netmap.NetworkMap) {
|
|||||||
fs.SetRemotes(b.netMap.Domain, tailFSRemotes, &tailFSTransport{b: b})
|
fs.SetRemotes(b.netMap.Domain, tailFSRemotes, &tailFSTransport{b: b})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *LocalBackend) tailFSRemotesFromPeers(nm *netmap.NetworkMap) []*tailfs.Remote {
|
func (b *LocalBackend) tailFSRemotesFromPeers(nm *netmap.NetworkMap) []*drive.Remote {
|
||||||
tailFSRemotes := make([]*tailfs.Remote, 0, len(nm.Peers))
|
tailFSRemotes := make([]*drive.Remote, 0, len(nm.Peers))
|
||||||
for _, p := range nm.Peers {
|
for _, p := range nm.Peers {
|
||||||
// Exclude mullvad exit nodes from list of TailFS peers
|
// Exclude mullvad exit nodes from list of TailFS peers
|
||||||
// TODO(oxtoacart) - once we have a better mechanism for finding only accessible sharers
|
// 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()
|
peerID := p.ID()
|
||||||
url := fmt.Sprintf("%s/%s", peerAPIBase(nm, p), tailFSPrefix[1:])
|
url := fmt.Sprintf("%s/%s", peerAPIBase(nm, p), tailFSPrefix[1:])
|
||||||
tailFSRemotes = append(tailFSRemotes, &tailfs.Remote{
|
tailFSRemotes = append(tailFSRemotes, &drive.Remote{
|
||||||
Name: p.DisplayName(false),
|
Name: p.DisplayName(false),
|
||||||
URL: url,
|
URL: url,
|
||||||
Available: func() bool {
|
Available: func() bool {
|
@ -43,6 +43,7 @@
|
|||||||
"tailscale.com/doctor/ethtool"
|
"tailscale.com/doctor/ethtool"
|
||||||
"tailscale.com/doctor/permissions"
|
"tailscale.com/doctor/permissions"
|
||||||
"tailscale.com/doctor/routetable"
|
"tailscale.com/doctor/routetable"
|
||||||
|
"tailscale.com/drive"
|
||||||
"tailscale.com/envknob"
|
"tailscale.com/envknob"
|
||||||
"tailscale.com/health"
|
"tailscale.com/health"
|
||||||
"tailscale.com/health/healthmsg"
|
"tailscale.com/health/healthmsg"
|
||||||
@ -69,7 +70,6 @@
|
|||||||
"tailscale.com/syncs"
|
"tailscale.com/syncs"
|
||||||
"tailscale.com/tailcfg"
|
"tailscale.com/tailcfg"
|
||||||
"tailscale.com/taildrop"
|
"tailscale.com/taildrop"
|
||||||
"tailscale.com/tailfs"
|
|
||||||
"tailscale.com/tka"
|
"tailscale.com/tka"
|
||||||
"tailscale.com/tsd"
|
"tailscale.com/tsd"
|
||||||
"tailscale.com/tstime"
|
"tailscale.com/tstime"
|
||||||
@ -318,7 +318,7 @@ type LocalBackend struct {
|
|||||||
|
|
||||||
// lastNotifiedTailFSShares keeps track of the last set of shares that we
|
// lastNotifiedTailFSShares keeps track of the last set of shares that we
|
||||||
// notified about.
|
// 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 keeps track of Taildrop outgoing files keyed to their OutgoingFile.ID
|
||||||
outgoingFiles map[string]*ipn.OutgoingFile
|
outgoingFiles map[string]*ipn.OutgoingFile
|
||||||
@ -447,7 +447,7 @@ func NewLocalBackend(logf logger.Logf, logID logid.PublicID, sys *tsd.System, lo
|
|||||||
if ok {
|
if ok {
|
||||||
currentShares := b.pm.prefs.TailFSShares()
|
currentShares := b.pm.prefs.TailFSShares()
|
||||||
if currentShares.Len() > 0 {
|
if currentShares.Len() > 0 {
|
||||||
var shares []*tailfs.Share
|
var shares []*drive.Share
|
||||||
for i := 0; i < currentShares.Len(); i++ {
|
for i := 0; i < currentShares.Len(); i++ {
|
||||||
shares = append(shares, currentShares.At(i).AsStruct())
|
shares = append(shares, currentShares.At(i).AsStruct())
|
||||||
}
|
}
|
||||||
|
@ -24,13 +24,13 @@
|
|||||||
"tailscale.com/appc"
|
"tailscale.com/appc"
|
||||||
"tailscale.com/appc/appctest"
|
"tailscale.com/appc/appctest"
|
||||||
"tailscale.com/control/controlclient"
|
"tailscale.com/control/controlclient"
|
||||||
|
"tailscale.com/drive"
|
||||||
|
"tailscale.com/drive/driveimpl"
|
||||||
"tailscale.com/ipn"
|
"tailscale.com/ipn"
|
||||||
"tailscale.com/ipn/store/mem"
|
"tailscale.com/ipn/store/mem"
|
||||||
"tailscale.com/net/interfaces"
|
"tailscale.com/net/interfaces"
|
||||||
"tailscale.com/net/tsaddr"
|
"tailscale.com/net/tsaddr"
|
||||||
"tailscale.com/tailcfg"
|
"tailscale.com/tailcfg"
|
||||||
"tailscale.com/tailfs"
|
|
||||||
"tailscale.com/tailfs/tailfsimpl"
|
|
||||||
"tailscale.com/tsd"
|
"tailscale.com/tsd"
|
||||||
"tailscale.com/tstest"
|
"tailscale.com/tstest"
|
||||||
"tailscale.com/types/dnstype"
|
"tailscale.com/types/dnstype"
|
||||||
@ -2250,20 +2250,20 @@ func TestTailFSManageShares(t *testing.T) {
|
|||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
disabled bool
|
disabled bool
|
||||||
existing []*tailfs.Share
|
existing []*drive.Share
|
||||||
add *tailfs.Share
|
add *drive.Share
|
||||||
remove string
|
remove string
|
||||||
rename [2]string
|
rename [2]string
|
||||||
expect any
|
expect any
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "append",
|
name: "append",
|
||||||
existing: []*tailfs.Share{
|
existing: []*drive.Share{
|
||||||
{Name: "b"},
|
{Name: "b"},
|
||||||
{Name: "d"},
|
{Name: "d"},
|
||||||
},
|
},
|
||||||
add: &tailfs.Share{Name: " E "},
|
add: &drive.Share{Name: " E "},
|
||||||
expect: []*tailfs.Share{
|
expect: []*drive.Share{
|
||||||
{Name: "b"},
|
{Name: "b"},
|
||||||
{Name: "d"},
|
{Name: "d"},
|
||||||
{Name: "e"},
|
{Name: "e"},
|
||||||
@ -2271,12 +2271,12 @@ func TestTailFSManageShares(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "prepend",
|
name: "prepend",
|
||||||
existing: []*tailfs.Share{
|
existing: []*drive.Share{
|
||||||
{Name: "b"},
|
{Name: "b"},
|
||||||
{Name: "d"},
|
{Name: "d"},
|
||||||
},
|
},
|
||||||
add: &tailfs.Share{Name: " A "},
|
add: &drive.Share{Name: " A "},
|
||||||
expect: []*tailfs.Share{
|
expect: []*drive.Share{
|
||||||
{Name: "a"},
|
{Name: "a"},
|
||||||
{Name: "b"},
|
{Name: "b"},
|
||||||
{Name: "d"},
|
{Name: "d"},
|
||||||
@ -2284,12 +2284,12 @@ func TestTailFSManageShares(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "insert",
|
name: "insert",
|
||||||
existing: []*tailfs.Share{
|
existing: []*drive.Share{
|
||||||
{Name: "b"},
|
{Name: "b"},
|
||||||
{Name: "d"},
|
{Name: "d"},
|
||||||
},
|
},
|
||||||
add: &tailfs.Share{Name: " C "},
|
add: &drive.Share{Name: " C "},
|
||||||
expect: []*tailfs.Share{
|
expect: []*drive.Share{
|
||||||
{Name: "b"},
|
{Name: "b"},
|
||||||
{Name: "c"},
|
{Name: "c"},
|
||||||
{Name: "d"},
|
{Name: "d"},
|
||||||
@ -2297,43 +2297,43 @@ func TestTailFSManageShares(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "replace",
|
name: "replace",
|
||||||
existing: []*tailfs.Share{
|
existing: []*drive.Share{
|
||||||
{Name: "b", Path: "i"},
|
{Name: "b", Path: "i"},
|
||||||
{Name: "d"},
|
{Name: "d"},
|
||||||
},
|
},
|
||||||
add: &tailfs.Share{Name: " B ", Path: "ii"},
|
add: &drive.Share{Name: " B ", Path: "ii"},
|
||||||
expect: []*tailfs.Share{
|
expect: []*drive.Share{
|
||||||
{Name: "b", Path: "ii"},
|
{Name: "b", Path: "ii"},
|
||||||
{Name: "d"},
|
{Name: "d"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "add_bad_name",
|
name: "add_bad_name",
|
||||||
add: &tailfs.Share{Name: "$"},
|
add: &drive.Share{Name: "$"},
|
||||||
expect: ErrInvalidShareName,
|
expect: ErrInvalidShareName,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "add_disabled",
|
name: "add_disabled",
|
||||||
disabled: true,
|
disabled: true,
|
||||||
add: &tailfs.Share{Name: "a"},
|
add: &drive.Share{Name: "a"},
|
||||||
expect: ErrTailFSNotEnabled,
|
expect: ErrTailFSNotEnabled,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "remove",
|
name: "remove",
|
||||||
existing: []*tailfs.Share{
|
existing: []*drive.Share{
|
||||||
{Name: "a"},
|
{Name: "a"},
|
||||||
{Name: "b"},
|
{Name: "b"},
|
||||||
{Name: "c"},
|
{Name: "c"},
|
||||||
},
|
},
|
||||||
remove: "b",
|
remove: "b",
|
||||||
expect: []*tailfs.Share{
|
expect: []*drive.Share{
|
||||||
{Name: "a"},
|
{Name: "a"},
|
||||||
{Name: "c"},
|
{Name: "c"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "remove_non_existing",
|
name: "remove_non_existing",
|
||||||
existing: []*tailfs.Share{
|
existing: []*drive.Share{
|
||||||
{Name: "a"},
|
{Name: "a"},
|
||||||
{Name: "b"},
|
{Name: "b"},
|
||||||
{Name: "c"},
|
{Name: "c"},
|
||||||
@ -2349,19 +2349,19 @@ func TestTailFSManageShares(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "rename",
|
name: "rename",
|
||||||
existing: []*tailfs.Share{
|
existing: []*drive.Share{
|
||||||
{Name: "a"},
|
{Name: "a"},
|
||||||
{Name: "b"},
|
{Name: "b"},
|
||||||
},
|
},
|
||||||
rename: [2]string{"a", " C "},
|
rename: [2]string{"a", " C "},
|
||||||
expect: []*tailfs.Share{
|
expect: []*drive.Share{
|
||||||
{Name: "b"},
|
{Name: "b"},
|
||||||
{Name: "c"},
|
{Name: "c"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "rename_not_exist",
|
name: "rename_not_exist",
|
||||||
existing: []*tailfs.Share{
|
existing: []*drive.Share{
|
||||||
{Name: "a"},
|
{Name: "a"},
|
||||||
{Name: "b"},
|
{Name: "b"},
|
||||||
},
|
},
|
||||||
@ -2370,7 +2370,7 @@ func TestTailFSManageShares(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "rename_exists",
|
name: "rename_exists",
|
||||||
existing: []*tailfs.Share{
|
existing: []*drive.Share{
|
||||||
{Name: "a"},
|
{Name: "a"},
|
||||||
{Name: "b"},
|
{Name: "b"},
|
||||||
},
|
},
|
||||||
@ -2390,9 +2390,9 @@ func TestTailFSManageShares(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
tailfs.DisallowShareAs = true
|
drive.DisallowShareAs = true
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
tailfs.DisallowShareAs = false
|
drive.DisallowShareAs = false
|
||||||
})
|
})
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
@ -2406,14 +2406,14 @@ func TestTailFSManageShares(t *testing.T) {
|
|||||||
self := b.netMap.SelfNode.AsStruct()
|
self := b.netMap.SelfNode.AsStruct()
|
||||||
self.CapMap = tailcfg.NodeCapMap{tailcfg.NodeAttrsTailFSShare: nil}
|
self.CapMap = tailcfg.NodeCapMap{tailcfg.NodeAttrsTailFSShare: nil}
|
||||||
b.netMap.SelfNode = self.View()
|
b.netMap.SelfNode = self.View()
|
||||||
b.sys.Set(tailfsimpl.NewFileSystemForRemote(b.logf))
|
b.sys.Set(driveimpl.NewFileSystemForRemote(b.logf))
|
||||||
}
|
}
|
||||||
b.mu.Unlock()
|
b.mu.Unlock()
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
|
||||||
t.Cleanup(cancel)
|
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
|
var wg sync.WaitGroup
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
@ -2447,7 +2447,7 @@ func(n *ipn.Notify) bool {
|
|||||||
if !errors.Is(err, e) {
|
if !errors.Is(err, e) {
|
||||||
t.Errorf("expected error, want: %v got: %v", e, err)
|
t.Errorf("expected error, want: %v got: %v", e, err)
|
||||||
}
|
}
|
||||||
case []*tailfs.Share:
|
case []*drive.Share:
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("unexpected error: %v", err)
|
t.Errorf("unexpected error: %v", err)
|
||||||
} else {
|
} else {
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
"github.com/kortschak/wol"
|
"github.com/kortschak/wol"
|
||||||
"golang.org/x/net/dns/dnsmessage"
|
"golang.org/x/net/dns/dnsmessage"
|
||||||
"golang.org/x/net/http/httpguts"
|
"golang.org/x/net/http/httpguts"
|
||||||
|
"tailscale.com/drive"
|
||||||
"tailscale.com/envknob"
|
"tailscale.com/envknob"
|
||||||
"tailscale.com/health"
|
"tailscale.com/health"
|
||||||
"tailscale.com/hostinfo"
|
"tailscale.com/hostinfo"
|
||||||
@ -39,7 +40,6 @@
|
|||||||
"tailscale.com/net/sockstats"
|
"tailscale.com/net/sockstats"
|
||||||
"tailscale.com/tailcfg"
|
"tailscale.com/tailcfg"
|
||||||
"tailscale.com/taildrop"
|
"tailscale.com/taildrop"
|
||||||
"tailscale.com/tailfs"
|
|
||||||
"tailscale.com/types/views"
|
"tailscale.com/types/views"
|
||||||
"tailscale.com/util/clientmetric"
|
"tailscale.com/util/clientmetric"
|
||||||
"tailscale.com/util/httphdr"
|
"tailscale.com/util/httphdr"
|
||||||
@ -1161,7 +1161,7 @@ func (h *peerAPIHandler) handleServeTailFS(w http.ResponseWriter, r *http.Reques
|
|||||||
rawPerms = append(rawPerms, []byte(cap))
|
rawPerms = append(rawPerms, []byte(cap))
|
||||||
}
|
}
|
||||||
|
|
||||||
p, err := tailfs.ParsePermissions(rawPerms)
|
p, err := drive.ParsePermissions(rawPerms)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
h.logf("tailfs: error parsing permissions: %w", err.Error())
|
h.logf("tailfs: error parsing permissions: %w", err.Error())
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"tailscale.com/client/tailscale/apitype"
|
"tailscale.com/client/tailscale/apitype"
|
||||||
"tailscale.com/clientupdate"
|
"tailscale.com/clientupdate"
|
||||||
|
"tailscale.com/drive"
|
||||||
"tailscale.com/envknob"
|
"tailscale.com/envknob"
|
||||||
"tailscale.com/health"
|
"tailscale.com/health"
|
||||||
"tailscale.com/hostinfo"
|
"tailscale.com/hostinfo"
|
||||||
@ -47,7 +48,6 @@
|
|||||||
"tailscale.com/net/portmapper"
|
"tailscale.com/net/portmapper"
|
||||||
"tailscale.com/tailcfg"
|
"tailscale.com/tailcfg"
|
||||||
"tailscale.com/taildrop"
|
"tailscale.com/taildrop"
|
||||||
"tailscale.com/tailfs"
|
|
||||||
"tailscale.com/tka"
|
"tailscale.com/tka"
|
||||||
"tailscale.com/tstime"
|
"tailscale.com/tstime"
|
||||||
"tailscale.com/types/key"
|
"tailscale.com/types/key"
|
||||||
@ -2765,7 +2765,7 @@ func (h *Handler) serveShares(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
switch r.Method {
|
switch r.Method {
|
||||||
case "PUT":
|
case "PUT":
|
||||||
var share tailfs.Share
|
var share drive.Share
|
||||||
err := json.NewDecoder(r.Body).Decode(&share)
|
err := json.NewDecoder(r.Body).Decode(&share)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusBadRequest)
|
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)
|
http.Error(w, "not a directory", http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if tailfs.AllowShareAs() {
|
if drive.AllowShareAs() {
|
||||||
// share as the connected user
|
// share as the connected user
|
||||||
username, err := h.getUsername()
|
username, err := h.getUsername()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -18,11 +18,11 @@
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"tailscale.com/atomicfile"
|
"tailscale.com/atomicfile"
|
||||||
|
"tailscale.com/drive"
|
||||||
"tailscale.com/ipn/ipnstate"
|
"tailscale.com/ipn/ipnstate"
|
||||||
"tailscale.com/net/netaddr"
|
"tailscale.com/net/netaddr"
|
||||||
"tailscale.com/net/tsaddr"
|
"tailscale.com/net/tsaddr"
|
||||||
"tailscale.com/tailcfg"
|
"tailscale.com/tailcfg"
|
||||||
"tailscale.com/tailfs"
|
|
||||||
"tailscale.com/types/opt"
|
"tailscale.com/types/opt"
|
||||||
"tailscale.com/types/persist"
|
"tailscale.com/types/persist"
|
||||||
"tailscale.com/types/preftype"
|
"tailscale.com/types/preftype"
|
||||||
@ -227,7 +227,7 @@ type Prefs struct {
|
|||||||
|
|
||||||
// TailFSShares are the configured TailFSShares, stored in increasing order
|
// TailFSShares are the configured TailFSShares, stored in increasing order
|
||||||
// by name.
|
// by name.
|
||||||
TailFSShares []*tailfs.Share
|
TailFSShares []*drive.Share
|
||||||
|
|
||||||
// The Persist field is named 'Config' in the file for backward
|
// The Persist field is named 'Config' in the file for backward
|
||||||
// compatibility with earlier versions.
|
// compatibility with earlier versions.
|
||||||
@ -564,7 +564,7 @@ func (p *Prefs) Equals(p2 *Prefs) bool {
|
|||||||
p.AutoUpdate.Equals(p2.AutoUpdate) &&
|
p.AutoUpdate.Equals(p2.AutoUpdate) &&
|
||||||
p.AppConnector == p2.AppConnector &&
|
p.AppConnector == p2.AppConnector &&
|
||||||
p.PostureChecking == p2.PostureChecking &&
|
p.PostureChecking == p2.PostureChecking &&
|
||||||
slices.EqualFunc(p.TailFSShares, p2.TailFSShares, tailfs.SharesEqual) &&
|
slices.EqualFunc(p.TailFSShares, p2.TailFSShares, drive.SharesEqual) &&
|
||||||
p.NetfilterKind == p2.NetfilterKind
|
p.NetfilterKind == p2.NetfilterKind
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -848,9 +848,9 @@ func TestDeps(t *testing.T) {
|
|||||||
deptest.DepChecker{
|
deptest.DepChecker{
|
||||||
BadDeps: map[string]string{
|
BadDeps: map[string]string{
|
||||||
// Make sure we don't again accidentally bring in a dependency on
|
// Make sure we don't again accidentally bring in a dependency on
|
||||||
// TailFS or its transitive dependencies
|
// drive or its transitive dependencies
|
||||||
"tailscale.com/tailfs/tailfsimpl": "https://github.com/tailscale/tailscale/pull/10631",
|
"tailscale.com/drive/driveimpl": "https://github.com/tailscale/tailscale/pull/10631",
|
||||||
"github.com/studio-b12/gowebdav": "https://github.com/tailscale/tailscale/pull/10631",
|
"github.com/studio-b12/gowebdav": "https://github.com/tailscale/tailscale/pull/10631",
|
||||||
},
|
},
|
||||||
}.Check(t)
|
}.Check(t)
|
||||||
}
|
}
|
||||||
|
10
tsd/tsd.go
10
tsd/tsd.go
@ -22,6 +22,7 @@
|
|||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"tailscale.com/control/controlknobs"
|
"tailscale.com/control/controlknobs"
|
||||||
|
"tailscale.com/drive"
|
||||||
"tailscale.com/ipn"
|
"tailscale.com/ipn"
|
||||||
"tailscale.com/ipn/conffile"
|
"tailscale.com/ipn/conffile"
|
||||||
"tailscale.com/net/dns"
|
"tailscale.com/net/dns"
|
||||||
@ -29,7 +30,6 @@
|
|||||||
"tailscale.com/net/tsdial"
|
"tailscale.com/net/tsdial"
|
||||||
"tailscale.com/net/tstun"
|
"tailscale.com/net/tstun"
|
||||||
"tailscale.com/proxymap"
|
"tailscale.com/proxymap"
|
||||||
"tailscale.com/tailfs"
|
|
||||||
"tailscale.com/types/netmap"
|
"tailscale.com/types/netmap"
|
||||||
"tailscale.com/wgengine"
|
"tailscale.com/wgengine"
|
||||||
"tailscale.com/wgengine/magicsock"
|
"tailscale.com/wgengine/magicsock"
|
||||||
@ -48,8 +48,8 @@ type System struct {
|
|||||||
Tun SubSystem[*tstun.Wrapper]
|
Tun SubSystem[*tstun.Wrapper]
|
||||||
StateStore SubSystem[ipn.StateStore]
|
StateStore SubSystem[ipn.StateStore]
|
||||||
Netstack SubSystem[NetstackImpl] // actually a *netstack.Impl
|
Netstack SubSystem[NetstackImpl] // actually a *netstack.Impl
|
||||||
TailFSForLocal SubSystem[tailfs.FileSystemForLocal]
|
TailFSForLocal SubSystem[drive.FileSystemForLocal]
|
||||||
TailFSForRemote SubSystem[tailfs.FileSystemForRemote]
|
TailFSForRemote SubSystem[drive.FileSystemForRemote]
|
||||||
|
|
||||||
// InitialConfig is initial server config, if any.
|
// InitialConfig is initial server config, if any.
|
||||||
// It is nil if the node is not in declarative mode.
|
// It is nil if the node is not in declarative mode.
|
||||||
@ -101,9 +101,9 @@ type ft interface {
|
|||||||
s.StateStore.Set(v)
|
s.StateStore.Set(v)
|
||||||
case NetstackImpl:
|
case NetstackImpl:
|
||||||
s.Netstack.Set(v)
|
s.Netstack.Set(v)
|
||||||
case tailfs.FileSystemForLocal:
|
case drive.FileSystemForLocal:
|
||||||
s.TailFSForLocal.Set(v)
|
s.TailFSForLocal.Set(v)
|
||||||
case tailfs.FileSystemForRemote:
|
case drive.FileSystemForRemote:
|
||||||
s.TailFSForRemote.Set(v)
|
s.TailFSForRemote.Set(v)
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("unknown type %T", v))
|
panic(fmt.Sprintf("unknown type %T", v))
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
_ "tailscale.com/cmd/tailscaled/childproc"
|
_ "tailscale.com/cmd/tailscaled/childproc"
|
||||||
_ "tailscale.com/control/controlclient"
|
_ "tailscale.com/control/controlclient"
|
||||||
_ "tailscale.com/derp/derphttp"
|
_ "tailscale.com/derp/derphttp"
|
||||||
|
_ "tailscale.com/drive/driveimpl"
|
||||||
_ "tailscale.com/envknob"
|
_ "tailscale.com/envknob"
|
||||||
_ "tailscale.com/ipn"
|
_ "tailscale.com/ipn"
|
||||||
_ "tailscale.com/ipn/conffile"
|
_ "tailscale.com/ipn/conffile"
|
||||||
@ -38,7 +39,6 @@
|
|||||||
_ "tailscale.com/ssh/tailssh"
|
_ "tailscale.com/ssh/tailssh"
|
||||||
_ "tailscale.com/syncs"
|
_ "tailscale.com/syncs"
|
||||||
_ "tailscale.com/tailcfg"
|
_ "tailscale.com/tailcfg"
|
||||||
_ "tailscale.com/tailfs/tailfsimpl"
|
|
||||||
_ "tailscale.com/tsd"
|
_ "tailscale.com/tsd"
|
||||||
_ "tailscale.com/tsweb/varz"
|
_ "tailscale.com/tsweb/varz"
|
||||||
_ "tailscale.com/types/flagtype"
|
_ "tailscale.com/types/flagtype"
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
_ "tailscale.com/cmd/tailscaled/childproc"
|
_ "tailscale.com/cmd/tailscaled/childproc"
|
||||||
_ "tailscale.com/control/controlclient"
|
_ "tailscale.com/control/controlclient"
|
||||||
_ "tailscale.com/derp/derphttp"
|
_ "tailscale.com/derp/derphttp"
|
||||||
|
_ "tailscale.com/drive/driveimpl"
|
||||||
_ "tailscale.com/envknob"
|
_ "tailscale.com/envknob"
|
||||||
_ "tailscale.com/ipn"
|
_ "tailscale.com/ipn"
|
||||||
_ "tailscale.com/ipn/conffile"
|
_ "tailscale.com/ipn/conffile"
|
||||||
@ -38,7 +39,6 @@
|
|||||||
_ "tailscale.com/ssh/tailssh"
|
_ "tailscale.com/ssh/tailssh"
|
||||||
_ "tailscale.com/syncs"
|
_ "tailscale.com/syncs"
|
||||||
_ "tailscale.com/tailcfg"
|
_ "tailscale.com/tailcfg"
|
||||||
_ "tailscale.com/tailfs/tailfsimpl"
|
|
||||||
_ "tailscale.com/tsd"
|
_ "tailscale.com/tsd"
|
||||||
_ "tailscale.com/tsweb/varz"
|
_ "tailscale.com/tsweb/varz"
|
||||||
_ "tailscale.com/types/flagtype"
|
_ "tailscale.com/types/flagtype"
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
_ "tailscale.com/cmd/tailscaled/childproc"
|
_ "tailscale.com/cmd/tailscaled/childproc"
|
||||||
_ "tailscale.com/control/controlclient"
|
_ "tailscale.com/control/controlclient"
|
||||||
_ "tailscale.com/derp/derphttp"
|
_ "tailscale.com/derp/derphttp"
|
||||||
|
_ "tailscale.com/drive/driveimpl"
|
||||||
_ "tailscale.com/envknob"
|
_ "tailscale.com/envknob"
|
||||||
_ "tailscale.com/ipn"
|
_ "tailscale.com/ipn"
|
||||||
_ "tailscale.com/ipn/conffile"
|
_ "tailscale.com/ipn/conffile"
|
||||||
@ -38,7 +39,6 @@
|
|||||||
_ "tailscale.com/ssh/tailssh"
|
_ "tailscale.com/ssh/tailssh"
|
||||||
_ "tailscale.com/syncs"
|
_ "tailscale.com/syncs"
|
||||||
_ "tailscale.com/tailcfg"
|
_ "tailscale.com/tailcfg"
|
||||||
_ "tailscale.com/tailfs/tailfsimpl"
|
|
||||||
_ "tailscale.com/tsd"
|
_ "tailscale.com/tsd"
|
||||||
_ "tailscale.com/tsweb/varz"
|
_ "tailscale.com/tsweb/varz"
|
||||||
_ "tailscale.com/types/flagtype"
|
_ "tailscale.com/types/flagtype"
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
_ "tailscale.com/cmd/tailscaled/childproc"
|
_ "tailscale.com/cmd/tailscaled/childproc"
|
||||||
_ "tailscale.com/control/controlclient"
|
_ "tailscale.com/control/controlclient"
|
||||||
_ "tailscale.com/derp/derphttp"
|
_ "tailscale.com/derp/derphttp"
|
||||||
|
_ "tailscale.com/drive/driveimpl"
|
||||||
_ "tailscale.com/envknob"
|
_ "tailscale.com/envknob"
|
||||||
_ "tailscale.com/ipn"
|
_ "tailscale.com/ipn"
|
||||||
_ "tailscale.com/ipn/conffile"
|
_ "tailscale.com/ipn/conffile"
|
||||||
@ -38,7 +39,6 @@
|
|||||||
_ "tailscale.com/ssh/tailssh"
|
_ "tailscale.com/ssh/tailssh"
|
||||||
_ "tailscale.com/syncs"
|
_ "tailscale.com/syncs"
|
||||||
_ "tailscale.com/tailcfg"
|
_ "tailscale.com/tailcfg"
|
||||||
_ "tailscale.com/tailfs/tailfsimpl"
|
|
||||||
_ "tailscale.com/tsd"
|
_ "tailscale.com/tsd"
|
||||||
_ "tailscale.com/tsweb/varz"
|
_ "tailscale.com/tsweb/varz"
|
||||||
_ "tailscale.com/types/flagtype"
|
_ "tailscale.com/types/flagtype"
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
_ "tailscale.com/cmd/tailscaled/childproc"
|
_ "tailscale.com/cmd/tailscaled/childproc"
|
||||||
_ "tailscale.com/control/controlclient"
|
_ "tailscale.com/control/controlclient"
|
||||||
_ "tailscale.com/derp/derphttp"
|
_ "tailscale.com/derp/derphttp"
|
||||||
|
_ "tailscale.com/drive/driveimpl"
|
||||||
_ "tailscale.com/envknob"
|
_ "tailscale.com/envknob"
|
||||||
_ "tailscale.com/ipn"
|
_ "tailscale.com/ipn"
|
||||||
_ "tailscale.com/ipn/conffile"
|
_ "tailscale.com/ipn/conffile"
|
||||||
@ -45,7 +46,6 @@
|
|||||||
_ "tailscale.com/safesocket"
|
_ "tailscale.com/safesocket"
|
||||||
_ "tailscale.com/syncs"
|
_ "tailscale.com/syncs"
|
||||||
_ "tailscale.com/tailcfg"
|
_ "tailscale.com/tailcfg"
|
||||||
_ "tailscale.com/tailfs/tailfsimpl"
|
|
||||||
_ "tailscale.com/tsd"
|
_ "tailscale.com/tsd"
|
||||||
_ "tailscale.com/tsweb/varz"
|
_ "tailscale.com/tsweb/varz"
|
||||||
_ "tailscale.com/types/flagtype"
|
_ "tailscale.com/types/flagtype"
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
"gvisor.dev/gvisor/pkg/tcpip/transport/tcp"
|
"gvisor.dev/gvisor/pkg/tcpip/transport/tcp"
|
||||||
"gvisor.dev/gvisor/pkg/tcpip/transport/udp"
|
"gvisor.dev/gvisor/pkg/tcpip/transport/udp"
|
||||||
"gvisor.dev/gvisor/pkg/waiter"
|
"gvisor.dev/gvisor/pkg/waiter"
|
||||||
|
"tailscale.com/drive"
|
||||||
"tailscale.com/envknob"
|
"tailscale.com/envknob"
|
||||||
"tailscale.com/ipn/ipnlocal"
|
"tailscale.com/ipn/ipnlocal"
|
||||||
"tailscale.com/metrics"
|
"tailscale.com/metrics"
|
||||||
@ -48,7 +49,6 @@
|
|||||||
"tailscale.com/proxymap"
|
"tailscale.com/proxymap"
|
||||||
"tailscale.com/syncs"
|
"tailscale.com/syncs"
|
||||||
"tailscale.com/tailcfg"
|
"tailscale.com/tailcfg"
|
||||||
"tailscale.com/tailfs"
|
|
||||||
"tailscale.com/types/ipproto"
|
"tailscale.com/types/ipproto"
|
||||||
"tailscale.com/types/logger"
|
"tailscale.com/types/logger"
|
||||||
"tailscale.com/types/netmap"
|
"tailscale.com/types/netmap"
|
||||||
@ -189,7 +189,7 @@ type Impl struct {
|
|||||||
ctxCancel context.CancelFunc // called on Close
|
ctxCancel context.CancelFunc // called on Close
|
||||||
lb *ipnlocal.LocalBackend // or nil
|
lb *ipnlocal.LocalBackend // or nil
|
||||||
dns *dns.Manager
|
dns *dns.Manager
|
||||||
tailFSForLocal tailfs.FileSystemForLocal // or nil
|
tailFSForLocal drive.FileSystemForLocal // or nil
|
||||||
|
|
||||||
peerapiPort4Atomic atomic.Uint32 // uint16 port number for IPv4 peerapi
|
peerapiPort4Atomic atomic.Uint32 // uint16 port number for IPv4 peerapi
|
||||||
peerapiPort6Atomic atomic.Uint32 // uint16 port number for IPv6 peerapi
|
peerapiPort6Atomic atomic.Uint32 // uint16 port number for IPv6 peerapi
|
||||||
@ -248,7 +248,7 @@ type Impl struct {
|
|||||||
const maxUDPPacketSize = tstun.MaxPacketSize
|
const maxUDPPacketSize = tstun.MaxPacketSize
|
||||||
|
|
||||||
// Create creates and populates a new Impl.
|
// 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 {
|
if mc == nil {
|
||||||
return nil, errors.New("nil magicsock.Conn")
|
return nil, errors.New("nil magicsock.Conn")
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
"github.com/tailscale/wireguard-go/device"
|
"github.com/tailscale/wireguard-go/device"
|
||||||
"github.com/tailscale/wireguard-go/tun"
|
"github.com/tailscale/wireguard-go/tun"
|
||||||
"tailscale.com/control/controlknobs"
|
"tailscale.com/control/controlknobs"
|
||||||
|
"tailscale.com/drive"
|
||||||
"tailscale.com/envknob"
|
"tailscale.com/envknob"
|
||||||
"tailscale.com/health"
|
"tailscale.com/health"
|
||||||
"tailscale.com/ipn/ipnstate"
|
"tailscale.com/ipn/ipnstate"
|
||||||
@ -35,7 +36,6 @@
|
|||||||
"tailscale.com/net/tstun"
|
"tailscale.com/net/tstun"
|
||||||
"tailscale.com/syncs"
|
"tailscale.com/syncs"
|
||||||
"tailscale.com/tailcfg"
|
"tailscale.com/tailcfg"
|
||||||
"tailscale.com/tailfs"
|
|
||||||
"tailscale.com/tstime/mono"
|
"tailscale.com/tstime/mono"
|
||||||
"tailscale.com/types/dnstype"
|
"tailscale.com/types/dnstype"
|
||||||
"tailscale.com/types/ipproto"
|
"tailscale.com/types/ipproto"
|
||||||
@ -206,7 +206,7 @@ type Config struct {
|
|||||||
|
|
||||||
// TailFSForLocal, if populated, will cause the engine to expose a TailFS
|
// TailFSForLocal, if populated, will cause the engine to expose a TailFS
|
||||||
// listener at 100.100.100.100:8080.
|
// listener at 100.100.100.100:8080.
|
||||||
TailFSForLocal tailfs.FileSystemForLocal
|
TailFSForLocal drive.FileSystemForLocal
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewFakeUserspaceEngine returns a new userspace engine for testing.
|
// NewFakeUserspaceEngine returns a new userspace engine for testing.
|
||||||
|
Loading…
Reference in New Issue
Block a user