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) 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
Click to show internal directories.
Click to hide internal directories.