Skip to content

Commit

Permalink
chore: added fmt utf8 for NSID
Browse files Browse the repository at this point in the history
  • Loading branch information
joalopez1206 committed Oct 24, 2024
1 parent 3772686 commit 3f01463
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/message/rdata/opt_rdata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl fmt::Display for OptRdata {
for (option_code, option_length, option_data) in &self.option {
result.push_str(&format!("OPTION-CODE: {}\n", option_code));
result.push_str(&format!("OPTION-LENGTH: {}\n", option_length));
result.push_str(&format!("OPTION-DATA: {:?}\n", option_data));
result.push_str(&format!("OPTION-DATA: {:?} (\"{}\")\n", option_data, std::str::from_utf8(option_data).unwrap()));
}
}
else {
Expand Down
7 changes: 5 additions & 2 deletions tests/edns_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ async fn query_a_type_edns() {

#[tokio::test]
async fn query_a_type_with_rrsig_edns() {
let response = query_response_edns("example.com", "UDP", "A", Some(1024), 0, true, Some(vec![3])).await;
let response = query_response_edns("example.com",
"UDP", "A", Some(1024), 0,
true, Some(vec![3])).await;

if let Ok(rrs) = response {
println!("{}", rrs);
Expand All @@ -91,11 +93,12 @@ async fn query_a_type_with_rrsig_edns() {
panic!("No RRSIG");

}
assert_eq!(answer.get_ttl(), rrsig.get_ttl());
let opt = &rrs.get_additional()[0];
assert_eq!(opt.get_name(), DomainName::new_from_str(""));
assert_eq!(opt.get_rtype(), Rrtype::OPT);
assert_eq!(opt.get_rclass(), Rclass::UNKNOWN(512));
println!("{:?}", opt);
//println!("{}", opt);
}
}

Expand Down

0 comments on commit 3f01463

Please sign in to comment.