From 2e93189efcd00e81280af6bd4d16b3fdda55a35e Mon Sep 17 00:00:00 2001 From: azzam Date: Sun, 21 Feb 2021 17:47:46 +0700 Subject: [PATCH] feat: use name server reply (SOA) if record answer is empty If the answer is empty digs will display nothing. Instead of this behavior, digs will show the default reply of DNS name server which is a SOA record. Other DNS command-line client such as `dig` and `dog` also has this behavior. --- src/main.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main.rs b/src/main.rs index 698cb24..bb7d657 100644 --- a/src/main.rs +++ b/src/main.rs @@ -71,6 +71,16 @@ fn main() { res.rdata().to_string().bold() ); } + for res in res.name_servers() { + let rr_type = res.rr_type().to_string().green().bold(); + + println!( + " {0: <15} {1: <15} {2: <10}", + rr_type.to_string(), + res.name().to_string().blue(), + res.rdata().to_string().bold() + ); + } } } }