Struct async_ssh::Session
[−]
[src]
pub struct Session<S: AsyncRead + AsyncWrite>(_);
An established and authenticated SSH session.
You can use this session to execute commands on the remote host using [Session::open_exec
].
This will give you back a [Channel
], which can be used to read from the resulting process'
STDOUT
, or to write the the process' STDIN
.
Methods
impl<S: AsyncRead + AsyncWrite + Tcp + 'static> Session<S>
[src]
pub fn new(
stream: S,
handle: &Handle
) -> Result<NewSession<S>, HandlerError<()>>
[src]
stream: S,
handle: &Handle
) -> Result<NewSession<S>, HandlerError<()>>
Establish a new SSH session on top of the given stream.
The resulting SSH session is initially unauthenticated (see [NewSession
]), and must be
authenticated before it becomes useful.
Note that the reactor behind the given handle
must continue to be driven for any
channels created from this [Session
] to work.
pub fn last_error(&mut self) -> Option<HandlerError<()>>
[src]
Retrieve the last error encountered during this session.
Note that it is unlikely you will be able to use any items associated with this session once it has returned an error.
Calling this method clears the error.
pub fn open_exec<'a>(&mut self, cmd: &'a str) -> ChannelOpenFuture<'a, S>
[src]
Establish a new channel over this session to execute the given command.
Note that any errors encountered while operating on the channel after it has been opened
will manifest only as reads or writes no longer succeeding. To get the underlying error,
call [Session::last_error
].