pub trait SshServerContainer {
// Required methods
fn ssh_port(&self) -> u16;
fn host_ip(&self) -> IpAddr;
fn username(&self) -> &str;
fn password(&self) -> &str;
}Expand description
Common interface for SSH server containers (mock and real)
This trait defines the standard interface that all SSH server container implementations must provide. It enables polymorphic code that works with both mock and real containers.
§Example
use torrust_tracker_deployer_lib::testing::integration::ssh_server::{
SshServerContainer, MockSshServerContainer, RealSshServerContainer
};
async fn test_with_container<C: SshServerContainer>(container: &C) {
let port = container.ssh_port();
let ip = container.host_ip();
println!("SSH available at {}:{}", ip, port);
}Required Methods§
Sourcefn ssh_port(&self) -> u16
fn ssh_port(&self) -> u16
Get the SSH port mapped by the container
Returns the host port that maps to the container’s SSH port (22).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".