Movatterモバイル変換


[0]ホーム

URL:


driveimpl

package
v1.92.2Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License:BSD-3-ClauseImports:29Imported by:2

Details

Repository

github.com/tailscale/tailscale

Links

Documentation

Overview

Package driveimpl provides an implementation of package drive.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

typeFileServer

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 Taildrive server toserve up files as an unprivileged user.

funcNewFileServer

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 isaccomplished either by calling SetShares(), or locking the shares withLockShares(), clearing them with ClearSharesLocked(), adding themindividually with AddShareLocked(), and finally unlocking them withUnlockShares().

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

func (*FileServer)AddShareLocked

func (s *FileServer) AddShareLocked(share, pathstring)

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. Thisincludes the secret token in front of the address, delimited by a pipe |.

func (*FileServer)ClearSharesLocked

func (s *FileServer) ClearSharesLocked()

ClearSharesLocked clears the map of shares, assuming that LockShares() hasbeen 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(whttp.ResponseWriter, r *http.Request)

ServeHTTP implements the http.Handler interface. This requires a secrettoken in the path in order to prevent Mark-of-the-Web (MOTW) bypass attacksof the below sort:

  1. Attacker with write access to the share puts a malicious file viahttp://100.100.100.100:8080/<tailnet>/<machine>/</share>/bad.exe
  2. Attacker then induces victim to visithttp://localhost:[PORT]/<share>/bad.exe
  3. Because that is loaded from localhost, it does not get the MOTWthereby bypasses some OS-level security.

The path on this file server is actually not as above, but ratherhttp://localhost:[PORT]/<secretToken>/<share>/bad.exe. Unless the attackercan discover the secretToken, the attacker cannot craft a localhost URL thatwill work.

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.

typeFileSystemForLocal

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

FileSystemForLocal is the Taildrive filesystem exposed to local clients. Itprovides a unified WebDAV interface to remote Taildrive shares on other nodes.

funcNewFileSystemForLocal

func NewFileSystemForLocal(logflogger.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(connnet.Conn, remoteAddrnet.Addr)error

HandleConn handles connections from local WebDAV clients

func (*FileSystemForLocal)SetRemotes

func (s *FileSystemForLocal) SetRemotes(domainstring, remotes []*drive.Remote, transporthttp.RoundTripper)

SetRemotes sets the complete set of remotes on the given tailnet domainusing a map of name -> url. If transport is specified, that transportwill be used to connect to these remotes.

typeFileSystemForRemote

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

FileSystemForRemote implements drive.FileSystemForRemote.

funcNewFileSystemForRemote

func NewFileSystemForRemote(logflogger.Logf) *FileSystemForRemote

func (*FileSystemForRemote)Close

func (s *FileSystemForRemote) Close()error

Close() implements drive.FileSystemForRemote.

func (*FileSystemForRemote)ServeHTTPWithPerms

func (s *FileSystemForRemote) ServeHTTPWithPerms(permissionsdrive.Permissions, whttp.ResponseWriter, r *http.Request)

ServeHTTPWithPerms implements drive.FileSystemForRemote.

func (*FileSystemForRemote)SetFileServerAddr

func (s *FileSystemForRemote) SetFileServerAddr(addrstring)

SetFileServerAddr implements drive.FileSystemForRemote.

func (*FileSystemForRemote)SetShares

func (s *FileSystemForRemote) SetShares(shares []*drive.Share)

SetShares implements drive.FileSystemForRemote. Shares must be sortedaccording to drive.CompareShares.

Source Files

View all Source files

Directories

PathSynopsis
Package compositedav provides an http.Handler that composes multiple WebDAV services into a single WebDAV service that presents each of them as its own folder.
Package compositedav provides an http.Handler that composes multiple WebDAV services into a single WebDAV service that presents each of them as its own folder.
Package dirfs provides a webdav.FileSystem that looks like a read-only directory containing only subdirectories.
Package dirfs provides a webdav.FileSystem that looks like a read-only directory containing only subdirectories.
Package shared contains types and functions shared by different drive packages.
Package shared contains types and functions shared by different drive packages.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp