Async SSH tunnel through a jump host.
Examples
use std::borrow::Cow;
use ssh_jumper::{
model::{HostAddress, HostSocketParams, JumpHostAuthParams, SshTunnelParams},
SshJumper
};
let (local_socket_addr, ssh_forwarder_end_rx) = {
let jump_host = HostAddress::HostName(Cow::Borrowed("bastion.com"));
let jump_host_auth_params = JumpHostAuthParams::new(
Cow::Borrowed("my_user"),
Cow::Borrowed(Path::new("~/.ssh/id_rsa")),
);
let target_socket = HostSocketParams {
address: HostAddress::HostName(Cow::Borrowed("target_host")),
port: 8080,
};
let ssh_params =
SshTunnelParams::new(jump_host, jump_host_auth_params, target_socket)
.with_local_port(1234);
SshJumper::open_tunnel(&ssh_params).await?
};