vfs

package
v2.0.0-...-83f77b2 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2022 License: AGPL-3.0 Imports: 64 Imported by: 0

Documentation

Overview

Package vfs provides local and remote filesystems support

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrStorageSizeUnavailable is returned if the storage backend does not support getting the size
	ErrStorageSizeUnavailable = errors.New("unable to get available size for this storage backend")
	// ErrVfsUnsupported defines the error for an unsupported VFS operation
	ErrVfsUnsupported = errors.New("not supported")
)
View Source
var (
	// ErrSFTPLoop defines the error to return if an SFTP loop is detected
	ErrSFTPLoop = errors.New("SFTP loop or nested local SFTP folders detected")
)

Functions

func GetTempPath

func GetTempPath() string

GetTempPath returns the path for temporary files

func HasImplicitAtomicUploads

func HasImplicitAtomicUploads(fs Fs) bool

HasImplicitAtomicUploads returns true if the fs don't persists partial files on error

func HasOpenRWSupport

func HasOpenRWSupport(fs Fs) bool

HasOpenRWSupport returns true if the fs can open a file for reading and writing at the same time

func HasTruncateSupport

func HasTruncateSupport(fs Fs) bool

HasTruncateSupport returns true if the fs supports truncate files

func IsBufferedSFTPFs

func IsBufferedSFTPFs(fs Fs) bool

IsBufferedSFTPFs returns true if this is a buffered SFTP filesystem

func IsCryptOsFs

func IsCryptOsFs(fs Fs) bool

IsCryptOsFs returns true if fs is an encrypted local filesystem implementation

func IsHTTPFs

func IsHTTPFs(fs Fs) bool

IsHTTPFs returns true if fs is an HTTP filesystem

func IsLocalOrCryptoFs

func IsLocalOrCryptoFs(fs Fs) bool

IsLocalOrCryptoFs returns true if fs is local or local encrypted

func IsLocalOrSFTPFs

func IsLocalOrSFTPFs(fs Fs) bool

IsLocalOrSFTPFs returns true if fs is local or SFTP

func IsLocalOrUnbufferedSFTPFs

func IsLocalOrUnbufferedSFTPFs(fs Fs) bool

IsLocalOrUnbufferedSFTPFs returns true if fs is local or SFTP with no buffer

func IsLocalOsFs

func IsLocalOsFs(fs Fs) bool

IsLocalOsFs returns true if fs is a local filesystem implementation

func IsSFTPFs

func IsSFTPFs(fs Fs) bool

IsSFTPFs returns true if fs is an SFTP filesystem

func SetAllowSelfConnections

func SetAllowSelfConnections(value int)

SetAllowSelfConnections sets the desired behaviour for self connections

func SetPathPermissions

func SetPathPermissions(fs Fs, path string, uid int, gid int)

SetPathPermissions calls fs.Chown. It does nothing for local filesystem on windows

func SetSFTPFingerprints

func SetSFTPFingerprints(fp []string)

SetSFTPFingerprints sets the SFTP host key fingerprints

func SetTempPath

func SetTempPath(fsPath string)

SetTempPath sets the path for temporary files

Types

type AzBlobFsConfig

type AzBlobFsConfig struct {
	sdk.BaseAzBlobFsConfig
	// Storage Account Key leave blank to use SAS URL.
	// The access key is stored encrypted based on the kms configuration
	AccountKey *kms.Secret `json:"account_key,omitempty"`
	// Shared access signature URL, leave blank if using account/key
	SASURL *kms.Secret `json:"sas_url,omitempty"`
}

AzBlobFsConfig defines the configuration for Azure Blob Storage based filesystem

func (*AzBlobFsConfig) HideConfidentialData

func (c *AzBlobFsConfig) HideConfidentialData()

HideConfidentialData hides confidential data

func (*AzBlobFsConfig) ValidateAndEncryptCredentials

func (c *AzBlobFsConfig) ValidateAndEncryptCredentials(additionalData string) error

ValidateAndEncryptCredentials validates the configuration and encrypts access secret if it is in plain text

type AzureBlobFs

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

AzureBlobFs is a Fs implementation for Azure Blob storage.

func (*AzureBlobFs) CheckMetadata

func (fs *AzureBlobFs) CheckMetadata() error

CheckMetadata checks the metadata consistency

func (*AzureBlobFs) CheckRootPath

func (fs *AzureBlobFs) CheckRootPath(username string, uid int, gid int) bool

CheckRootPath creates the specified local root directory if it does not exists

func (*AzureBlobFs) Chmod

func (*AzureBlobFs) Chmod(name string, mode os.FileMode) error

Chmod changes the mode of the named file to mode.

func (*AzureBlobFs) Chown

func (*AzureBlobFs) Chown(name string, uid int, gid int) error

Chown changes the numeric uid and gid of the named file.

func (*AzureBlobFs) Chtimes

func (fs *AzureBlobFs) Chtimes(name string, atime, mtime time.Time, isUploading bool) error

Chtimes changes the access and modification times of the named file.

func (*AzureBlobFs) Close

func (*AzureBlobFs) Close() error

Close closes the fs

func (*AzureBlobFs) ConnectionID

func (fs *AzureBlobFs) ConnectionID() string

ConnectionID returns the connection ID associated to this Fs implementation

func (*AzureBlobFs) Create

func (fs *AzureBlobFs) Create(name string, flag int) (File, *PipeWriter, func(), error)

Create creates or opens the named file for writing

func (*AzureBlobFs) GetAtomicUploadPath

func (*AzureBlobFs) GetAtomicUploadPath(name string) string

GetAtomicUploadPath returns the path to use for an atomic upload. Azure Blob Storage uploads are already atomic, we never call this method

func (*AzureBlobFs) GetAvailableDiskSize

func (*AzureBlobFs) GetAvailableDiskSize(dirName string) (*sftp.StatVFS, error)

GetAvailableDiskSize returns the available size for the specified path

func (*AzureBlobFs) GetDirSize

func (*AzureBlobFs) GetDirSize(dirname string) (int, int64, error)

GetDirSize returns the number of files and the size for a folder including any subfolders

func (*AzureBlobFs) GetMimeType

func (fs *AzureBlobFs) GetMimeType(name string) (string, error)

GetMimeType returns the content type

func (*AzureBlobFs) GetRelativePath

func (fs *AzureBlobFs) GetRelativePath(name string) string

GetRelativePath returns the path for a file relative to the user's home dir. This is the path as seen by SFTPGo users

func (*AzureBlobFs) HasVirtualFolders

func (*AzureBlobFs) HasVirtualFolders() bool

HasVirtualFolders returns true if folders are emulated

func (*AzureBlobFs) IsAtomicUploadSupported

func (*AzureBlobFs) IsAtomicUploadSupported() bool

IsAtomicUploadSupported returns true if atomic upload is supported. Azure Blob uploads are already atomic, we don't need to upload to a temporary file

func (*AzureBlobFs) IsNotExist

func (*AzureBlobFs) IsNotExist(err error) bool

IsNotExist returns a boolean indicating whether the error is known to report that a file or directory does not exist

func (*AzureBlobFs) IsNotSupported

func (*AzureBlobFs) IsNotSupported(err error) bool

IsNotSupported returns true if the error indicate an unsupported operation

func (*AzureBlobFs) IsPermission

func (*AzureBlobFs) IsPermission(err error) bool

IsPermission returns a boolean indicating whether the error is known to report that permission is denied.

func (*AzureBlobFs) IsUploadResumeSupported

func (*AzureBlobFs) IsUploadResumeSupported() bool

IsUploadResumeSupported returns true if resuming uploads is supported. Resuming uploads is not supported on Azure Blob

func (*AzureBlobFs) Join

func (*AzureBlobFs) Join(elem ...string) string

Join joins any number of path elements into a single path

func (*AzureBlobFs) Lstat

func (fs *AzureBlobFs) Lstat(name string) (os.FileInfo, error)

Lstat returns a FileInfo describing the named file

func (*AzureBlobFs) Mkdir

func (fs *AzureBlobFs) Mkdir(name string) error

Mkdir creates a new directory with the specified name and default permissions

func (*AzureBlobFs) Name

func (fs *AzureBlobFs) Name() string

Name returns the name for the Fs implementation

func (*AzureBlobFs) Open

func (fs *AzureBlobFs) Open(name string, offset int64) (File, *pipeat.PipeReaderAt, func(), error)

Open opens the named file for reading

func (*AzureBlobFs) ReadDir

func (fs *AzureBlobFs) ReadDir(dirname string) ([]os.FileInfo, error)

ReadDir reads the directory named by dirname and returns a list of directory entries.

func (*AzureBlobFs) Readlink(name string) (string, error)

Readlink returns the destination of the named symbolic link

func (*AzureBlobFs) Remove

func (fs *AzureBlobFs) Remove(name string, isDir bool) error

Remove removes the named file or (empty) directory.

func (*AzureBlobFs) Rename

func (fs *AzureBlobFs) Rename(source, target string) error

Rename renames (moves) source to target. We don't support renaming non empty directories since we should rename all the contents too and this could take long time: think about directories with thousands of files, for each file we should execute a StartCopyFromURL call.

func (*AzureBlobFs) ResolvePath

func (fs *AzureBlobFs) ResolvePath(virtualPath string) (string, error)

ResolvePath returns the matching filesystem path for the specified sftp path

func (*AzureBlobFs) ScanRootDirContents

func (fs *AzureBlobFs) ScanRootDirContents() (int, int64, error)

ScanRootDirContents returns the number of files contained in the bucket, and their size

func (*AzureBlobFs) Stat

func (fs *AzureBlobFs) Stat(name string) (os.FileInfo, error)

Stat returns a FileInfo describing the named file

func (*AzureBlobFs) Symlink(source, target string) error

Symlink creates source as a symbolic link to target.

func (*AzureBlobFs) Truncate

func (*AzureBlobFs) Truncate(name string, size int64) error

Truncate changes the size of the named file. Truncate by path is not supported, while truncating an opened file is handled inside base transfer

func (*AzureBlobFs) Walk

func (fs *AzureBlobFs) Walk(root string, walkFn filepath.WalkFunc) error

Walk walks the file tree rooted at root, calling walkFn for each file or directory in the tree, including root

type BaseVirtualFolder

type BaseVirtualFolder struct {
	ID            int64  `json:"id"`
	Name          string `json:"name"`
	MappedPath    string `json:"mapped_path,omitempty"`
	Description   string `json:"description,omitempty"`
	UsedQuotaSize int64  `json:"used_quota_size"`
	// Used quota as number of files
	UsedQuotaFiles int `json:"used_quota_files"`
	// Last quota update as unix timestamp in milliseconds
	LastQuotaUpdate int64 `json:"last_quota_update"`
	// list of usernames associated with this virtual folder
	Users []string `json:"users,omitempty"`
	// list of group names associated with this virtual folder
	Groups []string `json:"groups,omitempty"`
	// Filesystem configuration details
	FsConfig Filesystem `json:"filesystem"`
}

BaseVirtualFolder defines the path for the virtual folder and the used quota limits. The same folder can be shared among multiple users and each user can have different quota limits or a different virtual path.

func (*BaseVirtualFolder) GetACopy

func (v *BaseVirtualFolder) GetACopy() BaseVirtualFolder

GetACopy returns a copy

func (*BaseVirtualFolder) GetEncryptionAdditionalData

func (v *BaseVirtualFolder) GetEncryptionAdditionalData() string

GetEncryptionAdditionalData returns the additional data to use for AEAD

func (*BaseVirtualFolder) GetGroupsAsString

func (v *BaseVirtualFolder) GetGroupsAsString() string

GetGroupsAsString returns the list of groups as comma separated string

func (*BaseVirtualFolder) GetLastQuotaUpdateAsString

func (v *BaseVirtualFolder) GetLastQuotaUpdateAsString() string

GetLastQuotaUpdateAsString returns the last quota update as string

func (*BaseVirtualFolder) GetQuotaSummary

func (v *BaseVirtualFolder) GetQuotaSummary() string

GetQuotaSummary returns used quota and last update as string

func (*BaseVirtualFolder) GetStorageDescrition

func (v *BaseVirtualFolder) GetStorageDescrition() string

GetStorageDescrition returns the storage description

func (*BaseVirtualFolder) GetUsersAsString

func (v *BaseVirtualFolder) GetUsersAsString() string

GetUsersAsString returns the list of users as comma separated string

func (*BaseVirtualFolder) HasRedactedSecret

func (v *BaseVirtualFolder) HasRedactedSecret() bool

HasRedactedSecret returns true if the folder has a redacted secret

func (*BaseVirtualFolder) IsLocalOrLocalCrypted

func (v *BaseVirtualFolder) IsLocalOrLocalCrypted() bool

IsLocalOrLocalCrypted returns true if the folder provider is local or local encrypted

func (*BaseVirtualFolder) PrepareForRendering

func (v *BaseVirtualFolder) PrepareForRendering()

PrepareForRendering prepares a folder for rendering. It hides confidential data and set to nil the empty secrets so they are not serialized

type CryptFs

type CryptFs struct {
	*OsFs
	// contains filtered or unexported fields
}

CryptFs is a Fs implementation that allows to encrypts/decrypts local files

func (*CryptFs) ConvertFileInfo

func (fs *CryptFs) ConvertFileInfo(info os.FileInfo) os.FileInfo

ConvertFileInfo returns a FileInfo with the decrypted size

func (*CryptFs) Create

func (fs *CryptFs) Create(name string, flag int) (File, *PipeWriter, func(), error)

Create creates or opens the named file for writing

func (*CryptFs) GetMimeType

func (fs *CryptFs) GetMimeType(name string) (string, error)

GetMimeType returns the content type

func (*CryptFs) IsUploadResumeSupported

func (*CryptFs) IsUploadResumeSupported() bool

IsUploadResumeSupported returns false sio does not support random access writes

func (*CryptFs) Name

func (fs *CryptFs) Name() string

Name returns the name for the Fs implementation

func (*CryptFs) Open

func (fs *CryptFs) Open(name string, offset int64) (File, *pipeat.PipeReaderAt, func(), error)

Open opens the named file for reading

func (*CryptFs) ReadDir

func (fs *CryptFs) ReadDir(dirname string) ([]os.FileInfo, error)

ReadDir reads the directory named by dirname and returns a list of directory entries.

func (*CryptFs) Truncate

func (*CryptFs) Truncate(name string, size int64) error

Truncate changes the size of the named file

type CryptFsConfig

type CryptFsConfig struct {
	Passphrase *kms.Secret `json:"passphrase,omitempty"`
}

CryptFsConfig defines the configuration to store local files as encrypted

func (*CryptFsConfig) HideConfidentialData

func (c *CryptFsConfig) HideConfidentialData()

HideConfidentialData hides confidential data

func (*CryptFsConfig) ValidateAndEncryptCredentials

func (c *CryptFsConfig) ValidateAndEncryptCredentials(additionalData string) error

ValidateAndEncryptCredentials validates the configuration and encrypts the passphrase if it is in plain text

type File

type File interface {
	io.Reader
	io.Writer
	io.Closer
	io.ReaderAt
	io.WriterAt
	io.Seeker
	Stat() (os.FileInfo, error)
	Name() string
	Truncate(size int64) error
}

File defines an interface representing a SFTPGo file

type FileInfo

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

FileInfo implements os.FileInfo for a Cloud Storage file.

func NewFileInfo

func NewFileInfo(name string, isDirectory bool, sizeInBytes int64, modTime time.Time, fullName bool) *FileInfo

NewFileInfo creates file info.

func (*FileInfo) IsDir

func (fi *FileInfo) IsDir() bool

IsDir provides the abbreviation for Mode().IsDir()

func (*FileInfo) ModTime

func (fi *FileInfo) ModTime() time.Time

ModTime provides the last modification time.

func (*FileInfo) Mode

func (fi *FileInfo) Mode() os.FileMode

Mode provides the file mode bits

func (*FileInfo) Name

func (fi *FileInfo) Name() string

Name provides the base name of the file.

func (*FileInfo) SetMode

func (fi *FileInfo) SetMode(mode os.FileMode)

SetMode sets the file mode

func (*FileInfo) Size

func (fi *FileInfo) Size() int64

Size provides the length in bytes for a file.

func (*FileInfo) Sys

func (fi *FileInfo) Sys() any

Sys provides the underlying data source (can return nil)

type Filesystem

type Filesystem struct {
	RedactedSecret string                 `json:"-"`
	Provider       sdk.FilesystemProvider `json:"provider"`
	S3Config       S3FsConfig             `json:"s3config,omitempty"`
	GCSConfig      GCSFsConfig            `json:"gcsconfig,omitempty"`
	AzBlobConfig   AzBlobFsConfig         `json:"azblobconfig,omitempty"`
	CryptConfig    CryptFsConfig          `json:"cryptconfig,omitempty"`
	SFTPConfig     SFTPFsConfig           `json:"sftpconfig,omitempty"`
	HTTPConfig     HTTPFsConfig           `json:"httpconfig,omitempty"`
}

Filesystem defines filesystem details

func (*Filesystem) GetACopy

func (f *Filesystem) GetACopy() Filesystem

GetACopy returns a filesystem copy

func (*Filesystem) HasRedactedSecret

func (f *Filesystem) HasRedactedSecret() bool

HasRedactedSecret returns true if configured the filesystem configuration has a redacted secret

func (*Filesystem) HideConfidentialData

func (f *Filesystem) HideConfidentialData()

HideConfidentialData hides filesystem confidential data

func (*Filesystem) IsEqual

func (f *Filesystem) IsEqual(other Filesystem) bool

IsEqual returns true if the fs is equal to other

func (*Filesystem) IsSameResource

func (f *Filesystem) IsSameResource(other Filesystem) bool

IsSameResource returns true if fs point to the same resource as other

func (*Filesystem) SetEmptySecrets

func (f *Filesystem) SetEmptySecrets()

SetEmptySecrets sets the secrets to empty

func (*Filesystem) SetEmptySecretsIfNil

func (f *Filesystem) SetEmptySecretsIfNil()

SetEmptySecretsIfNil sets the secrets to empty if nil

func (*Filesystem) SetNilSecretsIfEmpty

func (f *Filesystem) SetNilSecretsIfEmpty()

SetNilSecretsIfEmpty set the secrets to nil if empty. This is useful before rendering as JSON so the empty fields will not be serialized.

func (*Filesystem) Validate

func (f *Filesystem) Validate(additionalData string) error

Validate verifies the FsConfig matching the configured provider and sets all other Filesystem.*Config to their zero value if successful

type Fs

type Fs interface {
	Name() string
	ConnectionID() string
	Stat(name string) (os.FileInfo, error)
	Lstat(name string) (os.FileInfo, error)
	Open(name string, offset int64) (File, *pipeat.PipeReaderAt, func(), error)
	Create(name string, flag int) (File, *PipeWriter, func(), error)
	Rename(source, target string) error
	Remove(name string, isDir bool) error
	Mkdir(name string) error
	Symlink(source, target string) error
	Chown(name string, uid int, gid int) error
	Chmod(name string, mode os.FileMode) error
	Chtimes(name string, atime, mtime time.Time, isUploading bool) error
	Truncate(name string, size int64) error
	ReadDir(dirname string) ([]os.FileInfo, error)
	Readlink(name string) (string, error)
	IsUploadResumeSupported() bool
	IsAtomicUploadSupported() bool
	CheckRootPath(username string, uid int, gid int) bool
	ResolvePath(virtualPath string) (string, error)
	IsNotExist(err error) bool
	IsPermission(err error) bool
	IsNotSupported(err error) bool
	ScanRootDirContents() (int, int64, error)
	GetDirSize(dirname string) (int, int64, error)
	GetAtomicUploadPath(name string) string
	GetRelativePath(name string) string
	Walk(root string, walkFn filepath.WalkFunc) error
	Join(elem ...string) string
	HasVirtualFolders() bool
	GetMimeType(name string) (string, error)
	GetAvailableDiskSize(dirName string) (*sftp.StatVFS, error)
	CheckMetadata() error
	Close() error
}

Fs defines the interface for filesystem backends

func NewAzBlobFs

func NewAzBlobFs(connectionID, localTempDir, mountPath string, config AzBlobFsConfig) (Fs, error)

NewAzBlobFs returns an AzBlobFs object that allows to interact with Azure Blob storage

func NewCryptFs

func NewCryptFs(connectionID, rootDir, mountPath string, config CryptFsConfig) (Fs, error)

NewCryptFs returns a CryptFs object

func NewGCSFs

func NewGCSFs(connectionID, localTempDir, mountPath string, config GCSFsConfig) (Fs, error)

NewGCSFs returns an GCSFs object that allows to interact with Google Cloud Storage

func NewHTTPFs

func NewHTTPFs(connectionID, localTempDir, mountPath string, config HTTPFsConfig) (Fs, error)

NewHTTPFs returns an HTTPFs object that allows to interact with SFTPGo HTTP filesystem backends

func NewOsFs

func NewOsFs(connectionID, rootDir, mountPath string) Fs

NewOsFs returns an OsFs object that allows to interact with local Os filesystem

func NewS3Fs

func NewS3Fs(connectionID, localTempDir, mountPath string, s3Config S3FsConfig) (Fs, error)

NewS3Fs returns an S3Fs object that allows to interact with an s3 compatible object storage

func NewSFTPFs

func NewSFTPFs(connectionID, mountPath, localTempDir string, forbiddenSelfUsernames []string, config SFTPFsConfig) (Fs, error)

NewSFTPFs returns an SFTPFs object that allows to interact with an SFTP server

type FsRealPather

type FsRealPather interface {
	Fs
	RealPath(p string) (string, error)
}

FsRealPather is a Fs that implements the RealPath method.

type GCSFs

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

GCSFs is a Fs implementation for Google Cloud Storage.

func (*GCSFs) CheckMetadata

func (fs *GCSFs) CheckMetadata() error

CheckMetadata checks the metadata consistency

func (*GCSFs) CheckRootPath

func (fs *GCSFs) CheckRootPath(username string, uid int, gid int) bool

CheckRootPath creates the specified local root directory if it does not exists

func (*GCSFs) Chmod

func (*GCSFs) Chmod(name string, mode os.FileMode) error

Chmod changes the mode of the named file to mode.

func (*GCSFs) Chown

func (*GCSFs) Chown(name string, uid int, gid int) error

Chown changes the numeric uid and gid of the named file.

func (*GCSFs) Chtimes

func (fs *GCSFs) Chtimes(name string, atime, mtime time.Time, isUploading bool) error

Chtimes changes the access and modification times of the named file.

func (*GCSFs) Close

func (fs *GCSFs) Close() error

Close closes the fs

func (*GCSFs) ConnectionID

func (fs *GCSFs) ConnectionID() string

ConnectionID returns the connection ID associated to this Fs implementation

func (*GCSFs) Create

func (fs *GCSFs) Create(name string, flag int) (File, *PipeWriter, func(), error)

Create creates or opens the named file for writing

func (*GCSFs) GetAtomicUploadPath

func (*GCSFs) GetAtomicUploadPath(name string) string

GetAtomicUploadPath returns the path to use for an atomic upload. GCS uploads are already atomic, we never call this method for GCS

func (*GCSFs) GetAvailableDiskSize

func (*GCSFs) GetAvailableDiskSize(dirName string) (*sftp.StatVFS, error)

GetAvailableDiskSize returns the available size for the specified path

func (*GCSFs) GetDirSize

func (*GCSFs) GetDirSize(dirname string) (int, int64, error)

GetDirSize returns the number of files and the size for a folder including any subfolders

func (*GCSFs) GetMimeType

func (fs *GCSFs) GetMimeType(name string) (string, error)

GetMimeType returns the content type

func (*GCSFs) GetRelativePath

func (fs *GCSFs) GetRelativePath(name string) string

GetRelativePath returns the path for a file relative to the user's home dir. This is the path as seen by SFTPGo users

func (GCSFs) HasVirtualFolders

func (GCSFs) HasVirtualFolders() bool

HasVirtualFolders returns true if folders are emulated

func (*GCSFs) IsAtomicUploadSupported

func (*GCSFs) IsAtomicUploadSupported() bool

IsAtomicUploadSupported returns true if atomic upload is supported. S3 uploads are already atomic, we don't need to upload to a temporary file

func (*GCSFs) IsNotExist

func (*GCSFs) IsNotExist(err error) bool

IsNotExist returns a boolean indicating whether the error is known to report that a file or directory does not exist

func (*GCSFs) IsNotSupported

func (*GCSFs) IsNotSupported(err error) bool

IsNotSupported returns true if the error indicate an unsupported operation

func (*GCSFs) IsPermission

func (*GCSFs) IsPermission(err error) bool

IsPermission returns a boolean indicating whether the error is known to report that permission is denied.

func (*GCSFs) IsUploadResumeSupported

func (*GCSFs) IsUploadResumeSupported() bool

IsUploadResumeSupported returns true if resuming uploads is supported. Resuming uploads is not supported on GCS

func (*GCSFs) Join

func (*GCSFs) Join(elem ...string) string

Join joins any number of path elements into a single path

func (*GCSFs) Lstat

func (fs *GCSFs) Lstat(name string) (os.FileInfo, error)

Lstat returns a FileInfo describing the named file

func (*GCSFs) Mkdir

func (fs *GCSFs) Mkdir(name string) error

Mkdir creates a new directory with the specified name and default permissions

func (*GCSFs) Name

func (fs *GCSFs) Name() string

Name returns the name for the Fs implementation

func (*GCSFs) Open

func (fs *GCSFs) Open(name string, offset int64) (File, *pipeat.PipeReaderAt, func(), error)

Open opens the named file for reading

func (*GCSFs) ReadDir

func (fs *GCSFs) ReadDir(dirname string) ([]os.FileInfo, error)

ReadDir reads the directory named by dirname and returns a list of directory entries.

func (*GCSFs) Readlink(name string) (string, error)

Readlink returns the destination of the named symbolic link

func (*GCSFs) Remove

func (fs *GCSFs) Remove(name string, isDir bool) error

Remove removes the named file or (empty) directory.

func (*GCSFs) Rename

func (fs *GCSFs) Rename(source, target string) error

Rename renames (moves) source to target. We don't support renaming non empty directories since we should rename all the contents too and this could take long time: think about directories with thousands of files, for each file we should execute a CopyObject call.

func (*GCSFs) ResolvePath

func (fs *GCSFs) ResolvePath(virtualPath string) (string, error)

ResolvePath returns the matching filesystem path for the specified virtual path

func (*GCSFs) ScanRootDirContents

func (fs *GCSFs) ScanRootDirContents() (int, int64, error)

ScanRootDirContents returns the number of files contained in the bucket, and their size

func (*GCSFs) Stat

func (fs *GCSFs) Stat(name string) (os.FileInfo, error)

Stat returns a FileInfo describing the named file

func (*GCSFs) Symlink(source, target string) error

Symlink creates source as a symbolic link to target.

func (*GCSFs) Truncate

func (*GCSFs) Truncate(name string, size int64) error

Truncate changes the size of the named file. Truncate by path is not supported, while truncating an opened file is handled inside base transfer

func (*GCSFs) Walk

func (fs *GCSFs) Walk(root string, walkFn filepath.WalkFunc) error

Walk walks the file tree rooted at root, calling walkFn for each file or directory in the tree, including root

type GCSFsConfig

type GCSFsConfig struct {
	sdk.BaseGCSFsConfig
	Credentials *kms.Secret `json:"credentials,omitempty"`
}

GCSFsConfig defines the configuration for Google Cloud Storage based filesystem

func (*GCSFsConfig) HideConfidentialData

func (c *GCSFsConfig) HideConfidentialData()

HideConfidentialData hides confidential data

func (*GCSFsConfig) ValidateAndEncryptCredentials

func (c *GCSFsConfig) ValidateAndEncryptCredentials(additionalData string) error

ValidateAndEncryptCredentials validates the configuration and encrypts credentials if they are in plain text

type HTTPFs

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

HTTPFs is a Fs implementation for the SFTPGo HTTP filesystem backend

func (*HTTPFs) CheckMetadata

func (*HTTPFs) CheckMetadata() error

CheckMetadata checks the metadata consistency

func (*HTTPFs) CheckRootPath

func (fs *HTTPFs) CheckRootPath(username string, uid int, gid int) bool

CheckRootPath creates the specified local root directory if it does not exists

func (*HTTPFs) Chmod

func (fs *HTTPFs) Chmod(name string, mode os.FileMode) error

Chmod changes the mode of the named file to mode.

func (*HTTPFs) Chown

func (fs *HTTPFs) Chown(name string, uid int, gid int) error

Chown changes the numeric uid and gid of the named file.

func (*HTTPFs) Chtimes

func (fs *HTTPFs) Chtimes(name string, atime, mtime time.Time, isUploading bool) error

Chtimes changes the access and modification times of the named file.

func (*HTTPFs) Close

func (fs *HTTPFs) Close() error

Close closes the fs

func (*HTTPFs) ConnectionID

func (fs *HTTPFs) ConnectionID() string

ConnectionID returns the connection ID associated to this Fs implementation

func (*HTTPFs) Create

func (fs *HTTPFs) Create(name string, flag int) (File, *PipeWriter, func(), error)

Create creates or opens the named file for writing

func (*HTTPFs) GetAtomicUploadPath

func (*HTTPFs) GetAtomicUploadPath(name string) string

GetAtomicUploadPath returns the path to use for an atomic upload.

func (*HTTPFs) GetAvailableDiskSize

func (fs *HTTPFs) GetAvailableDiskSize(dirName string) (*sftp.StatVFS, error)

GetAvailableDiskSize returns the available size for the specified path

func (*HTTPFs) GetDirSize

func (fs *HTTPFs) GetDirSize(dirname string) (int, int64, error)

GetDirSize returns the number of files and the size for a folder including any subfolders

func (*HTTPFs) GetMimeType

func (fs *HTTPFs) GetMimeType(name string) (string, error)

GetMimeType returns the content type

func (*HTTPFs) GetRelativePath

func (fs *HTTPFs) GetRelativePath(name string) string

GetRelativePath returns the path for a file relative to the user's home dir. This is the path as seen by SFTPGo users

func (*HTTPFs) HasVirtualFolders

func (*HTTPFs) HasVirtualFolders() bool

HasVirtualFolders returns true if folders are emulated

func (*HTTPFs) IsAtomicUploadSupported

func (*HTTPFs) IsAtomicUploadSupported() bool

IsAtomicUploadSupported returns true if atomic upload is supported.

func (*HTTPFs) IsNotExist

func (*HTTPFs) IsNotExist(err error) bool

IsNotExist returns a boolean indicating whether the error is known to report that a file or directory does not exist

func (*HTTPFs) IsNotSupported

func (*HTTPFs) IsNotSupported(err error) bool

IsNotSupported returns true if the error indicate an unsupported operation

func (*HTTPFs) IsPermission

func (*HTTPFs) IsPermission(err error) bool

IsPermission returns a boolean indicating whether the error is known to report that permission is denied.

func (*HTTPFs) IsUploadResumeSupported

func (*HTTPFs) IsUploadResumeSupported() bool

IsUploadResumeSupported returns true if resuming uploads is supported.

func (*HTTPFs) Join

func (*HTTPFs) Join(elem ...string) string

Join joins any number of path elements into a single path

func (*HTTPFs) Lstat

func (fs *HTTPFs) Lstat(name string) (os.FileInfo, error)

Lstat returns a FileInfo describing the named file

func (*HTTPFs) Mkdir

func (fs *HTTPFs) Mkdir(name string) error

Mkdir creates a new directory with the specified name and default permissions

func (*HTTPFs) Name

func (fs *HTTPFs) Name() string

Name returns the name for the Fs implementation

func (*HTTPFs) Open

func (fs *HTTPFs) Open(name string, offset int64) (File, *pipeat.PipeReaderAt, func(), error)

Open opens the named file for reading

func (*HTTPFs) ReadDir

func (fs *HTTPFs) ReadDir(dirname string) ([]os.FileInfo, error)

ReadDir reads the directory named by dirname and returns a list of directory entries.

func (*HTTPFs) Readlink(name string) (string, error)

Readlink returns the destination of the named symbolic link

func (*HTTPFs) Remove

func (fs *HTTPFs) Remove(name string, isDir bool) error

Remove removes the named file or (empty) directory.

func (*HTTPFs) Rename

func (fs *HTTPFs) Rename(source, target string) error

Rename renames (moves) source to target.

func (*HTTPFs) ResolvePath

func (fs *HTTPFs) ResolvePath(virtualPath string) (string, error)

ResolvePath returns the matching filesystem path for the specified virtual path

func (*HTTPFs) ScanRootDirContents

func (fs *HTTPFs) ScanRootDirContents() (int, int64, error)

ScanRootDirContents returns the number of files and their size

func (*HTTPFs) Stat

func (fs *HTTPFs) Stat(name string) (os.FileInfo, error)

Stat returns a FileInfo describing the named file

func (*HTTPFs) Symlink(source, target string) error

Symlink creates source as a symbolic link to target.

func (*HTTPFs) Truncate

func (fs *HTTPFs) Truncate(name string, size int64) error

Truncate changes the size of the named file. Truncate by path is not supported, while truncating an opened file is handled inside base transfer

func (*HTTPFs) Walk

func (fs *HTTPFs) Walk(root string, walkFn filepath.WalkFunc) error

Walk walks the file tree rooted at root, calling walkFn for each file or directory in the tree, including root. The result are unordered

type HTTPFsConfig

type HTTPFsConfig struct {
	sdk.BaseHTTPFsConfig
	Password *kms.Secret `json:"password,omitempty"`
	APIKey   *kms.Secret `json:"api_key,omitempty"`
}

HTTPFsConfig defines the configuration for HTTP based filesystem

func (*HTTPFsConfig) HideConfidentialData

func (c *HTTPFsConfig) HideConfidentialData()

HideConfidentialData hides confidential data

func (*HTTPFsConfig) ValidateAndEncryptCredentials

func (c *HTTPFsConfig) ValidateAndEncryptCredentials(additionalData string) error

ValidateAndEncryptCredentials validates the config and encrypts credentials if they are in plain text

type OsFs

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

OsFs is a Fs implementation that uses functions provided by the os package.

func (*OsFs) CheckMetadata

func (*OsFs) CheckMetadata() error

CheckMetadata checks the metadata consistency

func (*OsFs) CheckRootPath

func (fs *OsFs) CheckRootPath(username string, uid int, gid int) bool

CheckRootPath creates the root directory if it does not exists

func (*OsFs) Chmod

func (*OsFs) Chmod(name string, mode os.FileMode) error

Chmod changes the mode of the named file to mode

func (*OsFs) Chown

func (*OsFs) Chown(name string, uid int, gid int) error

Chown changes the numeric uid and gid of the named file.

func (*OsFs) Chtimes

func (*OsFs) Chtimes(name string, atime, mtime time.Time, isUploading bool) error

Chtimes changes the access and modification times of the named file

func (*OsFs) Close

func (*OsFs) Close() error

Close closes the fs

func (*OsFs) ConnectionID

func (fs *OsFs) ConnectionID() string

ConnectionID returns the SSH connection ID associated to this Fs implementation

func (*OsFs) Create

func (*OsFs) Create(name string, flag int) (File, *PipeWriter, func(), error)

Create creates or opens the named file for writing

func (*OsFs) GetAtomicUploadPath

func (*OsFs) GetAtomicUploadPath(name string) string

GetAtomicUploadPath returns the path to use for an atomic upload

func (*OsFs) GetAvailableDiskSize

func (*OsFs) GetAvailableDiskSize(dirName string) (*sftp.StatVFS, error)

GetAvailableDiskSize returns the available size for the specified path

func (*OsFs) GetDirSize

func (fs *OsFs) GetDirSize(dirname string) (int, int64, error)

GetDirSize returns the number of files and the size for a folder including any subfolders

func (*OsFs) GetMimeType

func (fs *OsFs) GetMimeType(name string) (string, error)

GetMimeType returns the content type

func (*OsFs) GetRelativePath

func (fs *OsFs) GetRelativePath(name string) string

GetRelativePath returns the path for a file relative to the user's home dir. This is the path as seen by SFTPGo users

func (*OsFs) HasVirtualFolders

func (*OsFs) HasVirtualFolders() bool

HasVirtualFolders returns true if folders are emulated

func (*OsFs) IsAtomicUploadSupported

func (*OsFs) IsAtomicUploadSupported() bool

IsAtomicUploadSupported returns true if atomic upload is supported

func (*OsFs) IsNotExist

func (*OsFs) IsNotExist(err error) bool

IsNotExist returns a boolean indicating whether the error is known to report that a file or directory does not exist

func (*OsFs) IsNotSupported

func (*OsFs) IsNotSupported(err error) bool

IsNotSupported returns true if the error indicate an unsupported operation

func (*OsFs) IsPermission

func (*OsFs) IsPermission(err error) bool

IsPermission returns a boolean indicating whether the error is known to report that permission is denied.

func (*OsFs) IsUploadResumeSupported

func (*OsFs) IsUploadResumeSupported() bool

IsUploadResumeSupported returns true if resuming uploads is supported

func (*OsFs) Join

func (*OsFs) Join(elem ...string) string

Join joins any number of path elements into a single path

func (*OsFs) Lstat

func (fs *OsFs) Lstat(name string) (os.FileInfo, error)

Lstat returns a FileInfo describing the named file

func (*OsFs) Mkdir

func (*OsFs) Mkdir(name string) error

Mkdir creates a new directory with the specified name and default permissions

func (*OsFs) Name

func (fs *OsFs) Name() string

Name returns the name for the Fs implementation

func (*OsFs) Open

func (*OsFs) Open(name string, offset int64) (File, *pipeat.PipeReaderAt, func(), error)

Open opens the named file for reading

func (*OsFs) ReadDir

func (*OsFs) ReadDir(dirname string) ([]os.FileInfo, error)

ReadDir reads the directory named by dirname and returns a list of directory entries.

func (fs *OsFs) Readlink(name string) (string, error)

Readlink returns the destination of the named symbolic link as absolute virtual path

func (*OsFs) RealPath

func (fs *OsFs) RealPath(p string) (string, error)

RealPath implements the FsRealPather interface

func (*OsFs) Remove

func (*OsFs) Remove(name string, isDir bool) error

Remove removes the named file or (empty) directory.

func (*OsFs) Rename

func (fs *OsFs) Rename(source, target string) error

Rename renames (moves) source to target

func (*OsFs) ResolvePath

func (fs *OsFs) ResolvePath(virtualPath string) (string, error)

ResolvePath returns the matching filesystem path for the specified sftp path

func (*OsFs) ScanRootDirContents

func (fs *OsFs) ScanRootDirContents() (int, int64, error)

ScanRootDirContents returns the number of files contained in the root directory and their size

func (*OsFs) Stat

func (fs *OsFs) Stat(name string) (os.FileInfo, error)

Stat returns a FileInfo describing the named file

func (*OsFs) Symlink(source, target string) error

Symlink creates source as a symbolic link to target.

func (*OsFs) Truncate

func (*OsFs) Truncate(name string, size int64) error

Truncate changes the size of the named file

func (*OsFs) Walk

func (*OsFs) Walk(root string, walkFn filepath.WalkFunc) error

Walk walks the file tree rooted at root, calling walkFn for each file or directory in the tree, including root

type PipeWriter

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

PipeWriter defines a wrapper for pipeat.PipeWriterAt.

func NewPipeWriter

func NewPipeWriter(w *pipeat.PipeWriterAt) *PipeWriter

NewPipeWriter initializes a new PipeWriter

func (*PipeWriter) Close

func (p *PipeWriter) Close() error

Close waits for the upload to end, closes the pipeat.PipeWriterAt and returns an error if any.

func (*PipeWriter) Done

func (p *PipeWriter) Done(err error)

Done unlocks other goroutines waiting on Close(). It must be called when the upload ends

func (*PipeWriter) Write

func (p *PipeWriter) Write(data []byte) (int, error)

Write is a wrapper for pipeat Write

func (*PipeWriter) WriteAt

func (p *PipeWriter) WriteAt(data []byte, off int64) (int, error)

WriteAt is a wrapper for pipeat WriteAt

type QuotaCheckResult

type QuotaCheckResult struct {
	HasSpace     bool
	AllowedSize  int64
	AllowedFiles int
	UsedSize     int64
	UsedFiles    int
	QuotaSize    int64
	QuotaFiles   int
}

QuotaCheckResult defines the result for a quota check

func (*QuotaCheckResult) GetRemainingFiles

func (q *QuotaCheckResult) GetRemainingFiles() int

GetRemainingFiles returns the remaining allowed files

func (*QuotaCheckResult) GetRemainingSize

func (q *QuotaCheckResult) GetRemainingSize() int64

GetRemainingSize returns the remaining allowed size

type S3Fs

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

S3Fs is a Fs implementation for AWS S3 compatible object storages

func (*S3Fs) CheckMetadata

func (fs *S3Fs) CheckMetadata() error

CheckMetadata checks the metadata consistency

func (*S3Fs) CheckRootPath

func (fs *S3Fs) CheckRootPath(username string, uid int, gid int) bool

CheckRootPath creates the specified local root directory if it does not exists

func (*S3Fs) Chmod

func (*S3Fs) Chmod(name string, mode os.FileMode) error

Chmod changes the mode of the named file to mode.

func (*S3Fs) Chown

func (*S3Fs) Chown(name string, uid int, gid int) error

Chown changes the numeric uid and gid of the named file.

func (*S3Fs) Chtimes

func (fs *S3Fs) Chtimes(name string, atime, mtime time.Time, isUploading bool) error

Chtimes changes the access and modification times of the named file.

func (*S3Fs) Close

func (*S3Fs) Close() error

Close closes the fs

func (*S3Fs) ConnectionID

func (fs *S3Fs) ConnectionID() string

ConnectionID returns the connection ID associated to this Fs implementation

func (*S3Fs) Create

func (fs *S3Fs) Create(name string, flag int) (File, *PipeWriter, func(), error)

Create creates or opens the named file for writing

func (*S3Fs) GetAtomicUploadPath

func (*S3Fs) GetAtomicUploadPath(name string) string

GetAtomicUploadPath returns the path to use for an atomic upload. S3 uploads are already atomic, we never call this method for S3

func (*S3Fs) GetAvailableDiskSize

func (*S3Fs) GetAvailableDiskSize(dirName string) (*sftp.StatVFS, error)

GetAvailableDiskSize returns the available size for the specified path

func (*S3Fs) GetDirSize

func (*S3Fs) GetDirSize(dirname string) (int, int64, error)

GetDirSize returns the number of files and the size for a folder including any subfolders

func (*S3Fs) GetMimeType

func (fs *S3Fs) GetMimeType(name string) (string, error)

GetMimeType returns the content type

func (*S3Fs) GetRelativePath

func (fs *S3Fs) GetRelativePath(name string) string

GetRelativePath returns the path for a file relative to the user's home dir. This is the path as seen by SFTPGo users

func (*S3Fs) HasVirtualFolders

func (*S3Fs) HasVirtualFolders() bool

HasVirtualFolders returns true if folders are emulated

func (*S3Fs) IsAtomicUploadSupported

func (*S3Fs) IsAtomicUploadSupported() bool

IsAtomicUploadSupported returns true if atomic upload is supported. S3 uploads are already atomic, we don't need to upload to a temporary file

func (*S3Fs) IsNotExist

func (*S3Fs) IsNotExist(err error) bool

IsNotExist returns a boolean indicating whether the error is known to report that a file or directory does not exist

func (*S3Fs) IsNotSupported

func (*S3Fs) IsNotSupported(err error) bool

IsNotSupported returns true if the error indicate an unsupported operation

func (*S3Fs) IsPermission

func (*S3Fs) IsPermission(err error) bool

IsPermission returns a boolean indicating whether the error is known to report that permission is denied.

func (*S3Fs) IsUploadResumeSupported

func (*S3Fs) IsUploadResumeSupported() bool

IsUploadResumeSupported returns true if resuming uploads is supported. Resuming uploads is not supported on S3

func (*S3Fs) Join

func (*S3Fs) Join(elem ...string) string

Join joins any number of path elements into a single path

func (*S3Fs) Lstat

func (fs *S3Fs) Lstat(name string) (os.FileInfo, error)

Lstat returns a FileInfo describing the named file

func (*S3Fs) Mkdir

func (fs *S3Fs) Mkdir(name string) error

Mkdir creates a new directory with the specified name and default permissions

func (*S3Fs) Name

func (fs *S3Fs) Name() string

Name returns the name for the Fs implementation

func (*S3Fs) Open

func (fs *S3Fs) Open(name string, offset int64) (File, *pipeat.PipeReaderAt, func(), error)

Open opens the named file for reading

func (*S3Fs) ReadDir

func (fs *S3Fs) ReadDir(dirname string) ([]os.FileInfo, error)

ReadDir reads the directory named by dirname and returns a list of directory entries.

func (*S3Fs) Readlink(name string) (string, error)

Readlink returns the destination of the named symbolic link

func (*S3Fs) Remove

func (fs *S3Fs) Remove(name string, isDir bool) error

Remove removes the named file or (empty) directory.

func (*S3Fs) Rename

func (fs *S3Fs) Rename(source, target string) error

Rename renames (moves) source to target. We don't support renaming non empty directories since we should rename all the contents too and this could take long time: think about directories with thousands of files, for each file we should execute a CopyObject call.

func (*S3Fs) ResolvePath

func (fs *S3Fs) ResolvePath(virtualPath string) (string, error)

ResolvePath returns the matching filesystem path for the specified virtual path

func (*S3Fs) ScanRootDirContents

func (fs *S3Fs) ScanRootDirContents() (int, int64, error)

ScanRootDirContents returns the number of files contained in the bucket, and their size

func (*S3Fs) Stat

func (fs *S3Fs) Stat(name string) (os.FileInfo, error)

Stat returns a FileInfo describing the named file

func (*S3Fs) Symlink(source, target string) error

Symlink creates source as a symbolic link to target.

func (*S3Fs) Truncate

func (*S3Fs) Truncate(name string, size int64) error

Truncate changes the size of the named file. Truncate by path is not supported, while truncating an opened file is handled inside base transfer

func (*S3Fs) Walk

func (fs *S3Fs) Walk(root string, walkFn filepath.WalkFunc) error

Walk walks the file tree rooted at root, calling walkFn for each file or directory in the tree, including root. The result are unordered

type S3FsConfig

type S3FsConfig struct {
	sdk.BaseS3FsConfig
	AccessSecret *kms.Secret `json:"access_secret,omitempty"`
}

S3FsConfig defines the configuration for S3 based filesystem

func (*S3FsConfig) HideConfidentialData

func (c *S3FsConfig) HideConfidentialData()

HideConfidentialData hides confidential data

func (*S3FsConfig) ValidateAndEncryptCredentials

func (c *S3FsConfig) ValidateAndEncryptCredentials(additionalData string) error

ValidateAndEncryptCredentials validates the configuration and encrypts access secret if it is in plain text

type SFTPFs

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

SFTPFs is a Fs implementation for SFTP backends

func (*SFTPFs) CheckMetadata

func (*SFTPFs) CheckMetadata() error

CheckMetadata checks the metadata consistency

func (*SFTPFs) CheckRootPath

func (fs *SFTPFs) CheckRootPath(username string, uid int, gid int) bool

CheckRootPath creates the specified local root directory if it does not exists

func (*SFTPFs) Chmod

func (fs *SFTPFs) Chmod(name string, mode os.FileMode) error

Chmod changes the mode of the named file to mode.

func (*SFTPFs) Chown

func (fs *SFTPFs) Chown(name string, uid int, gid int) error

Chown changes the numeric uid and gid of the named file.

func (*SFTPFs) Chtimes

func (fs *SFTPFs) Chtimes(name string, atime, mtime time.Time, isUploading bool) error

Chtimes changes the access and modification times of the named file.

func (*SFTPFs) Close

func (fs *SFTPFs) Close() error

Close the connection

func (*SFTPFs) ConnectionID

func (fs *SFTPFs) ConnectionID() string

ConnectionID returns the connection ID associated to this Fs implementation

func (*SFTPFs) Create

func (fs *SFTPFs) Create(name string, flag int) (File, *PipeWriter, func(), error)

Create creates or opens the named file for writing

func (*SFTPFs) GetAtomicUploadPath

func (*SFTPFs) GetAtomicUploadPath(name string) string

GetAtomicUploadPath returns the path to use for an atomic upload

func (*SFTPFs) GetAvailableDiskSize

func (fs *SFTPFs) GetAvailableDiskSize(dirName string) (*sftp.StatVFS, error)

GetAvailableDiskSize returns the available size for the specified path

func (*SFTPFs) GetDirSize

func (fs *SFTPFs) GetDirSize(dirname string) (int, int64, error)

GetDirSize returns the number of files and the size for a folder including any subfolders

func (*SFTPFs) GetMimeType

func (fs *SFTPFs) GetMimeType(name string) (string, error)

GetMimeType returns the content type

func (*SFTPFs) GetRelativePath

func (fs *SFTPFs) GetRelativePath(name string) string

GetRelativePath returns the path for a file relative to the sftp prefix if any. This is the path as seen by SFTPGo users

func (*SFTPFs) HasVirtualFolders

func (*SFTPFs) HasVirtualFolders() bool

HasVirtualFolders returns true if folders are emulated

func (*SFTPFs) IsAtomicUploadSupported

func (fs *SFTPFs) IsAtomicUploadSupported() bool

IsAtomicUploadSupported returns true if atomic upload is supported.

func (*SFTPFs) IsNotExist

func (*SFTPFs) IsNotExist(err error) bool

IsNotExist returns a boolean indicating whether the error is known to report that a file or directory does not exist

func (*SFTPFs) IsNotSupported

func (*SFTPFs) IsNotSupported(err error) bool

IsNotSupported returns true if the error indicate an unsupported operation

func (*SFTPFs) IsPermission

func (*SFTPFs) IsPermission(err error) bool

IsPermission returns a boolean indicating whether the error is known to report that permission is denied.

func (*SFTPFs) IsUploadResumeSupported

func (fs *SFTPFs) IsUploadResumeSupported() bool

IsUploadResumeSupported returns true if resuming uploads is supported.

func (*SFTPFs) Join

func (*SFTPFs) Join(elem ...string) string

Join joins any number of path elements into a single path

func (*SFTPFs) Lstat

func (fs *SFTPFs) Lstat(name string) (os.FileInfo, error)

Lstat returns a FileInfo describing the named file

func (*SFTPFs) Mkdir

func (fs *SFTPFs) Mkdir(name string) error

Mkdir creates a new directory with the specified name and default permissions

func (*SFTPFs) Name

func (fs *SFTPFs) Name() string

Name returns the name for the Fs implementation

func (*SFTPFs) Open

func (fs *SFTPFs) Open(name string, offset int64) (File, *pipeat.PipeReaderAt, func(), error)

Open opens the named file for reading

func (*SFTPFs) ReadDir

func (fs *SFTPFs) ReadDir(dirname string) ([]os.FileInfo, error)

ReadDir reads the directory named by dirname and returns a list of directory entries.

func (fs *SFTPFs) Readlink(name string) (string, error)

Readlink returns the destination of the named symbolic link

func (*SFTPFs) RealPath

func (fs *SFTPFs) RealPath(p string) (string, error)

RealPath implements the FsRealPather interface

func (*SFTPFs) Remove

func (fs *SFTPFs) Remove(name string, isDir bool) error

Remove removes the named file or (empty) directory.

func (*SFTPFs) Rename

func (fs *SFTPFs) Rename(source, target string) error

Rename renames (moves) source to target.

func (*SFTPFs) ResolvePath

func (fs *SFTPFs) ResolvePath(virtualPath string) (string, error)

ResolvePath returns the matching filesystem path for the specified virtual path

func (*SFTPFs) ScanRootDirContents

func (fs *SFTPFs) ScanRootDirContents() (int, int64, error)

ScanRootDirContents returns the number of files contained in a directory and their size

func (*SFTPFs) Stat

func (fs *SFTPFs) Stat(name string) (os.FileInfo, error)

Stat returns a FileInfo describing the named file

func (fs *SFTPFs) Symlink(source, target string) error

Symlink creates source as a symbolic link to target.

func (*SFTPFs) Truncate

func (fs *SFTPFs) Truncate(name string, size int64) error

Truncate changes the size of the named file.

func (*SFTPFs) Walk

func (fs *SFTPFs) Walk(root string, walkFn filepath.WalkFunc) error

Walk walks the file tree rooted at root, calling walkFn for each file or directory in the tree, including root

type SFTPFsConfig

type SFTPFsConfig struct {
	sdk.BaseSFTPFsConfig
	Password      *kms.Secret `json:"password,omitempty"`
	PrivateKey    *kms.Secret `json:"private_key,omitempty"`
	KeyPassphrase *kms.Secret `json:"key_passphrase,omitempty"`
	// contains filtered or unexported fields
}

SFTPFsConfig defines the configuration for SFTP based filesystem

func (*SFTPFsConfig) HideConfidentialData

func (c *SFTPFsConfig) HideConfidentialData()

HideConfidentialData hides confidential data

func (*SFTPFsConfig) ValidateAndEncryptCredentials

func (c *SFTPFsConfig) ValidateAndEncryptCredentials(additionalData string) error

ValidateAndEncryptCredentials validates the config and encrypts credentials if they are in plain text

type VirtualFolder

type VirtualFolder struct {
	BaseVirtualFolder
	VirtualPath string `json:"virtual_path"`
	// Maximum size allowed as bytes. 0 means unlimited, -1 included in user quota
	QuotaSize int64 `json:"quota_size"`
	// Maximum number of files allowed. 0 means unlimited, -1 included in user quota
	QuotaFiles int `json:"quota_files"`
}

VirtualFolder defines a mapping between an SFTPGo exposed virtual path and a filesystem path outside the user home directory. The specified paths must be absolute and the virtual path cannot be "/", it must be a sub directory. The parent directory for the specified virtual path must exist. SFTPGo will try to automatically create any missing parent directory for the configured virtual folders at user login.

func (*VirtualFolder) CheckMetadataConsistency

func (v *VirtualFolder) CheckMetadataConsistency() error

CheckMetadataConsistency checks the consistency between the metadata stored in the configured metadata plugin and the filesystem

func (*VirtualFolder) GetACopy

func (v *VirtualFolder) GetACopy() VirtualFolder

GetACopy returns a copy

func (*VirtualFolder) GetFilesystem

func (v *VirtualFolder) GetFilesystem(connectionID string, forbiddenSelfUsers []string) (Fs, error)

GetFilesystem returns the filesystem for this folder

func (*VirtualFolder) HasNoQuotaRestrictions

func (v *VirtualFolder) HasNoQuotaRestrictions(checkFiles bool) bool

HasNoQuotaRestrictions returns true if no quota restrictions need to be applyed

func (*VirtualFolder) IsIncludedInUserQuota

func (v *VirtualFolder) IsIncludedInUserQuota() bool

IsIncludedInUserQuota returns true if the virtual folder is included in user quota

func (*VirtualFolder) ScanQuota

func (v *VirtualFolder) ScanQuota() (int, int64, error)

ScanQuota scans the folder and returns the number of files and their size

Jump to

Keyboard shortcuts

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