use std::net::SocketAddr; use std::path::PathBuf; use std::fs; use serde::{Deserialize}; use toml; #[derive(Deserialize)] pub struct Config { pub dns_server: DnsServerConfig } #[derive(Deserialize)] pub struct DnsServerConfig { pub address: SocketAddr } pub fn load(file_name: PathBuf) -> Config { toml::from_str(&fs::read_to_string(file_name).expect("could not read config file")).expect("could not parse config file") }