You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.7 KiB

use dnsbox_base::common_types::{types};
use dnsbox_base::common_types::{DnsName, DnsCompressedName};
use dnsbox_base::records::{NS, A, AAAA};
use dnsbox_base::ser::RRData;
use std::net::{Ipv4Addr, Ipv6Addr};
#[rustfmt::skip]
static DATA: [(&str, &str, &str); 13] = [
("a.root-servers.net.", "198.41.0.4", "2001:503:ba3e::2:30"),
("b.root-servers.net.", "199.9.14.201", "2001:500:200::b"),
("c.root-servers.net.", "192.33.4.12", "2001:500:2::c"),
("d.root-servers.net.", "199.7.91.13", "2001:500:2d::d"),
("e.root-servers.net.", "192.203.230.10", "2001:500:a8::e"),
("f.root-servers.net.", "192.5.5.241", "2001:500:2f::f"),
("g.root-servers.net.", "192.112.36.4", "2001:500:12::d0d"),
("h.root-servers.net.", "198.97.190.53", "2001:500:1::53"),
("i.root-servers.net.", "192.36.148.17", "2001:7fe::53"),
("j.root-servers.net.", "192.58.128.30", "2001:503:c27::2:30"),
("k.root-servers.net.", "193.0.14.129", "2001:7fd::1"),
("l.root-servers.net.", "199.7.83.42", "2001:500:9f::42"),
("m.root-servers.net.", "202.12.27.33", "2001:dc3::35"),
];
pub fn load_hints(cache: &super::Cache) {
let mut root_ns_set: Vec<Box<dyn RRData>> = Vec::new();
for &(name, ipv4, ipv6) in &DATA {
let name = name.parse::<DnsName>().expect("invalid root hint name");
let ipv4 = ipv4.parse::<Ipv4Addr>().expect("invalid root hint ipv4 addr");
let ipv6 = ipv6.parse::<Ipv6Addr>().expect("invalid root hint ipv6 addr");
root_ns_set.push(Box::new(NS {
nsdname: DnsCompressedName(name.clone()),
}));
cache.insert_hint(name.clone(), types::A, vec![Box::new(A { addr: ipv4 })]);
cache.insert_hint(name.clone(), types::AAAA, vec![Box::new(AAAA { addr: ipv6 })]);
}
cache.insert_hint(DnsName::new_root(), types::NS, root_ns_set);
unimplemented!()
}