sftp

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

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

func NewSSHClient

func NewSSHClient(config *SSHConfig) (*ssh.Client, error)

NewSSHClient establishes an SSH connection and returns an SSH client

Types

type Client

type Client interface {
	OpenFile(path string, f int) (io.ReadWriteCloser, error)
	Remove(path string) error
	MkdirAll(path string) 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(sshClient *ssh.Client) (FileManager, error)

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