SSHClient

Struct SSHClient 

Source
pub struct SSHClient<'a> { /* private fields */ }
Expand description

An async SSH client instance

The run() method runs the session to completion, with application behaviour defined by the CliBehaviour instance.

Once authentication has completed (authenticated() is called), the application may open remote channels with open_session_pty() etc.

This is async executor agnostic, though requires the CliBehaviour instance to be wrapped in a SunsetMutex.

Implementations§

Source§

impl<'a> SSHClient<'a>

Source

pub fn new(inbuf: &'a mut [u8], outbuf: &'a mut [u8]) -> Result<Self>

Source

pub async fn run<C: CliBehaviour>( &self, rsock: &mut impl Read, wsock: &mut impl Write, b: &SunsetMutex<C>, ) -> Result<()>

Runs the session to completion.

rsock and wsock are the SSH network channel (TCP port 22 or equivalent). b is an instance of CliBehaviour which defines application behaviour.

Source

pub async fn exit(&self)

Source

pub async fn open_session_nopty(&'a self) -> Result<(ChanInOut<'a>, ChanIn<'a>)>

Source

pub async fn open_session_pty(&'a self) -> Result<ChanInOut<'a>>

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.