pub struct ClientBuilder { /* private fields */ }Expand description
Builder for establishing a NETCONF client connection.
§Examples
use rustnetconf::Client;
let client = Client::connect("10.0.0.1:830")
.username("admin")
.password("secret")
.connect()
.await?;Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn key_passphrase(self, passphrase: &str) -> Self
pub fn key_passphrase(self, passphrase: &str) -> Self
Set the passphrase for the SSH private key.
Sourcepub fn vendor_profile(self, profile: Box<dyn VendorProfile>) -> Self
pub fn vendor_profile(self, profile: Box<dyn VendorProfile>) -> Self
Set an explicit vendor profile, overriding auto-detection.
Use this when auto-detection doesn’t work for your device, or when using a custom vendor implementation.
Sourcepub fn gather_facts(self, gather: bool) -> Self
pub fn gather_facts(self, gather: bool) -> Self
Control whether device facts are gathered after connecting.
When true (the default), the client sends a vendor-specific RPC
(e.g., <get-system-information/> on Junos) to populate
Client::facts() with the device’s hostname, model, version, and
serial number.
Set to false to skip facts gathering — useful for clustered devices
where the facts RPC may fail if a peer node is unreachable. Facts can
be gathered later via Client::gather_facts().
Sourcepub fn keepalive_interval(self, interval: Duration) -> Self
pub fn keepalive_interval(self, interval: Duration) -> Self
Set a keepalive interval for automatic session health checks.
When set, the client tracks the time since the last successful RPC.
Before each RPC, if more than interval has elapsed, a lightweight
probe is sent first. If the probe fails, the session is marked dead
and the caller can reconnect().
Default: no keepalive (disabled).
Sourcepub fn host_key_verification(self, policy: HostKeyVerification) -> Self
pub fn host_key_verification(self, policy: HostKeyVerification) -> Self
Set the SSH host key verification policy.
Controls how the client validates the device’s SSH host key during connection to protect against man-in-the-middle attacks.
Default: HostKeyVerification::AcceptAll (a warning is logged).
§Examples
use rustnetconf::Client;
use rustnetconf::transport::ssh::HostKeyVerification;
let client = Client::connect("10.0.0.1:830")
.username("admin")
.password("secret")
.host_key_verification(HostKeyVerification::Fingerprint(
"SHA256:abc123...".to_string(),
))
.connect()
.await?;Sourcepub async fn connect(self) -> Result<Client, NetconfError>
pub async fn connect(self) -> Result<Client, NetconfError>
Establish the SSH connection and perform the NETCONF hello exchange.