pub struct BootstrapPeersConfig {
pub peers: Vec<SocketAddr>,
}Expand description
Bootstrap peers loaded from a shipped configuration file.
This file provides initial peers for first-time network joins. It is separate from the bootstrap cache (which stores quality-ranked peers discovered at runtime).
Fields§
§peers: Vec<SocketAddr>The bootstrap peer socket addresses.
Implementations§
Source§impl BootstrapPeersConfig
impl BootstrapPeersConfig
Sourcepub fn from_file(path: &Path) -> Result<Self>
pub fn from_file(path: &Path) -> Result<Self>
Load bootstrap peers from a TOML file at the given path.
§Errors
Returns an error if the file cannot be read or contains invalid TOML.
Sourcepub fn discover() -> Option<(Self, PathBuf)>
pub fn discover() -> Option<(Self, PathBuf)>
Search well-known locations for a bootstrap_peers.toml file and load it.
Search order (first match wins):
$ANT_BOOTSTRAP_PEERS_PATHenvironment variable (path to file)- Same directory as the running executable
- Platform config directory (
~/.config/ant/on Linux,~/Library/Application Support/ant/on macOS,%APPDATA%\ant\on Windows) - System config:
/etc/ant/(Unix only)
Returns None if no file is found in any location.
Trait Implementations§
Source§impl Clone for BootstrapPeersConfig
impl Clone for BootstrapPeersConfig
Source§fn clone(&self) -> BootstrapPeersConfig
fn clone(&self) -> BootstrapPeersConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BootstrapPeersConfig
impl Debug for BootstrapPeersConfig
Source§impl<'de> Deserialize<'de> for BootstrapPeersConfig
impl<'de> Deserialize<'de> for BootstrapPeersConfig
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for BootstrapPeersConfig
impl RefUnwindSafe for BootstrapPeersConfig
impl Send for BootstrapPeersConfig
impl Sync for BootstrapPeersConfig
impl Unpin for BootstrapPeersConfig
impl UnsafeUnpin for BootstrapPeersConfig
impl UnwindSafe for BootstrapPeersConfig
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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