#[non_exhaustive]pub struct DnsConfig {
pub nameserver: String,
pub txt_prefix: String,
pub timeout_ms: u64,
}Expand description
Configuration for super::DomainVerifier.
Deserializes from YAML via serde. The txt_prefix and timeout_ms
fields have defaults and can be omitted.
§Example (YAML)
dns:
nameserver: "8.8.8.8:53"
txt_prefix: "_myapp-verify" # default: _modo-verify
timeout_ms: 5000 # default: 5000Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.nameserver: StringNameserver address, with or without port. Port 53 is appended when omitted.
Examples: "8.8.8.8:53", "1.1.1.1".
txt_prefix: StringPrefix prepended to the domain when looking up TXT records.
The resolved TXT lookup name is {txt_prefix}.{domain}.
Defaults to "_modo-verify".
timeout_ms: u64UDP receive timeout in milliseconds. Defaults to 5000.
Implementations§
Source§impl DnsConfig
impl DnsConfig
Sourcepub fn new(nameserver: impl Into<String>) -> Self
pub fn new(nameserver: impl Into<String>) -> Self
Create a DNS configuration with the given nameserver address.
Defaults: txt_prefix = "_modo-verify", timeout_ms = 5000.
Sourcepub fn parse_nameserver(&self) -> Result<SocketAddr>
pub fn parse_nameserver(&self) -> Result<SocketAddr>
Parse nameserver into a SocketAddr.
If the address already contains a port it is used as-is; otherwise port
53 is appended.
§Errors
Returns crate::Error with status 500 when the address is not a
valid IP or hostname+port.