pub struct Config {
pub node: NodeConfig,
pub tun: TunConfig,
pub dns: DnsConfig,
pub transports: TransportsConfig,
pub peers: Vec<PeerConfig>,
pub gateway: Option<GatewayConfig>,
}Expand description
Root configuration structure.
Fields§
§node: NodeConfigNode configuration (node.*).
tun: TunConfigTUN interface configuration (tun.*).
dns: DnsConfigDNS responder configuration (dns.*).
transports: TransportsConfigTransport instances (transports.*).
peers: Vec<PeerConfig>Static peers to connect to (peers).
gateway: Option<GatewayConfig>Gateway configuration (gateway).
Implementations§
Source§impl Config
impl Config
Sourcepub fn load() -> Result<(Self, Vec<PathBuf>), ConfigError>
pub fn load() -> Result<(Self, Vec<PathBuf>), ConfigError>
Load configuration from the standard search paths.
Files are loaded in reverse priority order and merged:
/etc/fips/fips.yaml(loaded first, lowest priority)~/.config/fips/fips.yaml(user config)./fips.yaml(loaded last, highest priority)
Returns a tuple of (config, paths_loaded) where paths_loaded contains the paths that were successfully loaded.
Sourcepub fn load_from_paths(
paths: &[PathBuf],
) -> Result<(Self, Vec<PathBuf>), ConfigError>
pub fn load_from_paths( paths: &[PathBuf], ) -> Result<(Self, Vec<PathBuf>), ConfigError>
Load configuration from specific paths.
Paths are processed in order, with later paths overriding earlier ones.
Sourcepub fn load_file(path: &Path) -> Result<Self, ConfigError>
pub fn load_file(path: &Path) -> Result<Self, ConfigError>
Load configuration from a single file.
Sourcepub fn search_paths() -> Vec<PathBuf>
pub fn search_paths() -> Vec<PathBuf>
Get the standard search paths in priority order (lowest to highest).
Sourcepub fn merge(&mut self, other: Config)
pub fn merge(&mut self, other: Config)
Merge another configuration into this one.
Values from other override values in self when present.
Sourcepub fn create_identity(&self) -> Result<Identity, ConfigError>
pub fn create_identity(&self) -> Result<Identity, ConfigError>
Create an Identity from this configuration.
If an nsec is configured, uses that to create the identity. Otherwise, generates a new random identity.
Sourcepub fn has_identity(&self) -> bool
pub fn has_identity(&self) -> bool
Check if an identity is configured (vs. will be generated).
Sourcepub fn is_leaf_only(&self) -> bool
pub fn is_leaf_only(&self) -> bool
Check if leaf-only mode is configured.
Sourcepub fn peers(&self) -> &[PeerConfig]
pub fn peers(&self) -> &[PeerConfig]
Get the configured peers.
Sourcepub fn auto_connect_peers(&self) -> impl Iterator<Item = &PeerConfig>
pub fn auto_connect_peers(&self) -> impl Iterator<Item = &PeerConfig>
Get peers that should auto-connect on startup.
Sourcepub fn validate(&self) -> Result<(), ConfigError>
pub fn validate(&self) -> Result<(), ConfigError>
Validate cross-field configuration invariants.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more