diff --git a/Cargo.toml b/Cargo.toml index 2c1b263..0db714f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "dns_name" authors = ["BlueCat Networks "] description = "DNS name parsing with public suffix lookup" -version = "2.0.0" +version = "3.0.0" edition = "2021" # These URLs point to more information about the repository documentation = "https://docs.rs/dns_name" @@ -20,5 +20,5 @@ categories = ["network-programming", "data-structures"] # be separated with a `/` license = "MIT" -[dependencies] -hickory-proto = { version = "0.25.1", features = ["dnssec-ring"] } +[dev-dependencies] +hickory-proto = { version = "0.26.0", features = ["dnssec-ring"] } diff --git a/src/lib.rs b/src/lib.rs index 224b572..869baca 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -172,16 +172,6 @@ impl List { pub fn parse_dns_name(&self, domain: &str) -> io::Result { DnsName::parse(domain, self) } - - /// Converts a TrustDNS [`Name`] into a `DnsName` - /// - /// [`Name`]: trust_dns_proto::rr::domain::Name - pub fn from_trustdns_name( - &self, - name: &hickory_proto::rr::domain::Name, - ) -> io::Result { - self.parse_dns_name(&name.to_ascii()) - } } impl std::str::FromStr for List { @@ -424,14 +414,14 @@ mod unit_tests { use std::str::FromStr; let list = List::from_path("suffix-list.txt").unwrap(); - let domain = list.from_trustdns_name(&Name::from_str("a.b.c").unwrap())?; + let domain = list.parse_dns_name(&Name::from_str("a.b.c").unwrap().to_ascii())?; assert_eq!(domain.name(), "a.b.c"); assert_eq!(domain.rname(), "c.b.a"); assert_eq!(domain.root(), Some("b.c")); assert_eq!(domain.suffix(), Some("c")); // conversion to ascii - let domain = list.from_trustdns_name(&Name::from_str("a.♥").unwrap())?; + let domain = list.parse_dns_name(&Name::from_str("a.♥").unwrap().to_ascii())?; assert_eq!(domain.name(), "a.xn--g6h"); assert_eq!(domain.root(), Some("a.xn--g6h")); assert_eq!(domain.suffix(), Some("xn--g6h"));