Struct openssh_mux_client::Connection

source ·
pub struct Connection { /* private fields */ }
Expand description

§Cancel safety

All methods of this struct is not cancellation safe.

Implementations§

source§

impl Connection

source

pub async fn connect<P: AsRef<Path>>(path: P) -> Result<Self>

source

pub async fn send_alive_check(&mut self) -> Result<NonZeroU32>

Send a ping to the server and return pid of the ssh mux server if it is still alive.

source

pub async fn open_new_session( self, session: &Session<'_>, fds: &[RawFd; 3], ) -> Result<EstablishedSession>

Opens a new session.

Consumes self so that users would not be able to create multiple sessions or perform other operations during the session that might complicates the handling of packets received from the ssh mux server.

Two additional cases that the client must cope with are it receiving a signal itself (from the ssh mux server) and the server disconnecting without sending an exit message.

  • fds - must be in blocking mode
source

pub async fn sftp(self, fds: &[RawFd; 3]) -> Result<EstablishedSession>

Convenient function for opening a new sftp session, uses open_new_session underlying.

source

pub async fn request_port_forward( &mut self, forward_type: ForwardType, listen_socket: &Socket<'_>, connect_socket: &Socket<'_>, ) -> Result<()>

Request for local/remote port forwarding.

source

pub async fn close_port_forward( &mut self, forward_type: ForwardType, listen_socket: &Socket<'_>, connect_socket: &Socket<'_>, ) -> Result<()>

Request for local/remote port forwarding closure.

source

pub async fn request_dynamic_forward( &mut self, listen_socket: &Socket<'_>, ) -> Result<NonZeroU32>

UNTESTED Return remote port opened for dynamic forwarding.

source

pub async fn request_stop_listening(&mut self) -> Result<()>

Request the master to stop accepting new multiplexing requests and remove its listener socket.

source

pub fn request_stop_listening_sync(self) -> Result<()>

Request the master to stop accepting new multiplexing requests and remove its listener socket.

Only suitable to use in Drop::drop.

Trait Implementations§

source§

impl Debug for Connection

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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, 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.