Module client

Source
Expand description

Client side of this library.

§Implementing clients

Maybe surprisingly, the data types used by Russh to implement clients are relatively more complicated than for servers. This is mostly related to the fact that clients are generally used both in a synchronous way (in the case of SSH, we can think of sending a shell command), and asynchronously (because the server may send unsollicited messages), and hence need to handle multiple interfaces.

The Session is passed to the Handler when the client receives data.

Check out the following examples:

Structs§

Config
The configuration of clients.
GexParams
Parameters for dynamic group Diffie-Hellman key exchanges.
Handle
Handle to a session, used to send messages to a client outside of the request/response cycle.
Prompt
RemoteDisconnectInfo
Session
Actual client session’s state.

Enums§

AuthResult
DisconnectReason
KeyboardInteractiveAuthResponse
Msg

Traits§

Handler
A client handler. Note that messages can be received from the server at any time during a session.

Functions§

connect
Connect to a server at the address specified, using the Handler (implemented by you) and Config specified. Returns a future that resolves to a Handle. This handle can then be used to create channels, which in turn can be used to tunnel TCP connections, request a PTY, execute commands, etc. The future will resolve to an error if the connection fails. This function creates a connection to the addr specified using a tokio::net::TcpStream and then calls connect_stream under the hood.
connect_stream
Connect a stream to a server. This stream must implement tokio::io::AsyncRead and tokio::io::AsyncWrite, as well as Unpin and Send. Typically, you may prefer to use connect, which uses a tokio::net::TcpStream and then calls this function under the hood.