SftpClient

package
v0.0.0-...-e1336f9 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2019 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const BufferSize = 1024

Variables

This section is empty.

Functions

This section is empty.

Types

type SftpClient

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

*

  • Addr : IP address of SFTP server
  • User : User to log in SFTP server
  • RemotePath : SFTP Path containing folder and files tree to access
  • RsaKeyFile : Absolute file to the local RSA key used for 'User' log in

func New

func New(addr, port, user, remotepath, rsakey string, checkhostkey bool) (*SftpClient, error)

*

  • New etablish the connection and instanciate the new SFTP client
  • check the host key in ~/.ssh/known_hosts if checkhostkey is true
  • Return a SftpClient struct

func (*SftpClient) Close

func (c *SftpClient) Close()

* Close closes the SFTP connection

func (*SftpClient) GetFiles

func (c *SftpClient) GetFiles(fileList []string) ([]string, error)

* GetFiles retrives all files passed in the "fileList" slice * Return a slice containing the local absolute name of downloaded files

func (*SftpClient) ListFiles

func (c *SftpClient) ListFiles() ([]string, error)

* Read the SFTP dir defined in var (*c).remotePath and return a slice containing all file names

func (*SftpClient) PutFiles

func (c *SftpClient) PutFiles(fileList []string) error

* Put all files contained in fileList to SFTP server, in c.remotePath path * Each fileList item must be the local absolute file name

func (*SftpClient) SetPath

func (c *SftpClient) SetPath(path string)

* SetPath allows to pass a different SFTP path than given during New instanciation

Jump to

Keyboard shortcuts

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