pub struct RemoteSshSession { /* private fields */ }
Implementations§
Source§impl RemoteSshSession
impl RemoteSshSession
pub fn new<A>(
username: &str,
addr: A,
timeout: Option<Duration>,
private_key_path: Option<&Path>,
private_key_dir: Option<&Path>,
) -> Result<Self, SshError>where
A: ToSocketAddrs,
pub fn find_free_port(&mut self, start_port: u16, end_port: u16) -> Result<u16>
Sourcepub fn run_cmd(&mut self, cmd: &str) -> SshResult<u32>
pub fn run_cmd(&mut self, cmd: &str) -> SshResult<u32>
Runs the remote command through SSH and returns the exit status of the command
If you also want the output of the command, use run_cmd_get_result
.
Sourcepub fn run_cmd_get_result(&mut self, cmd: &str) -> SshResult<Vec<u8>>
pub fn run_cmd_get_result(&mut self, cmd: &str) -> SshResult<Vec<u8>>
Runs the remote command through SSH and returns the output/result of the command as UTF-8
This will block until the server closes the channel (meaning the command has to run to end)
Sourcepub fn get_cmd_output(&mut self) -> Option<Vec<u8>>
pub fn get_cmd_output(&mut self) -> Option<Vec<u8>>
If a command has been executed, consumes it and returns its result.
Blocks until the server has closed the connection
Auto Trait Implementations§
impl Freeze for RemoteSshSession
impl RefUnwindSafe for RemoteSshSession
impl Send for RemoteSshSession
impl !Sync for RemoteSshSession
impl Unpin for RemoteSshSession
impl UnwindSafe for RemoteSshSession
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more