sftp

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: AGPL-3.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// PasswordAuth indicates password-based authentication
	PasswordAuth = "passwordAuth"
	// KeyAuth indicates key-based authentication
	KeyAuth = "keyAuth"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	OpenFile(path string, f int) (io.ReadWriteCloser, error)
	Remove(path string) error
	MkdirAll(path string) error
	Reset() error
}

type FileManager

type FileManager interface {
	Upload(localFilePath, remoteDir string) error
	Download(remoteFilePath, localDir string) error
	Delete(remoteFilePath string) error
}

FileManager is an interface for managing files on a remote server

func NewFileManager

func NewFileManager(config *SSHConfig, opts ...Option) (FileManager, error)

NewFileManager is not concurrent safe. It should not be used from multiple goroutines concurrently without additional synchronization.

type Option added in v0.32.0

type Option func(impl *fileManagerImpl)

func WithRetryOnIdleConnection added in v0.32.0

func WithRetryOnIdleConnection() Option

WithRetryOnIdleConnection enables retrying the operation once in case of a "connection lost" error due to an idle connection.

type SSHConfig

type SSHConfig struct {
	HostName    string
	Port        int
	User        string
	AuthMethod  string
	PrivateKey  string
	Password    string // Password for password-based authentication
	DialTimeout time.Duration
}

SSHConfig represents the configuration for SSH connection

Directories

Path Synopsis
Package mock_sftp is a generated GoMock package.
Package mock_sftp is a generated GoMock package.

Jump to

Keyboard shortcuts

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