From 36a5fe61cc9dd91b8fda0ad96672064356ee02c5 Mon Sep 17 00:00:00 2001 From: clerie Date: Sat, 24 Aug 2024 18:38:10 +0200 Subject: [PATCH] Display response in a human readable way --- src/main.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 6da3be7..3620681 100644 --- a/src/main.rs +++ b/src/main.rs @@ -115,7 +115,22 @@ async fn main() -> Result<()>{ } }; - println!("{}", &response_msg); + if let Some(DhcpOption::ServerId(server_id)) = &response_msg.opts().get(OptionCode::ServerId) { + println!("server_id: {}", hex::encode(&server_id)); + } + + if let Some(DhcpOption::DomainNameServers(domain_name_servers)) = &response_msg.opts().get(OptionCode::DomainNameServers) { + println!("domain_name_servers:"); + for domain_name_server in domain_name_servers { + println!(" - {}", domain_name_server); + } + } + if let Some(DhcpOption::DomainSearchList(domain_search_list)) = &response_msg.opts().get(OptionCode::DomainSearchList) { + println!("domain_search_list:"); + for search_domain_name in domain_search_list { + println!(" - {}", search_domain_name); + } + } Ok(()) }