sftp

package
v0.0.0-...-da6fb33 Latest Latest
Warning

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

Go to latest
Published: May 29, 2020 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDefaultSSHKeyPath

func GetDefaultSSHKeyPath() string

GetDefaultSSHKeyPath default private key path

Types

type SSHInfo

type SSHInfo struct {
	IP       string
	User     string
	Key      string
	Password string
	Home     string
	// contains filtered or unexported fields
}

SSHInfo is a wrap for sftp client for webdav

func NewSftpDriver

func NewSftpDriver(info, defaultUser, defaultKey, defaultPasswd string) (sshInfo *SSHInfo, err error)

func (*SSHInfo) Dial

func (s *SSHInfo) Dial() (*ssh.Client, *sftp.Client, error)

Dial build a wrapped ssh client with given config

func (*SSHInfo) HomePath

func (s *SSHInfo) HomePath(path string) string

func (*SSHInfo) Mkdir

func (s *SSHInfo) Mkdir(ctx context.Context, name string, perm os.FileMode) error

warp for webdav

func (*SSHInfo) OpenFile

func (s *SSHInfo) OpenFile(ctx context.Context, name string, flag int, perm os.FileMode) (webdav.File, error)

func (*SSHInfo) RemoveAll

func (s *SSHInfo) RemoveAll(ctx context.Context, name string) error

func (*SSHInfo) Rename

func (s *SSHInfo) Rename(ctx context.Context, oldName, newName string) error

func (*SSHInfo) Stat

func (s *SSHInfo) Stat(ctx context.Context, name string) (os.FileInfo, error)

Stat with cache for speedup

Jump to

Keyboard shortcuts

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