use std::net::SocketAddr; use server::handle_query; use tokio::net::UdpSocket; use packet::Result; mod server; mod config; pub use config::Config as Config; pub struct DnsResolver { config: Config } impl DnsResolver { pub fn new(config: Config) -> Self { Self { config } } pub async fn bind(self, addr: SocketAddr) -> Result<()> { let socket = UdpSocket::bind(addr).await?; loop { match handle_query(&socket, &self.config).await { Ok(_) => {} Err(e) => eprintln!("An error occurred: {e}"), } } } }