pub struct ConnectionConfig {
pub host: SshHost,
pub port: SshPort,
pub username: SshUser,
pub password: SecretString,
pub key_path: Option<KeyPath>,
pub key_passphrase: Option<SecretString>,
pub timeout_ms: TimeoutMs,
pub known_hosts_path: Option<PathBuf>,
pub replace_host_key: bool,
pub tls: Option<TlsConnectOptions>,
pub use_agent: bool,
pub agent_socket: Option<PathBuf>,
}Expand description
SSH connection configuration.
Built from a crate::vps::model::VpsRecord at the time
of the call. Auth: private key (preferred), optional agent, and/or password.
Host, port, user, and timeout are domain-proven — empty host / port 0 are unrepresentable (G-TYPE-11: no redundant field checks).
When Self::tls is Some, the client dials TCP then completes a rustls
handshake (optional mTLS) before the SSH protocol (SSH-over-TLS).
Fields§
§host: SshHostSSH server hostname or IP.
port: SshPortSSH server TCP port (always ≥ 1).
username: SshUserSSH username.
password: SecretStringSSH password (SecretString for automatic zeroize); may be empty for key-only.
key_path: Option<KeyPath>OpenSSH private key path (optional).
key_passphrase: Option<SecretString>Key passphrase (optional).
timeout_ms: TimeoutMsTotal timeout for connect + handshake + authentication + exec, in ms.
known_hosts_path: Option<PathBuf>Path to known_hosts file (TOFU). None = test-only always-trust / product fail-closed.
replace_host_key: boolWhen true, allow replacing a divergent host key fingerprint.
tls: Option<TlsConnectOptions>Optional TLS wrapper (SSH-over-TLS / mTLS). None = plain TCP SSH.
use_agent: boolAttempt ssh-agent publickey auth (G-SSH-04). Socket from Self::agent_socket
or platform default (Windows named pipe only — Unix requires explicit path).
agent_socket: Option<PathBuf>Agent socket / named-pipe path (CLI or XDG). Never read from env store.
Implementations§
Source§impl ConnectionConfig
impl ConnectionConfig
Sourcepub fn validate(&self) -> SshCliResult<()>
pub fn validate(&self) -> SshCliResult<()>
Validates authentication material only (host/port/user proven by types).
Accepts password, key path, and/or agent (G-SSH-17).
Sourcepub fn resolved_agent_socket(&self) -> Option<PathBuf>
pub fn resolved_agent_socket(&self) -> Option<PathBuf>
Resolved agent endpoint path (CLI/XDG or Windows platform default).
Trait Implementations§
Source§impl Clone for ConnectionConfig
impl Clone for ConnectionConfig
Source§fn clone(&self) -> ConnectionConfig
fn clone(&self) -> ConnectionConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more