pub struct SshServiceChecker { /* private fields */ }Expand description
SSH Service Checker for testing service availability
This checker performs lightweight connectivity tests to determine if an SSH daemon is running and accepting connections on a given host and port. It does not attempt to authenticate or establish a working SSH session.
The checker uses minimal SSH commands with short timeouts and batch mode to quickly determine service availability without user interaction.
Implementations§
Source§impl SshServiceChecker
impl SshServiceChecker
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new SSH service checker with default settings
Default connection timeout is 5 seconds.
Sourcepub fn with_timeout(connect_timeout: u16) -> Self
pub fn with_timeout(connect_timeout: u16) -> Self
Create a new SSH service checker with custom connection timeout
§Arguments
connect_timeout- Timeout in seconds for connection attempts
Sourcepub fn is_service_available(&self, socket_addr: SocketAddr) -> Result<bool>
pub fn is_service_available(&self, socket_addr: SocketAddr) -> Result<bool>
Check if SSH service is available at the specified socket address
This method attempts a minimal SSH connection to test service availability. It distinguishes between:
- Service not available (connection refused, no route to host)
- Service available (authentication failures are considered as service available)
§Arguments
socket_addr- The socket address (IP and port) to test
§Returns
Ok(true)- SSH service is available and accepting connectionsOk(false)- SSH service is not available or not reachableErr(SshServiceError)- Command execution error (e.g., ssh binary not found)
§Errors
Returns an error if the SSH command cannot be executed (e.g., ssh binary not found or process was terminated by signal).
Trait Implementations§
Source§impl Debug for SshServiceChecker
impl Debug for SshServiceChecker
Auto Trait Implementations§
impl Freeze for SshServiceChecker
impl RefUnwindSafe for SshServiceChecker
impl Send for SshServiceChecker
impl Sync for SshServiceChecker
impl Unpin for SshServiceChecker
impl UnsafeUnpin for SshServiceChecker
impl UnwindSafe for SshServiceChecker
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
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> ⓘ
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> ⓘ
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request