1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// Copyright 2017-2021 Lukas Pustina <lukas@pustina.de>
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except according to those terms.
//! `mhost` is a modern, high-performance DNS lookup library and CLI tool.
//!
//! It provides multi-server concurrent DNS lookups across UDP, TCP, TLS (DoT), and HTTPS (DoH)
//! transports, with support for 20+ DNS record types. The library can query many nameservers in
//! parallel and aggregate results, making it well suited for DNS diagnostics, propagation checking,
//! and subdomain discovery.
//!
//! # Quick Start — Builder API
//!
//! The easiest way to get started is with [`ResolverGroupBuilder`](resolver::ResolverGroupBuilder):
//!
//! ```no_run
//! use mhost::resolver::{ResolverGroupBuilder, MultiQuery};
//! use mhost::resolver::lookup::Uniquify;
//! use mhost::nameserver::predefined::PredefinedProvider;
//! use mhost::RecordType;
//! use std::time::Duration;
//!
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Build a resolver group with system nameservers + Google DNS
//! let resolvers = ResolverGroupBuilder::new()
//! .system()
//! .predefined(PredefinedProvider::Google)
//! .timeout(Duration::from_secs(3))
//! .build()
//! .await?;
//!
//! // Query for A and AAAA records
//! let query = MultiQuery::multi_record(
//! "example.com",
//! vec![RecordType::A, RecordType::AAAA],
//! )?;
//! let lookups = resolvers.lookup(query).await?;
//!
//! // Deduplicate results across nameservers
//! let a_records = lookups.a().unique().to_owned();
//! println!("A records: {:?}", a_records);
//! # Ok(())
//! # }
//! ```
//!
//! # Manual Construction
//!
//! For full control, you can construct resolvers manually:
//!
//! ```no_run
//! use mhost::nameserver::NameServerConfig;
//! use mhost::resolver::{MultiQuery, Resolver, ResolverConfig, ResolverGroup};
//! use mhost::resolver::lookup::Uniquify;
//! use mhost::RecordType;
//! use std::net::SocketAddr;
//!
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Create a ResolverGroup from the OS nameservers
//! let mut resolvers = ResolverGroup::from_system_config(Default::default())
//! .await?;
//!
//! // Add a custom resolver for Google DNS
//! let sock_addr: SocketAddr = "8.8.8.8:53".parse()?;
//! let config = ResolverConfig::new(NameServerConfig::udp(sock_addr));
//! let google = Resolver::new(config, Default::default()).await?;
//! resolvers.add(google);
//!
//! // Lookup A, AAAA, and TXT records
//! let query = MultiQuery::multi_record(
//! "example.com",
//! vec![RecordType::A, RecordType::AAAA, RecordType::TXT],
//! )?;
//! let lookups = resolvers.lookup(query).await?;
//! let a_records = lookups.a().unique().to_owned();
//! println!("A records: {:?}", a_records);
//! # Ok(())
//! # }
//! ```
pub use Error;
pub use IpNetwork;
pub use ;
pub use RecordType;
pub type Result<T> = Result;