pub enum Nameserver {
Addr(SocketAddr),
Host {
host: String,
port: u16,
},
}Expand description
A nameserver — either a literal address or a hostname to resolve later.
Serializes as a single string ("1.1.1.1", "1.1.1.1:53",
"dns.google", "dns.google:53").
Variants§
Addr(SocketAddr)
A literal socket address, ready to use.
Host
A hostname + port to be resolved at startup via the host’s resolver.
Implementations§
Source§impl Nameserver
impl Nameserver
Sourcepub async fn resolve(&self) -> Result<SocketAddr>
pub async fn resolve(&self) -> Result<SocketAddr>
Resolve to a concrete SocketAddr. Addr returns immediately;
Host performs a lookup via the host’s OS resolver (not this
interceptor — avoids bootstrap recursion) and returns the first
address.
Trait Implementations§
Source§impl Clone for Nameserver
impl Clone for Nameserver
Source§fn clone(&self) -> Nameserver
fn clone(&self) -> Nameserver
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 Nameserver
impl Debug for Nameserver
Source§impl<'de> Deserialize<'de> for Nameserver
impl<'de> Deserialize<'de> for Nameserver
Source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for Nameserver
impl Display for Nameserver
Source§impl From<IpAddr> for Nameserver
impl From<IpAddr> for Nameserver
Source§impl From<SocketAddr> for Nameserver
impl From<SocketAddr> for Nameserver
Source§fn from(sa: SocketAddr) -> Self
fn from(sa: SocketAddr) -> Self
Converts to this type from the input type.
Source§impl FromStr for Nameserver
Parse a user-supplied nameserver string.
impl FromStr for Nameserver
Parse a user-supplied nameserver string.
Accepted forms:
1.1.1.1— IPv4, port defaults to 531.1.1.1:5353— IPv4 with explicit port2606:4700:4700::1111— IPv6 (bare)[2606:4700:4700::1111]:53— IPv6 with port (brackets required)dns.google— hostname, port defaults to 53dns.google:53— hostname with port
Source§impl PartialEq for Nameserver
impl PartialEq for Nameserver
Source§fn eq(&self, other: &Nameserver) -> bool
fn eq(&self, other: &Nameserver) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for Nameserver
impl Serialize for Nameserver
impl Eq for Nameserver
impl StructuralPartialEq for Nameserver
Auto Trait Implementations§
impl Freeze for Nameserver
impl RefUnwindSafe for Nameserver
impl Send for Nameserver
impl Sync for Nameserver
impl Unpin for Nameserver
impl UnsafeUnpin for Nameserver
impl UnwindSafe for Nameserver
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
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.