clj-libssh2.session

Functions for creating and managing sessions.

close

(close session)
Disconnect an SSH session and discard the session.

Arguments:

session The Session that we want to disconnect and close.

Return:

nil.

open

(open host port credentials opts)
Connect to an SSH server, start a session and authenticate it.

Arguments:

host         The hostname or IP of the remote host.
port         The port to connect to.
credentials  An instance of clj-libssh2.authentication.Credentials or a map
             that can be transformed into one.
opts         A map with overrides for the default options.

Return:

A Session object for the connected and authenticated session.

sessions

An atomic set of currently active sessions. This is used to trigger calls to
libssh2/init and libssh2/exit at appropriate times. It's also used to
protect against attempting to close sessions twice.

with-session

macro

(with-session session session-params & body)
A convenience macro for running some code with a particular session.

Arguments:

session        This will be bound to a connected and authenticated Session.
session-params This is a map where the keys are any valid option (see
               default-opts) plus :hostname, :port and :credentials which
               will be passed as the first three arguments to open.