local.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright (c) Tailscale Inc & AUTHORS
  2. // SPDX-License-Identifier: BSD-3-Clause
  3. // Package drive provides a filesystem that allows sharing folders between
  4. // Tailscale nodes using WebDAV. The actual implementation of the core Taildrive
  5. // functionality lives in package driveimpl. These packages are separated to
  6. // allow users of Taildrive to refer to the interfaces without having a hard
  7. // dependency on Taildrive, so that programs which don't actually use Taildrive can
  8. // avoid its transitive dependencies.
  9. package drive
  10. import (
  11. "net"
  12. "net/http"
  13. )
  14. // Remote represents a remote Taildrive node.
  15. type Remote struct {
  16. Name string
  17. URL func() string
  18. Available func() bool
  19. }
  20. // FileSystemForLocal is the Taildrive filesystem exposed to local clients. It
  21. // provides a unified WebDAV interface to remote Taildrive shares on other nodes.
  22. type FileSystemForLocal interface {
  23. // HandleConn handles connections from local WebDAV clients
  24. HandleConn(conn net.Conn, remoteAddr net.Addr) error
  25. // SetRemotes sets the complete set of remotes on the given tailnet domain
  26. // using a map of name -> url. If transport is specified, that transport
  27. // will be used to connect to these remotes.
  28. SetRemotes(domain string, remotes []*Remote, transport http.RoundTripper)
  29. // Close() stops serving the WebDAV content
  30. Close() error
  31. }