2024-02-02 18:45:32 +00:00
|
|
|
// Copyright (c) Tailscale Inc & AUTHORS
|
|
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
|
2024-04-02 20:32:30 +00:00
|
|
|
// 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
|
2024-02-09 17:26:43 +00:00
|
|
|
// avoid its transitive dependencies.
|
2024-04-02 20:32:30 +00:00
|
|
|
package drive
|
2024-02-02 18:45:32 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"net"
|
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
2024-02-09 17:26:43 +00:00
|
|
|
// Remote represents a remote TailFS node.
|
2024-02-02 18:45:32 +00:00
|
|
|
type Remote struct {
|
|
|
|
Name string
|
|
|
|
URL string
|
|
|
|
Available func() bool
|
|
|
|
}
|
|
|
|
|
2024-02-09 17:26:43 +00:00
|
|
|
// FileSystemForLocal is the TailFS filesystem exposed to local clients. It
|
|
|
|
// provides a unified WebDAV interface to remote TailFS shares on other nodes.
|
|
|
|
type FileSystemForLocal interface {
|
|
|
|
// HandleConn handles connections from local WebDAV clients
|
|
|
|
HandleConn(conn net.Conn, remoteAddr net.Addr) error
|
2024-02-02 18:45:32 +00:00
|
|
|
|
2024-02-09 17:26:43 +00:00
|
|
|
// 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.
|
|
|
|
SetRemotes(domain string, remotes []*Remote, transport http.RoundTripper)
|
2024-02-02 18:45:32 +00:00
|
|
|
|
2024-02-09 17:26:43 +00:00
|
|
|
// Close() stops serving the WebDAV content
|
|
|
|
Close() error
|
2024-02-02 18:45:32 +00:00
|
|
|
}
|