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
- Remote
Disconnect Info - Session
- Actual client session’s state.
Enums§
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) andConfig
specified. Returns a future that resolves to aHandle
. 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 theaddr
specified using atokio::net::TcpStream
and then callsconnect_stream
under the hood. - connect_
stream - Connect a stream to a server. This stream must implement
tokio::io::AsyncRead
andtokio::io::AsyncWrite
, as well asUnpin
andSend
. Typically, you may prefer to useconnect
, which uses atokio::net::TcpStream
and then calls this function under the hood.