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
//! DNS Cache Module
//!
//! Provides DNS resolution caching with TTL support, negative caching for failed
//! lookups (to prevent retry storms), and IPv4/IPv6 preference sorting.
//!
//! # Features
//!
//! - **TTL-based expiration**: Cached entries expire after a configurable time-to-live
//! - **Negative caching**: Failed lookups are remembered to avoid immediate retries
//! - **IPv4 preference**: Addresses can be sorted with IPv4 first (matching C++ aria2 behavior)
//! - **Dependency injection**: Cache instances are created during engine initialization
//! and passed down, avoiding global mutable state
//!
//! # Example
//!
//! ```rust,no_run
//! use aria2_core::dns::dns_cache::DnsCache;
//!
//! #[tokio::main]
//! async fn main() {
//! let mut cache = DnsCache::with_ttl(300, 60);
//! match cache.resolve("example.com", 80).await {
//! Ok(addrs) => println!("Resolved: {:?}", addrs),
//! Err(e) => eprintln!("DNS error: {}", e),
//! }
//! }
//! ```
// Re-export all public items so that `dns_cache::X` still works for external consumers.
pub use DnsCache;
pub use ;