pub struct ConfigBuilder { /* private fields */ }Expand description
Builder for Config.
Created via Config::builder(). Call methods to customize, then
.build() to produce the final Config.
Implementations§
Source§impl ConfigBuilder
impl ConfigBuilder
Sourcepub fn protocols(self, protocols: &[Protocol]) -> Self
pub fn protocols(self, protocols: &[Protocol]) -> Self
Filter providers by protocol (e.g., DNS, HTTP, STUN)
§Example
use ip_discovery::{Config, Protocol};
let config = Config::builder()
.protocols(&[Protocol::Dns, Protocol::Stun])
.build();Sourcepub fn providers(self, providers: &[BuiltinProvider]) -> Self
pub fn providers(self, providers: &[BuiltinProvider]) -> Self
Select specific built-in providers
§Example
use ip_discovery::{Config, BuiltinProvider};
let config = Config::builder()
.providers(&[
BuiltinProvider::CloudflareDns,
BuiltinProvider::GoogleStun,
])
.build();Sourcepub fn add_provider(self, provider: Box<dyn Provider>) -> Self
pub fn add_provider(self, provider: Box<dyn Provider>) -> Self
Add a custom provider (advanced usage)
Custom providers are added alongside any filter-selected providers.
Sourcepub fn strategy(self, strategy: Strategy) -> Self
pub fn strategy(self, strategy: Strategy) -> Self
Set resolution strategy.
For Strategy::Consensus, min_agree is clamped to at least 2.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConfigBuilder
impl !RefUnwindSafe for ConfigBuilder
impl Send for ConfigBuilder
impl Sync for ConfigBuilder
impl Unpin for ConfigBuilder
impl UnsafeUnpin for ConfigBuilder
impl !UnwindSafe for ConfigBuilder
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