fs

package
v0.0.0-...-3ec66bb Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FS

type FS interface {
	Stat(path string) (*FileInfo, error)
	Read(path string) ([]byte, error)
	Write(path string, data []byte, mtime time.Time, mode os.FileMode) error
	Remove(path string) error
	ReadDir(path string) ([]*FileInfo, error)
	MkdirAll(path string) error
	Join(elem ...string) string
	Base(path string) string
	Dir(path string) string
	Rel(base, target string) (string, error)
}

type FakeResponse

type FakeResponse struct {
	Output []byte
	Err    error
}

type FakeSession

type FakeSession struct {
	Commands  []string
	Responses map[string]*FakeResponse
	StdinData map[string][]byte
	// contains filtered or unexported fields
}

func NewFakeSession

func NewFakeSession() *FakeSession

func (*FakeSession) Close

func (f *FakeSession) Close() error

func (*FakeSession) CombinedOutput

func (f *FakeSession) CombinedOutput(cmd string) ([]byte, error)

func (*FakeSession) Output

func (f *FakeSession) Output(cmd string) ([]byte, error)

func (*FakeSession) Run

func (f *FakeSession) Run(cmd string) error

func (*FakeSession) SetResponse

func (f *FakeSession) SetResponse(key string, resp *FakeResponse)

func (*FakeSession) StdinPipe

func (f *FakeSession) StdinPipe() (io.WriteCloser, error)

func (*FakeSession) Wait

func (f *FakeSession) Wait() error

type FileInfo

type FileInfo struct {
	Mode    os.FileMode
	Name    string
	Size    int64
	ModTime time.Time
	IsDir   bool
}

type LocalFS

type LocalFS struct{}

func NewLocalFS

func NewLocalFS() *LocalFS

func (*LocalFS) Base

func (fs *LocalFS) Base(path string) string

func (*LocalFS) Close

func (fs *LocalFS) Close() error

func (*LocalFS) CopyFrom

func (fs *LocalFS) CopyFrom(r io.Reader, path string, mtime time.Time, mode os.FileMode) error

func (*LocalFS) CopyTo

func (fs *LocalFS) CopyTo(w io.Writer, path string) error

func (*LocalFS) Dir

func (fs *LocalFS) Dir(path string) string

func (*LocalFS) Join

func (fs *LocalFS) Join(elem ...string) string

func (*LocalFS) MkdirAll

func (fs *LocalFS) MkdirAll(path string) error

func (*LocalFS) Read

func (fs *LocalFS) Read(path string) ([]byte, error)

func (*LocalFS) ReadDir

func (fs *LocalFS) ReadDir(path string) ([]*FileInfo, error)

func (*LocalFS) Rel

func (fs *LocalFS) Rel(base, target string) (string, error)

func (*LocalFS) Remove

func (fs *LocalFS) Remove(path string) error

func (*LocalFS) Stat

func (fs *LocalFS) Stat(path string) (*FileInfo, error)

func (*LocalFS) Write

func (fs *LocalFS) Write(path string, data []byte, mtime time.Time, mode os.FileMode) error

type ReadWriter

type ReadWriter interface {
	FS
	CopyTo(w io.Writer, path string) error
	CopyFrom(r io.Reader, path string, mtime time.Time, mode os.FileMode) error
	Close() error
}

func NewRemoteFS

func NewRemoteFS(client *ssh.Client) (ReadWriter, error)

type SFTPFS

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

func NewSFTPFS

func NewSFTPFS(sshClient *ssh.Client) (*SFTPFS, error)

func (*SFTPFS) Base

func (fs *SFTPFS) Base(remotePath string) string

func (*SFTPFS) Close

func (fs *SFTPFS) Close() error

func (*SFTPFS) CopyFrom

func (fs *SFTPFS) CopyFrom(r io.Reader, remotePath string, mtime time.Time, mode os.FileMode) error

func (*SFTPFS) CopyTo

func (fs *SFTPFS) CopyTo(w io.Writer, remotePath string) error

func (*SFTPFS) Dir

func (fs *SFTPFS) Dir(remotePath string) string

func (*SFTPFS) Join

func (fs *SFTPFS) Join(elem ...string) string

func (*SFTPFS) MkdirAll

func (fs *SFTPFS) MkdirAll(remotePath string) error

func (*SFTPFS) Read

func (fs *SFTPFS) Read(remotePath string) ([]byte, error)

func (*SFTPFS) ReadDir

func (fs *SFTPFS) ReadDir(remotePath string) ([]*FileInfo, error)

func (*SFTPFS) Rel

func (fs *SFTPFS) Rel(base, target string) (string, error)

func (*SFTPFS) Remove

func (fs *SFTPFS) Remove(remotePath string) error

func (*SFTPFS) SetMtime

func (fs *SFTPFS) SetMtime(remotePath string, mtime time.Time) error

func (*SFTPFS) Stat

func (fs *SFTPFS) Stat(remotePath string) (*FileInfo, error)

func (*SFTPFS) Write

func (fs *SFTPFS) Write(remotePath string, data []byte, mtime time.Time, mode os.FileMode) error

type Session

type Session interface {
	Run(cmd string) error
	Output(cmd string) ([]byte, error)
	CombinedOutput(cmd string) ([]byte, error)
	StdinPipe() (io.WriteCloser, error)
	Wait() error
	Close() error
}

type ShellFS

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

func NewShellFS

func NewShellFS(client *ssh.Client) (*ShellFS, error)

func NewShellFSWithSession

func NewShellFSWithSession(session Session) *ShellFS

func (*ShellFS) Base

func (fs *ShellFS) Base(remotePath string) string

func (*ShellFS) Close

func (fs *ShellFS) Close() error

func (*ShellFS) CopyFrom

func (fs *ShellFS) CopyFrom(r io.Reader, remotePath string, mtime time.Time, mode os.FileMode) error

func (*ShellFS) CopyTo

func (fs *ShellFS) CopyTo(w io.Writer, remotePath string) error

func (*ShellFS) Dir

func (fs *ShellFS) Dir(remotePath string) string

func (*ShellFS) Join

func (fs *ShellFS) Join(elem ...string) string

func (*ShellFS) MkdirAll

func (fs *ShellFS) MkdirAll(remotePath string) error

func (*ShellFS) Read

func (fs *ShellFS) Read(remotePath string) ([]byte, error)

func (*ShellFS) ReadDir

func (fs *ShellFS) ReadDir(remotePath string) ([]*FileInfo, error)

func (*ShellFS) Rel

func (fs *ShellFS) Rel(base, target string) (string, error)

func (*ShellFS) Remove

func (fs *ShellFS) Remove(remotePath string) error

func (*ShellFS) SetMtime

func (fs *ShellFS) SetMtime(remotePath string, mtime time.Time) error

func (*ShellFS) Stat

func (fs *ShellFS) Stat(remotePath string) (*FileInfo, error)

func (*ShellFS) Write

func (fs *ShellFS) Write(remotePath string, data []byte, mtime time.Time, mode os.FileMode) error

Jump to

Keyboard shortcuts

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