Skip to main content

AnvilConfigBuilder

Struct AnvilConfigBuilder 

Source
pub struct AnvilConfigBuilder { /* private fields */ }
Expand description

Builder for AnvilConfig.

Obtained via AnvilConfig::builder.

Implementations§

Source§

impl AnvilConfigBuilder

Source

pub fn port(self, port: u16) -> Self

Override the target SSH port (default: 22, FR-1).

Source

pub fn username(self, username: impl Into<String>) -> Self

Override the remote username (default: "git", FR-13).

Source

pub fn add_identity_file(self, path: impl Into<PathBuf>) -> Self

Append path to the ordered identity-file list (FR-9).

Use this to add CLI-supplied keys; ssh_config-supplied keys flow in through Self::apply_ssh_config. Both can coexist; auth tries them in the order they were added.

Source

pub fn identity_files(self, paths: Vec<PathBuf>) -> Self

Replace the entire identity-file list with paths. Existing entries are discarded.

Source

pub fn identity_file(self, path: impl Into<PathBuf>) -> Self

👎Deprecated since 0.3.0:

use add_identity_file or identity_files for the multi-key API

Set a single identity-file path, replacing any existing entries.

0.2.x compatibility shim. New code should use Self::add_identity_file (additive) or Self::identity_files (replace-all) for clarity.

Source

pub fn cert_file(self, path: impl Into<PathBuf>) -> Self

Set an OpenSSH certificate path (FR-12).

Source

pub fn strict_host_key_checking(self, policy: StrictHostKeyChecking) -> Self

Set the host-key verification policy (FR-8).

Source

pub fn skip_host_check(self, skip: bool) -> Self

👎Deprecated since 0.3.0:

use strict_host_key_checking(StrictHostKeyChecking::No) for clarity

Disable host-key verification. Use only for emergencies (FR-8).

true maps to StrictHostKeyChecking::No; false to StrictHostKeyChecking::Yes. Lossless from the 0.2.x boolean shape (which only encoded those two states).

Source

pub fn inactivity_timeout(self, timeout: Duration) -> Self

Override the session inactivity timeout (FR-5).

Source

pub fn custom_known_hosts(self, path: impl Into<PathBuf>) -> Self

Path to a custom known_hosts-style file for self-hosted instances (FR-7).

Source

pub fn verbose(self, verbose: bool) -> Self

Enable verbose debug logging.

Source

pub fn fallback(self, fallback: Option<(String, u16)>) -> Self

Override the fallback host/port. Pass None to disable fallback.

Source

pub fn kex_algorithms(self, list: Option<Vec<String>>) -> Self

Override the key-exchange algorithm preference (PRD §5.8.6 FR-76).

Pass None to keep the curated default (crate::algorithms::anvil_default_kex). The list is expected to have already passed through crate::algorithms::apply_overrides so any +/-/^ prefix is resolved and the FR-78 denylist applied.

Source

pub fn ciphers(self, list: Option<Vec<String>>) -> Self

Override the cipher preference (PRD §5.8.6 FR-76).

Source

pub fn macs(self, list: Option<Vec<String>>) -> Self

Override the MAC preference (PRD §5.8.6 FR-76).

Source

pub fn host_key_algorithms(self, list: Option<Vec<String>>) -> Self

Override the host-key algorithm preference (PRD §5.8.6 FR-76).

Source

pub fn apply_ssh_config(self, resolved: &ResolvedSshConfig) -> Self

Layer values from a ResolvedSshConfig into this builder.

Provides ssh_config-derived defaults that subsequent builder calls can still override (call this before CLI-derived overrides if you want CLI to win). The following mappings are applied:

ssh_config directiveBuilder field
HostNamehost (overridden)
Portport (overridden)
Userusername (overridden)
IdentityFile (multi)identity_files (extended)
StrictHostKeyCheckingstrict_host_key_checking (overridden)
UserKnownHostsFile (first)custom_known_hosts (filled if None)

Algorithm directives (HostKeyAlgorithms, KexAlgorithms, Ciphers, MACs) are honored as of M17 (PRD §5.8.6 FR-76): each parsed AlgList is fed through crate::algorithms::apply_overrides against the matching curated default, so an ssh_config value of +algo,algo appends to Anvil’s defaults rather than replacing them. ConnectTimeout / ConnectionAttempts remain deferred to M18.

§Errors

This method is infallible by signature, but a malformed algorithm list (denylisted entry referenced by an override) is logged at warn level and silently dropped — the connection then falls back to the curated default. Callers who want strict validation should run the same value through crate::algorithms::apply_overrides explicitly before calling here.

Source

pub fn build(self) -> AnvilConfig

Finalise and return the AnvilConfig.

Trait Implementations§

Source§

impl Debug for AnvilConfigBuilder

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> 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, 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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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