sftputils

package
v0.0.101 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DEFAULT_KEY_EXCHANGE_ALGO = []string{"diffie-hellman-group-exchange-sha256"}

Functions

func RenameFile added in v0.0.91

func RenameFile(fName string) string

RenameFile Example function for rename the file before upload to S3 In this case we remove the first folder from the name Example: first_folder/second_folder/file_name.txt --> second_folder/file_name.txt

Types

type SFTPClient

type SFTPClient struct {
	Client *sftp.Client
	Bucket string
}

func (SFTPClient) Close added in v0.0.68

func (c SFTPClient) Close() error

func (SFTPClient) CreateDirectory

func (c SFTPClient) CreateDirectory(path string) error

func (SFTPClient) DeleteDirectory

func (c SFTPClient) DeleteDirectory(path string) error

func (SFTPClient) DeleteFile added in v0.0.51

func (c SFTPClient) DeleteFile(path string) error

func (SFTPClient) Exist

func (c SFTPClient) Exist(path string) (bool, error)

func (SFTPClient) Get

func (c SFTPClient) Get(remoteFile string) (*bytes.Buffer, error)

func (SFTPClient) IsDir

func (c SFTPClient) IsDir(path string) (bool, error)

func (SFTPClient) IsFile

func (c SFTPClient) IsFile(path string) (bool, error)

func (SFTPClient) List added in v0.0.71

func (c SFTPClient) List(path string) ([]string, error)

func (SFTPClient) Put

func (c SFTPClient) Put(data []byte, fpath string) error

type SFTPConf

type SFTPConf struct {
	Host     string `json:"host"`
	User     string `json:"user"`
	Password string `json:"pass"`
	Bucket   string `json:"bucket"`
	Port     int    `json:"port"`
	Timeout  int    `json:"timeout"`
	PrivKey  string `json:"priv_key"`
}

func (SFTPConf) NewConn

func (c SFTPConf) NewConn(keyExchanges ...string) (*SFTPClient, error)

NewConn Create a new SFTP connection by given parameters

func (SFTPConf) Validate added in v0.0.91

func (c SFTPConf) Validate() error

Jump to

Keyboard shortcuts

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