Display response in a human readable way

This commit is contained in:
clerie 2024-08-24 18:38:10 +02:00
parent a6d6936499
commit 36a5fe61cc

View File

@ -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(()) Ok(())
} }