sftpfs

package
v0.0.0-...-957db32 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package sftpfs adapts an SFTP client to the vfs interfaces.

Paths here are interpreted by the server, not by the machine mdc runs on, so this package must not use path/filepath.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FS

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

FS is a vfs.WritableFS over an SFTP session.

func New

func New(client *sftp.Client, label string) *FS

New wraps an established client. label is the panel header, by convention "ssh://user@host".

func (*FS) Chmod

func (f *FS) Chmod(name string, mode fs.FileMode) error

func (*FS) Client

func (f *FS) Client() *sftp.Client

Client exposes protocol features the vfs interfaces do not cover.

func (*FS) Create

func (f *FS) Create(name string) (vfs.WriteFile, error)

func (*FS) Home

func (f *FS) Home() string

Home is where a panel opens when no path is given.

func (*FS) Label

func (f *FS) Label() string

func (*FS) Lstat

func (f *FS) Lstat(name string) (fs.FileInfo, error)

func (*FS) Mkdir

func (f *FS) Mkdir(name string, perm fs.FileMode) error

Mkdir creates a directory. SFTP's mkdir carries no mode, so the permission is a separate best-effort step.

func (*FS) MkdirAll

func (f *FS) MkdirAll(name string, perm fs.FileMode) error

func (*FS) Open

func (f *FS) Open(name string) (fs.File, error)

func (*FS) ReadDir

func (f *FS) ReadDir(name string) ([]fs.DirEntry, error)
func (f *FS) ReadLink(name string) (string, error)

func (*FS) Remove

func (f *FS) Remove(name string) error

func (*FS) RemoveAll

func (f *FS) RemoveAll(name string) error

RemoveAll removes name and everything beneath it. The client's own RemoveAll decides what to recurse into with a symlink-following stat, so deleting a link to a directory would take the target's contents with it. os.RemoveAll does not behave that way, and the two backends have to agree.

func (*FS) Rename

func (f *FS) Rename(oldname, newname string) error

func (*FS) Stat

func (f *FS) Stat(name string) (fs.FileInfo, error)

Jump to

Keyboard shortcuts

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