pub struct SSHClient<'a> { /* private fields */ }
Expand description
An async SSH client instance
The run()
method runs the session to completion. progress()
must be polled, and responses given to the events provided.
Once authentication has completed (progress()
returns CliEvent::Authenticated
), the application
may open remote channels with open_session_pty()
etc.
This is async executor agnostic.
Implementations§
Source§impl<'a> SSHClient<'a>
impl<'a> SSHClient<'a>
pub fn new(inbuf: &'a mut [u8], outbuf: &'a mut [u8]) -> Self
Sourcepub async fn run(
&self,
rsock: &mut impl Read,
wsock: &mut impl Write,
) -> Result<()>
pub async fn run( &self, rsock: &mut impl Read, wsock: &mut impl Write, ) -> Result<()>
Runs the session to completion.
rsock
and wsock
are the SSH network channel (TCP port 22 or equivalent).
Sourcepub async fn progress<'g, 'f>(
&'g self,
ph: &'f mut ProgressHolder<'g, 'a, Client>,
) -> Result<CliEvent<'f, 'a>>
pub async fn progress<'g, 'f>( &'g self, ph: &'f mut ProgressHolder<'g, 'a, Client>, ) -> Result<CliEvent<'f, 'a>>
Returns an event from the SSH session.
Note that on return ProgressHolder
holds a mutex over the session,
so other calls to SSHClient
may block until the ProgressHolder
is dropped.
pub async fn open_session_nopty(&self) -> Result<(ChanInOut<'_>, ChanIn<'_>)>
pub async fn open_session_pty(&self) -> Result<ChanInOut<'_>>
Auto Trait Implementations§
impl<'a> !Freeze for SSHClient<'a>
impl<'a> !RefUnwindSafe for SSHClient<'a>
impl<'a> Send for SSHClient<'a>
impl<'a> !Sync for SSHClient<'a>
impl<'a> Unpin for SSHClient<'a>
impl<'a> !UnwindSafe for SSHClient<'a>
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