Expand description
§microdns
A minimal DNS resolver library using only the Rust standard library.
This crate provides functionality to resolve various DNS record types, including MX records for mail servers and A/AAAA records for IP addresses.
§Example
use microdns::{lookup_mx_records, lookup_ip_addresses, resolve_mx_server_ips};
fn main() -> Result<(), microdns::Error> {
let domain = "google.com";
// Get MX records
let mx_records = lookup_mx_records(domain)?;
// Get IP addresses for a specific hostname
let ips = lookup_ip_addresses("smtp.google.com")?;
// Or resolve all MX servers to their IPs
let server_ips = resolve_mx_server_ips(domain)?;
Ok(())
}
Structs§
- DnsConfig
- DNS query configuration
- DnsHeader
- DNS header structure
- DnsRecord
- DNS record structure
- MxRecord
- MX record structure
- Server
IpRecord - Server with resolved IP addresses
Enums§
- Error
- Error type for DNS operations
- Record
Data - DNS record data variants
Constants§
- DEFAULT_
DNS_ SERVERS - Default DNS servers to try (in order)
- DNS_
TYPE_ A - DNS record type constants
- DNS_
TYPE_ AAAA - DNS_
TYPE_ MX
Functions§
- build_
dns_ query - Build DNS query packet
- lookup_
dns_ records - Send DNS query and get response using the specified configuration
- lookup_
ip_ addresses - Lookup IP addresses for a hostname
- lookup_
ip_ addresses_ with_ config - Lookup IP addresses for a hostname with custom configuration
- lookup_
mx_ records - Lookup MX records for a domain
- lookup_
mx_ records_ with_ config - Lookup MX records for a domain with custom configuration
- parse_
answer - Parse DNS answer record
- parse_
dns_ header - Parse DNS header from buffer
- parse_
dns_ name - Parse DNS name from buffer
- parse_
ip_ records - Parse IP records from DNS response
- parse_
mx_ records - Parse MX records from DNS response
- resolve_
mx_ server_ ips - Resolve MX records to their IP addresses
- resolve_
mx_ server_ ips_ with_ config - Resolve MX records to their IP addresses with custom configuration
- skip_
question - Skip DNS question section