#[non_exhaustive]pub enum Uri {
#[non_exhaustive] Regular {
addr: IpAddr,
port: u16,
prefer_tcp: bool,
},
#[non_exhaustive] TLS {
host: Host,
port: u16,
},
#[non_exhaustive] HTTPS {
host: Host,
port: u16,
custom_http_endpoint: Option<String>,
force_http3: bool,
},
#[non_exhaustive] QUIC {
host: Host,
port: u16,
},
}Expand description
URI of a DNS server.
This implements parsing from the following string formats:
// Regular DNS, IPv4, without port (default port 53)
8.8.8.8
// Regular DNS, IPv4, with port
8.8.8.8:10053
// Regular DNS, IPv6, without port (default port 53)
[2001:4860:4860::8888]
// We don't accept bare IPv6 address without blanket.
2001:4860:4860::8888
// Regular DNS, IPv6, with port
[2001:4860:4860::8888]:10053
// Regular DNS, in URI format.
udp://8.8.8.8
udp://8.8.8.8:10053
tcp://[2001:4860:4860::8888]
tcp://[2001:4860:4860::8888]:10053
// DNS over TLS.
tls://dns.google
tls://dns.google:10853
// DNS over HTTPS, without custom endpoint.
https://dns.google
https://dns.google:8443
// DNS over HTTPS, with custom endpoint.
https://dns.google/dns-query
// For DoH, a root path `/` is also considered as a custom endpoint, please pay attention to this.
https://dns.google/
// For DoH / DoQ / DoT, you can specify custom SNI via query parameter `sni`.
tls://8.8.8.8?sni=dns.googleVariants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
#[non_exhaustive]Regular
Regular DNS, over UDP or TCP.
Fields
This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
#[non_exhaustive]TLS
DNS over TLS
Fields
This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
#[non_exhaustive]HTTPS
DNS over HTTPS
Fields
This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
#[non_exhaustive]QUIC
DNS over QUIC
Trait Implementations§
impl Eq for Uri
impl StructuralPartialEq for Uri
Auto Trait Implementations§
impl Freeze for Uri
impl RefUnwindSafe for Uri
impl Send for Uri
impl Sync for Uri
impl Unpin for Uri
impl UnwindSafe for Uri
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