Documentation
¶
Index ¶
- Constants
- type Client
- func ConnectWithKey(host, username, privKey string) (*Client, error)
- func ConnectWithKeyFile(host, username, privKeyPath string) (*Client, error)
- func ConnectWithKeyFileTimeout(host, username, privKeyPath string, timeout time.Duration) (*Client, error)
- func ConnectWithKeyTimeout(host, username, privKey string, timeout time.Duration) (*Client, error)
- func ConnectWithPassword(host, username, pass string) (*Client, error)
- func ConnectWithPasswordTimeout(host, username, pass string, timeout time.Duration) (*Client, error)
- func (c *Client) Close() error
- func (c *Client) Delete(remote string) error
- func (c *Client) Download(remote, local string) error
- func (c *Client) Exec(cmd string) ([]byte, error)
- func (c *Client) FileExists(remote string) (bool, error)
- func (c *Client) ReadAll(filepath string) ([]byte, error)
- func (c *Client) SFTPClient() (*sftp.Client, error)
- func (c *Client) Upload(local, remote string) error
Constants ¶
const DefaultTimeout = 30 * time.Second
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
func ConnectWithKey ¶
Connect with a private key. If username is empty simplessh will attempt to get the current user.
func ConnectWithKeyFile ¶
Same as ConnectWithKeyFile but allows a custom timeout. If username is empty simplessh will attempt to get the current user.
func ConnectWithKeyFileTimeout ¶
func ConnectWithKeyFileTimeout(host, username, privKeyPath string, timeout time.Duration) (*Client, error)
Connect with a private key. If privKeyPath is an empty string it will attempt to use $HOME/.ssh/id_rsa. If username is empty simplessh will attempt to get the current user.
func ConnectWithKeyTimeout ¶
Connect with a private key with a custom timeout. If username is empty simplessh will attempt to get the current user.
func ConnectWithPassword ¶
Connect with a password. If username is empty simplessh will attempt to get the current user.
func ConnectWithPasswordTimeout ¶
func ConnectWithPasswordTimeout(host, username, pass string, timeout time.Duration) (*Client, error)
Same as ConnectWithPassword but allows a custom timeout. If username is empty simplessh will attempt to get the current user.
func (*Client) SFTPClient ¶
Return an sftp client. The client needs to be closed when it's no longer needed.