Documentation
¶
Overview ¶
Package taildrop registers the taildrop (file sending) feature.
Package taildrop contains the implementation of the Taildrop functionality including sending and retrieving files. This package does not validate permissions, the caller should be responsible for ensuring correct authorization.
For related documentation see: http://go/taildrop-how-does-it-work
Index ¶
- Variables
- type Extension
- func (e *Extension) AwaitWaitingFiles(ctx context.Context) ([]apitype.WaitingFile, error)
- func (e *Extension) Clock() tstime.Clock
- func (e *Extension) DeleteFile(name string) error
- func (e *Extension) FileTargets() ([]*apitype.FileTarget, error)
- func (e *Extension) Init(h ipnext.Host) error
- func (e *Extension) Name() string
- func (e *Extension) OpenFile(name string) (rc io.ReadCloser, size int64, err error)
- func (e *Extension) SetDirectFileRoot(root string)
- func (e *Extension) SetFileOps(fileOps FileOps)
- func (e *Extension) Shutdown() error
- func (e *Extension) WaitingFiles() ([]apitype.WaitingFile, error)
- type FileOps
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Extension ¶
type Extension struct {
// contains filtered or unexported fields
}
Extension implements Taildrop.
func (*Extension) AwaitWaitingFiles ¶
AwaitWaitingFiles is like WaitingFiles but blocks while ctx is not done, waiting for any files to be available.
On return, exactly one of the results will be non-empty or non-nil, respectively.
func (*Extension) DeleteFile ¶
func (*Extension) FileTargets ¶
func (e *Extension) FileTargets() ([]*apitype.FileTarget, error)
FileTargets lists nodes that the current node can send files to.
func (*Extension) SetDirectFileRoot ¶
SetDirectFileRoot sets the directory where received files are written.
This must be called before Tailscale is started.
func (*Extension) SetFileOps ¶
SetFileOps sets the platform specific file operations. This is used to call Android's Storage Access Framework APIs.
func (*Extension) WaitingFiles ¶
func (e *Extension) WaitingFiles() ([]apitype.WaitingFile, error)
type FileOps ¶
type FileOps interface {
// OpenWriter creates or truncates a file named relative to the receiver's root,
// seeking to the specified offset. If the file does not exist, it is created with mode perm
// on platforms that support it.
//
// It returns an [io.WriteCloser] and the file's absolute path, or an error.
// This call may block. Callers should avoid holding locks when calling OpenWriter.
OpenWriter(name string, offset int64, perm os.FileMode) (wc io.WriteCloser, path string, err error)
// Remove deletes a file or directory relative to the receiver's root.
// It returns [io.ErrNotExist] if the file or directory does not exist.
Remove(name string) error
// Rename atomically renames oldPath to a new file named newName,
// returning the full new path or an error.
Rename(oldPath, newName string) (newPath string, err error)
// ListFiles returns just the basenames of all regular files
// in the root directory.
ListFiles() ([]string, error)
// Stat returns the FileInfo for the given name or an error.
Stat(name string) (fs.FileInfo, error)
// OpenReader opens the given basename for the given name or an error.
OpenReader(name string) (io.ReadCloser, error)
}
FileOps abstracts over both local‐FS paths and Android SAF URIs.