Files
NLnetLabs-domain/examples/readzone.rs
T
Philip-NLnetLabsandGitHub b8d2aa59bf Client Transport (#215)
This PR adds experimental support for client transport of DNS messages.

It also adds a new concept of unstable features which gate code that can introduce breaking changes also in non-breaking releases.
2024-01-15 14:54:20 +01:00

35 lines
976 B
Rust

//! Reads a zone file.
fn main() {
use domain::zonefile::inplace::Zonefile;
use std::env;
use std::fs::File;
use std::time::SystemTime;
for arg in env::args().skip(1) {
print!("Processing {}: ", arg);
let start = SystemTime::now();
let mut zone = Zonefile::load(&mut File::open(arg).unwrap()).unwrap();
println!(
"Data loaded ({:.03}s).",
start.elapsed().unwrap().as_secs_f32()
);
let mut i = 0;
while zone.next_entry().unwrap().is_some() {
i += 1;
if i % 100_000_000 == 0 {
eprintln!(
"Processed {}M records ({:.03}s)",
i / 1_000_000,
start.elapsed().unwrap().as_secs_f32()
);
}
}
eprintln!(
"Complete with {} records ({:.03}s)\n",
i,
start.elapsed().unwrap().as_secs_f32()
);
}
}