refactor to async tokio with modular architecture

- Replace synchronous std::net::UdpSocket with tokio async runtime
- Spawn concurrent task per incoming DNS query via tokio::spawn
- Extract monolithic main.rs into modules: buffer, header, question,
  record, packet, config, cache, forward, stats
- Share state across tasks via Arc<ServerCtx> with scoped Mutex locks
- Add TOML config loading, TTL-aware cache, structured logging, stats
- Add CLAUDE.md, README, dns_fun.toml config, and design docs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Razvan Dimescu
2026-03-10 04:50:16 +02:00
parent 4e61caac45
commit 9c71e9bb3f
16 changed files with 1879 additions and 787 deletions

12
src/lib.rs Normal file
View File

@@ -0,0 +1,12 @@
pub mod buffer;
pub mod cache;
pub mod config;
pub mod forward;
pub mod header;
pub mod packet;
pub mod question;
pub mod record;
pub mod stats;
pub type Error = Box<dyn std::error::Error + Send + Sync>;
pub type Result<T> = std::result::Result<T, Error>;