pub struct DnsSeeds { /* private fields */ }Expand description
Seed discovery via DNS, the SeedDiscovery for clusters whose nodes are named by DNS records instead of configured addresses.
Implementations§
Source§impl DnsSeeds
impl DnsSeeds
Sourcepub fn new(query: Query) -> Result<Self, DnsSeedsError>
pub fn new(query: Query) -> Result<Self, DnsSeedsError>
Discovery via the given Query, which a config file can provide. Resolves with the system resolver configuration; see with_resolver.
§Errors
Fails if the system resolver configuration cannot be read.
Sourcepub fn srv(name: impl Into<String>) -> Result<Self, DnsSeedsError>
pub fn srv(name: impl Into<String>) -> Result<Self, DnsSeedsError>
Discovery via the SRV records at the given name, e.g.
_tellus._udp.svc.cluster.example: every record contributes its port paired with each
address its target resolves to, so nodes can advertise differing ports. Resolves with
the system resolver configuration; see with_resolver.
§Errors
Fails if the system resolver configuration cannot be read.
Sourcepub fn ip(
name: impl Into<String>,
port: NonZeroU16,
) -> Result<Self, DnsSeedsError>
pub fn ip( name: impl Into<String>, port: NonZeroU16, ) -> Result<Self, DnsSeedsError>
Discovery via the A/AAAA records at the given name, every address paired with the given port: for clusters whose nodes all advertise one well known port. Resolves with the system resolver configuration; see with_resolver.
§Errors
Fails if the system resolver configuration cannot be read.
Sourcepub fn with_resolver(self, resolver: TokioResolver) -> Self
pub fn with_resolver(self, resolver: TokioResolver) -> Self
Replace the resolver DnsSeeds::new builds, e.g. by one pointed at specific name servers. That resolver keeps no response cache. A resolver which does returns the same addresses until its cached answer expires, so bootstrap sees nodes come and go only that late.
Trait Implementations§
Source§impl SeedDiscovery for DnsSeeds
impl SeedDiscovery for DnsSeeds
Source§type Error = DnsSeedsError
type Error = DnsSeedsError
Source§async fn resolve(&mut self) -> Result<Vec<SocketAddr>, DnsSeedsError>
async fn resolve(&mut self) -> Result<Vec<SocketAddr>, DnsSeedsError>
Auto Trait Implementations§
impl !RefUnwindSafe for DnsSeeds
impl !UnwindSafe for DnsSeeds
impl Freeze for DnsSeeds
impl Send for DnsSeeds
impl Sync for DnsSeeds
impl Unpin for DnsSeeds
impl UnsafeUnpin for DnsSeeds
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> 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