Skip to main content

AnvilConfig

Struct AnvilConfig 

Source
pub struct AnvilConfig {
Show 17 fields pub host: String, pub port: u16, pub username: String, pub identity_files: Vec<PathBuf>, pub cert_file: Option<PathBuf>, pub strict_host_key_checking: StrictHostKeyChecking, pub inactivity_timeout: Duration, pub custom_known_hosts: Option<PathBuf>, pub verbose: bool, pub fallback: Option<(String, u16)>, pub kex_algorithms: Option<Vec<String>>, pub ciphers: Option<Vec<String>>, pub macs: Option<Vec<String>>, pub host_key_algorithms: Option<Vec<String>>, pub connect_timeout: Option<Duration>, pub connection_attempts: Option<u32>, pub max_retry_window: Option<Duration>,
}
Expand description

Immutable configuration for an AnvilSession.

Construct via AnvilConfig::builder, or use one of the convenience constructors (github, gitlab, codeberg) for the most common targets.

Fields§

§host: String

Primary SSH host (e.g. github.com, gitlab.com, codeberg.org).

§port: u16

Primary SSH port (default: 22).

§username: String

Remote username (always git for hosted services; FR-13).

§identity_files: Vec<PathBuf>

Ordered list of identity-file paths. Tried in source order during authentication; an empty list falls through to the default search path (~/.ssh/id_ed25519, id_ecdsa, id_rsa). Populated by IdentityFile directives from ssh_config, by the AnvilConfigBuilder::add_identity_file / AnvilConfigBuilder::identity_files builder methods, and (for 0.2.x compatibility) by the deprecated AnvilConfigBuilder::identity_file method.

§cert_file: Option<PathBuf>

OpenSSH certificate path supplied via --cert (FR-12).

§strict_host_key_checking: StrictHostKeyChecking

Host-key verification policy. Defaults to StrictHostKeyChecking::Yes.

§inactivity_timeout: Duration

Inactivity timeout for the SSH session (FR-5).

GitHub’s idle threshold is around 60 s; this is the configured client-side inactivity timeout, not a per-packet deadline.

§custom_known_hosts: Option<PathBuf>

Path to a known_hosts-style file for custom or self-hosted instances (FR-7). Format: one hostname SHA256:<fp> entry per line.

§verbose: bool

Enable verbose debug logging when true.

§fallback: Option<(String, u16)>

Optional fallback host when port 22 is unavailable (FR-1).

GitHub: ssh.github.com:443. GitLab: altssh.gitlab.com:443. Codeberg has no published port-443 fallback.

§kex_algorithms: Option<Vec<String>>

Key-exchange algorithm preference (PRD §5.8.6 FR-76).

None selects crate::algorithms::anvil_default_kex — the curated default. Some(list) overrides; the list has already passed through crate::algorithms::apply_overrides (so any +/-/^ prefix has been resolved and the FR-78 denylist applied).

§ciphers: Option<Vec<String>>

Cipher preference (PRD §5.8.6 FR-76). None → curated default.

§macs: Option<Vec<String>>

MAC preference (PRD §5.8.6 FR-76). None → curated default. Mostly cosmetic for AEAD ciphers (chacha20-poly1305, AES-GCM) since they carry their own auth tag.

§host_key_algorithms: Option<Vec<String>>

Host-key algorithm preference (PRD §5.8.6 FR-76). None → curated default.

§connect_timeout: Option<Duration>

Per-attempt TCP connect timeout (PRD §5.8.7 FR-80). None disables the timeout (matches OpenSSH’s “no ConnectTimeout” semantics).

§connection_attempts: Option<u32>

Total number of connection attempts including the initial one (PRD §5.8.7 FR-80). None selects the curated default (crate::retry::RetryPolicy’s attempts = 3).

§max_retry_window: Option<Duration>

Hard ceiling on total elapsed wall-clock time across all retry attempts (PRD §5.8.7 FR-81). None selects the curated default (30 s). CLI-only — not part of OpenSSH’s ssh_config(5) grammar.

Implementations§

Source§

impl AnvilConfig

Source

pub fn builder(host: impl Into<String>) -> AnvilConfigBuilder

Begin building a config targeting host.

All optional fields default to sensible values. No fallback host is set by default; use the provider-specific convenience constructors (github, gitlab) if you want the port-443 fallback pre-configured.

Source

pub fn github() -> Self

Convenience constructor for the default GitHub target (github.com:22).

Includes the ssh.github.com:443 fallback pre-configured.

Source

pub fn gitlab() -> Self

Convenience constructor for the default GitLab target (gitlab.com:22).

Includes the altssh.gitlab.com:443 fallback pre-configured.

Source

pub fn codeberg() -> Self

Convenience constructor for Codeberg (codeberg.org:22).

Codeberg has no published port-443 SSH fallback; no fallback is set.

Source

pub fn identity_file(&self) -> Option<&Path>

👎Deprecated since 0.3.0:

read identity_files directly

First identity-file path, or None if Self::identity_files is empty. Provided as a 0.2.x compatibility shim — new code should read Self::identity_files directly.

Source

pub fn skip_host_check(&self) -> bool

👎Deprecated since 0.3.0:

read strict_host_key_checking directly

true when Self::strict_host_key_checking is StrictHostKeyChecking::No. Provided as a 0.2.x compatibility shim — new code should read Self::strict_host_key_checking directly.

Trait Implementations§

Source§

impl Clone for AnvilConfig

Source§

fn clone(&self) -> AnvilConfig

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 AnvilConfig

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