sshkit v0.3.0 SSHKit.SSH.Connection View Source

Defines a SSHKit.SSH.Connection struct representing a host connection.

A connection struct has the following fields:

  • host - the name or IP of the remote host
  • port - the port to connect to
  • options - additional connection options
  • ref - the underlying :ssh connection ref

Link to this section Summary

Functions

Closes an SSH connection.

Opens a connection to an SSH server.

Opens a new connection, based on the parameters of an existing one.

Link to this section Types

Link to this type

t()

View Source
t() :: SSHKit.SSH.Connection

Link to this section Functions

Closes an SSH connection.

Returns :ok.

For details, see :ssh.close/1.

Link to this function

open(host, options \\ [])

View Source

Opens a connection to an SSH server.

The following options are allowed:

  • :timeout: A timeout in ms after which a command is aborted. Defaults to :infinity.
  • :port: The remote-port to connect to. Defaults to 22.
  • :user: The username with which to connect.

         Defaults to `$LOGNAME` or `$USER` on UNIX, or `$USERNAME` on Windows.
  • :password: The password to login with.
  • :user_interaction: Defaults to false.

For a complete list of options and their default values, see: :ssh.connect/4.

Returns {:ok, conn} on success, {:error, reason} otherwise.

Link to this function

reopen(connection, options \\ [])

View Source

Opens a new connection, based on the parameters of an existing one.

The timeout value of the original connection is discarded. Other connection options are reused and may be overridden.

Uses SSHKit.SSH.open/2.

Returns {:ok, conn} or {:error, reason}.