client

package
v2.0.0-...-10e4721 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT, MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client provides basic functionality to interact with a SFTP server.

func New

func New(config Config) (*Client, error)

New initialises SSH and SFTP clients and returns Client type to use.

func (*Client) Append

func (c *Client) Append(path string, data *bytes.Reader) error

func (*Client) Close

func (c *Client) Close()

Close closes open connections.

func (*Client) Connection

func (c *Client) Connection() (*sftp.Client, error)

func (*Client) Create

func (c *Client) Create(filePath string) (io.ReadWriteCloser, error)

Create creates a remote/destination file for I/O.

func (*Client) Download

func (c *Client) Download(filePath string) (io.ReadCloser, error)

Download returns remote/destination file for reading.

func (*Client) Info

func (c *Client) Info(filePath string) (os.FileInfo, error)

Info gets the details of a file. If the file was not found, an error is returned.

func (*Client) List

func (c *Client) List(path string) ([]os.FileInfo, error)

func (*Client) Mkdir

func (c *Client) Mkdir(path string) error

func (*Client) MkdirAll

func (c *Client) MkdirAll(path string) error

func (*Client) Remove

func (c *Client) Remove(path string) error

func (*Client) RemoveDir

func (c *Client) RemoveDir(path string) error

func (*Client) Stat

func (c *Client) Stat(path string) (os.FileInfo, error)

func (*Client) Touch

func (c *Client) Touch(path string) error

func (*Client) Upload

func (c *Client) Upload(source io.Reader, destination io.Writer, size int) error

Upload writes local/source file data streams to remote/destination file.

func (*Client) Write

func (c *Client) Write(path string, data *bytes.Reader) error

type Config

type Config struct {
	Username     string
	Password     string
	PrivateKey   string
	Server       string
	KeyExchanges []string

	Timeout time.Duration
}

Config represents SSH connection parameters.

Jump to

Keyboard shortcuts

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