pub struct SshTunnel { /* private fields */ }Expand description
Live SSH local-forward to (remote_host, remote_port).
Public surface is intentionally tiny: the local port the caller should target, and an opaque drop guard. The accept loop, channel management, and byte splicing are private.
Implementations§
Source§impl SshTunnel
impl SshTunnel
pub fn local_port(&self) -> u16
Sourcepub async fn open(
ssh_client: Arc<RwLock<SshClient>>,
remote_host: String,
remote_port: u16,
) -> Result<Self>
pub async fn open( ssh_client: Arc<RwLock<SshClient>>, remote_host: String, remote_port: u16, ) -> Result<Self>
Open the listener and start the accept loop. Returns once the listener is bound; per-connection channels open lazily on inbound traffic.
Errors:
bindfails (vanishingly rare on127.0.0.1:0)- the SshClient is not connected (caller bug — should have confirmed before invoking)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SshTunnel
impl RefUnwindSafe for SshTunnel
impl Send for SshTunnel
impl Sync for SshTunnel
impl Unpin for SshTunnel
impl UnsafeUnpin for SshTunnel
impl UnwindSafe for SshTunnel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more