From: Matt Corallo Date: Tue, 21 Jul 2020 23:10:58 +0000 (-0400) Subject: Print ASN lookups in output zonefile comments X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=dnsseed-rust;a=commitdiff_plain;h=5392883632221572ae4450c751e1b102245bc237 Print ASN lookups in output zonefile comments --- 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); } } }