Documentation
¶
Overview ¶
Package sftpfs implements vfs.FS over SFTP (seedboxes, NAS), with pinned host keys (TOFU confirmed by the user), keepalives and lazy reconnection.
Index ¶
- Variables
- func New(ctx context.Context, cfg Config) (vfs.FS, error)
- func Probe(ctx context.Context, cfg Config) (string, error)
- type Config
- type FS
- func (f *FS) Close() error
- func (f *FS) InputURL(string) string
- func (f *FS) Open(ctx context.Context, name string) (vfs.File, error)
- func (f *FS) Ping(ctx context.Context) error
- func (f *FS) ReadDir(ctx context.Context, dir string) ([]vfs.Entry, error)
- func (f *FS) Stat(ctx context.Context, name string) (vfs.Entry, error)
- func (f *FS) Walk(ctx context.Context, dir string, fn func(vfs.Entry) error) error
- type HostKeyError
Constants ¶
This section is empty.
Variables ¶
View Source
var ( KeepaliveInterval = 30 * time.Second KeepaliveTimeout = 15 * time.Second )
Tunables (variables for tests).
View Source
var ErrAuth = errors.New("sftp: authentication failed")
ErrAuth is returned when the server rejects the credentials.
View Source
var ErrClosed = errors.New("sftp: source closed")
ErrClosed is returned after Close.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Host string
Port int // default 22
User string
Password string
PrivateKey []byte // PEM (OpenSSH format accepted)
Passphrase string
HostKey string // "SHA256:..." fingerprint, required
Root string // absolute remote path
Timeout time.Duration
}
Config describes an SFTP source.
type FS ¶
type FS struct {
// contains filtered or unexported fields
}
FS is an SFTP source.
type HostKeyError ¶
HostKeyError is returned when the server's host key is not pinned yet (Mismatch false: show Fingerprint to the user for confirmation) or differs from the pinned one (Mismatch true: possible spoofing).
func (*HostKeyError) Error ¶
func (e *HostKeyError) Error() string
Click to show internal directories.
Click to hide internal directories.