From: Matt Corallo Date: Mon, 26 Feb 2024 20:44:08 +0000 (+0000) Subject: Define a util method to convert a type value to the type's name X-Git-Tag: v0.5.4~47 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=e765b651f11f3bd8e09553c1bfd6f19007336ede;p=dnssec-prover Define a util method to convert a type value to the type's name --- diff --git a/src/rr.rs b/src/rr.rs index 33fdb18..c464462 100644 --- a/src/rr.rs +++ b/src/rr.rs @@ -161,6 +161,23 @@ impl RR { RR::RRSig(rr) => StaticRecord::write_u16_len_prefixed_data(rr, out), } } + fn ty_to_rr_name(ty: u16) -> Option<&'static str> { + match ty { + A::TYPE => Some("A"), + AAAA::TYPE => Some("AAAA"), + NS::TYPE => Some("NS"), + Txt::TYPE => Some("TXT"), + CName::TYPE => Some("CNAME"), + DName::TYPE => Some("DNAME"), + TLSA::TYPE => Some("TLSA"), + DnsKey::TYPE => Some("DNSKEY"), + DS::TYPE => Some("DS"), + RRSig::TYPE => Some("RRSIG"), + NSec::TYPE => Some("NSEC"), + NSec3::TYPE => Some("NSEC3"), + _ => None, + } + } } impl From for RR { fn from(a: A) -> RR { RR::A(a) } } impl From for RR { fn from(aaaa: AAAA) -> RR { RR::AAAA(aaaa) } }