From 5392883632221572ae4450c751e1b102245bc237 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 21 Jul 2020 19:10:58 -0400 Subject: [PATCH] Print ASN lookups in output zonefile comments --- src/datastore.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/datastore.rs b/src/datastore.rs index 5768935..5aa4748 100644 --- a/src/datastore.rs +++ b/src/datastore.rs @@ -579,16 +579,16 @@ impl Store { } let mut asn_set = HashSet::with_capacity(cmp::max(v4_set.len(), v6_set.len())); asn_set.insert(0); - for a in v4_set.iter().filter(|a| asn_set.insert(bgp_client.get_asn(IpAddr::V4(**a)))).choose_multiple(&mut rng, 21) { - dns_buff += &format!("x{:x}.dnsseed\tIN\tA\t{}\n", i, a); + for (a, asn) in v4_set.iter().map(|a| (a, bgp_client.get_asn(IpAddr::V4(*a)))).filter(|a| asn_set.insert(a.1)).choose_multiple(&mut rng, 21) { + dns_buff += &format!("x{:x}.dnsseed\tIN\tA\t{} ; AS{}\n", i, a, asn); } asn_set.clear(); asn_set.insert(0); - for a in v6_set.iter().filter(|a| asn_set.insert(bgp_client.get_asn(IpAddr::V6(**a)))).choose_multiple(&mut rng, 10) { - dns_buff += &format!("x{:x}.dnsseed\tIN\tAAAA\t{}\n", i, a); + for (a, asn) in v6_set.iter().map(|a| (a, bgp_client.get_asn(IpAddr::V6(*a)))).filter(|a| asn_set.insert(a.1)).choose_multiple(&mut rng, 10) { + dns_buff += &format!("x{:x}.dnsseed\tIN\tAAAA\t{} ; AS{}\n", i, a, asn); } for a in tor_set.iter().choose_multiple(&mut rng, 2) { - dns_buff += &format!("x{:x}.dnsseed\tIN\tAAAA\t{}\n", i, a); + dns_buff += &format!("x{:x}.dnsseed\tIN\tAAAA\t{} ; Tor Onionv2\n", i, a); } } } -- 2.30.2