improve output format

This commit is contained in:
bauen1
2020-05-09 19:46:17 +02:00
parent f1b90e6522
commit fb434db865
+9 -5
View File
@@ -84,11 +84,15 @@ struct ROA {
impl fmt::Display for ROA {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
for origin in &self.origins {
write!(f, "route {} max {} as {};\n", self.route, self.maxlen, origin)?;
/* we want /32 and /128 */
write!(f, "route {}/{} max {} as {};\n",
self.route.first_address(),
self.route.network_length(),
self.maxlen,
origin)?;
}
// return a fmt::Result
write!(f, "")
Ok(())
}
}
@@ -226,6 +230,6 @@ fn main() {
print!("# commit: {}", String::from_utf8_lossy(&Command::new("git").arg("-C").arg(args.registry_path).arg("log").arg("-1").arg("--format=%H").output().expect("failed to determine git commit").stdout));
println!("#");
println!("{}\n", roa_to_output(roa_filter(roa_ip4, roa_filter_ip4)));
println!("{}\n", roa_to_output(roa_filter(roa_ip6, roa_filter_ip6)));
println!("{}", roa_to_output(roa_filter(roa_ip4, roa_filter_ip4)));
println!("{}", roa_to_output(roa_filter(roa_ip6, roa_filter_ip6)));
}