Skip to main content

ConnectionConfig

Struct ConnectionConfig 

Source
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: SshHost

SSH server hostname or IP.

§port: SshPort

SSH server TCP port (always ≥ 1).

§username: SshUser

SSH username.

§password: SecretString

SSH 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: TimeoutMs

Total 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: bool

When true, allow replacing a divergent host key fingerprint.

§tls: Option<TlsConnectOptions>

Optional TLS wrapper (SSH-over-TLS / mTLS). None = plain TCP SSH.

§use_agent: bool

Attempt 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

Source

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).

Source

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

Source§

fn clone(&self) -> ConnectionConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ConnectionConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more