From 1fe59d24d5692296869afcd8e9fe245c55584eab Mon Sep 17 00:00:00 2001 From: Slatian Date: Mon, 7 Aug 2023 19:03:18 +0200 Subject: [PATCH] Discard additional responses instead of misattributing them --- README.md | 1 + src/simple_dns.rs | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 949afd4..f3d1915 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,7 @@ The default configuration is pretty liberal so that the average human probably w * [ ] Investigate why search isn't working for global TLDs * [ ] Add a way to configure just the dns server addresses and derive the port from the protocol. * [ ] Add an about page for the system resolver +* [ ] Expose additional DNS responses on the web interface ## License diff --git a/src/simple_dns.rs b/src/simple_dns.rs index 4beb28e..f1fbf11 100644 --- a/src/simple_dns.rs +++ b/src/simple_dns.rs @@ -171,8 +171,14 @@ pub fn integrate_lookup_result(dig_result: &mut DnsLookupResult, lookup_result: RecordType::TXT => set_default_if_none(&mut dig_result.txt), _ => { /* This should not happen */ }, }; - for record in lookup.iter() { - add_record_to_lookup_result(dig_result, record); + let name = lookup.query().name(); + for record in lookup.record_iter() { + if name == record.name() { + if let Some(data) = record.data() { + add_record_to_lookup_result(dig_result, data); + } + } + //TODO: handle additional responses } }, Err(e) => {