pub struct SSHServer<'a> { /* private fields */ }Expand description
An async SSH server instance
The run() method runs the session to completion. progress()
must be polled, and responses given to the events provided.
Once the client has opened sessions, those can be retrieved with stdio()
and stdio_stderr() methods.
This is async executor agnostic.
Implementations§
Source§impl<'a> SSHServer<'a>
impl<'a> SSHServer<'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, Server>,
) -> Result<ServEvent<'f, 'a>>
pub async fn progress<'g, 'f>( &'g self, ph: &'f mut ProgressHolder<'g, 'a, Server>, ) -> Result<ServEvent<'f, 'a>>
Returns an event from the SSH session.
Note that on return ProgressHolder holds a mutex over the session,
so most other calls to SSHServer will block until the ProgressHolder
is dropped.
Sourcepub async fn stdio(&self, ch: ChanHandle) -> Result<ChanInOut<'_>>
pub async fn stdio(&self, ch: ChanHandle) -> Result<ChanInOut<'_>>
Returns a ChanInOut representing a channel.
ch is the ChanHandle returned after accepting a ServEvent::OpenSession event.
If stderr is also needed, use stdio_stderr() instead.
Sourcepub async fn stdio_stderr(
&self,
ch: ChanHandle,
) -> Result<(ChanInOut<'_>, ChanOut<'_>)>
pub async fn stdio_stderr( &self, ch: ChanHandle, ) -> Result<(ChanInOut<'_>, ChanOut<'_>)>
Retrieve the stdin/stdout/stderr streams.
See stdio().