tailfsimpl

package
v0.0.0-...-113f59a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2024 License: BSD-3-Clause Imports: 24 Imported by: 0

Documentation

Overview

Package tailfsimpl provides an implementation of package tailfs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileServer

type FileServer struct {
	// contains filtered or unexported fields
}

FileServer is a standalone WebDAV server that dynamically serves up shares. It's typically used in a separate process from the actual TailFS server to serve up files as an unprivileged user.

func NewFileServer

func NewFileServer() (*FileServer, error)

NewFileServer constructs a FileServer.

The server attempts to listen at a random address on 127.0.0.1. The listen address is available via the Addr() method.

The server has to be told about shares before it can serve them. This is accomplished either by calling SetShares(), or locking the shares with LockShares(), clearing them with ClearSharesLocked(), adding them individually with AddShareLocked(), and finally unlocking them with UnlockShares().

The server doesn't actually process requests until the Serve() method is called.

func (*FileServer) AddShareLocked

func (s *FileServer) AddShareLocked(share, path string)

AddShareLocked adds a share to the map of shares, assuming that LockShares() has been called first.

func (*FileServer) Addr

func (s *FileServer) Addr() string

Addr returns the address at which this FileServer is listening.

func (*FileServer) ClearSharesLocked

func (s *FileServer) ClearSharesLocked()

ClearSharesLocked clears the map of shares, assuming that LockShares() has been called first.

func (*FileServer) Close

func (s *FileServer) Close() error

func (*FileServer) LockShares

func (s *FileServer) LockShares()

LockShares locks the map of shares in preparation for manipulating it.

func (*FileServer) Serve

func (s *FileServer) Serve() error

Serve() starts serving files and blocks until it encounters a fatal error.

func (*FileServer) ServeHTTP

func (s *FileServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements the http.Handler interface.

func (*FileServer) SetShares

func (s *FileServer) SetShares(shares map[string]string)

SetShares sets the full map of shares to the new value, mapping name->path.

func (*FileServer) UnlockShares

func (s *FileServer) UnlockShares()

UnlockShares unlocks the map of shares.

type FileSystemForLocal

type FileSystemForLocal struct {
	// contains filtered or unexported fields
}

FileSystemForLocal is the TailFS filesystem exposed to local clients. It provides a unified WebDAV interface to remote TailFS shares on other nodes.

func NewFileSystemForLocal

func NewFileSystemForLocal(logf logger.Logf) *FileSystemForLocal

NewFileSystemForLocal starts serving a filesystem for local clients. Inbound connections must be handed to HandleConn.

func (*FileSystemForLocal) Close

func (s *FileSystemForLocal) Close() error

Close() stops serving the WebDAV content

func (*FileSystemForLocal) HandleConn

func (s *FileSystemForLocal) HandleConn(conn net.Conn, remoteAddr net.Addr) error

HandleConn handles connections from local WebDAV clients

func (*FileSystemForLocal) SetRemotes

func (s *FileSystemForLocal) SetRemotes(domain string, remotes []*tailfs.Remote, transport http.RoundTripper)

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.

type FileSystemForRemote

type FileSystemForRemote struct {
	// contains filtered or unexported fields
}

FileSystemForRemote implements tailfs.FileSystemForRemote.

func NewFileSystemForRemote

func NewFileSystemForRemote(logf logger.Logf) *FileSystemForRemote

func (*FileSystemForRemote) Close

func (s *FileSystemForRemote) Close() error

Close() implements tailfs.FileSystemForRemote.

func (*FileSystemForRemote) ServeHTTPWithPerms

func (s *FileSystemForRemote) ServeHTTPWithPerms(permissions tailfs.Permissions, w http.ResponseWriter, r *http.Request)

ServeHTTPWithPerms implements tailfs.FileSystemForRemote.

func (*FileSystemForRemote) SetFileServerAddr

func (s *FileSystemForRemote) SetFileServerAddr(addr string)

SetFileServerAddr implements tailfs.FileSystemForRemote.

func (*FileSystemForRemote) SetShares

func (s *FileSystemForRemote) SetShares(shares map[string]*tailfs.Share)

SetShares implements tailfs.FileSystemForRemote.

Directories

Path Synopsis
Package compositefs provides a webdav.FileSystem that is composi
Package compositefs provides a webdav.FileSystem that is composi
Package shared contains types and functions shared by different tailfs packages.
Package shared contains types and functions shared by different tailfs packages.
Package webdavfs provides an implementation of webdav.FileSystem backed by a gowebdav.Client.
Package webdavfs provides an implementation of webdav.FileSystem backed by a gowebdav.Client.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL