Server and client SSH library. See the two example crates thrussh_client and thrussh_client on crates.io. More information here.
Here is an example, using Vecs as instances of Read and Write, instead of network sockets.
use Arc;
use ;
let client_keypair = generate_keypair.unwrap;
let server_keypair = generate_keypair.unwrap;
// Server instance
// Client instance
// Initialize the server
let server_config = ;
let mut server = S;
let mut server_connection = new;
// Initialize the client
let client_config = new;
let mut client = C;
let mut client_connection = new;
client_connection.set_auth_user;
client_connection.set_auth_public_key;
// Now, run the protocol (it is obviously more useful when the
// instances of Read and Write are networks sockets instead of Vec).
// Fake sockets.
let mut server_read: = Vecnew;
let mut server_write: = Vecnew;
// The server and client need extra workspace, we allocate these here.
let mut buffer0 = new;
let mut buffer1 = new;
let mut run_protocol = ;
// Run the protocol until authentication is complete.
while !client_connection.session.is_authenticated
// From the client, ask the server to open a channel (prepare buffers to do so).
let channel = client_connection.session.channel_open_session.unwrap;
// Then run the protocol again, until our channel is confirmed.
loop