Skip to content

Commit

Permalink
chore: upgrade trust-dns-resolver and friends (#24108)
Browse files Browse the repository at this point in the history
To avoid duplicate winreg crate in #24056

---------

Co-authored-by: Bartek Iwańczuk <[email protected]>
  • Loading branch information
ry and bartlomieju authored Jun 5, 2024
1 parent 566adb7 commit c789444
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 52 deletions.
116 changes: 80 additions & 36 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions ext/net/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ rustls-tokio-stream.workspace = true
serde.workspace = true
socket2.workspace = true
tokio.workspace = true
trust-dns-proto = "0.22"
trust-dns-resolver = { version = "0.22", features = ["tokio-runtime", "serde-config"] }
trust-dns-proto = "0.23"
trust-dns-resolver = { version = "0.23", features = ["tokio-runtime", "serde-config"] }
20 changes: 13 additions & 7 deletions ext/net/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ where
}
}

let resolver = AsyncResolver::tokio(config, opts)?;
let resolver = AsyncResolver::tokio(config, opts);

let lookup_fut = resolver.lookup(query, record_type);

Expand Down Expand Up @@ -781,9 +781,15 @@ mod tests {
use std::path::Path;
use std::sync::Arc;
use std::sync::Mutex;
use trust_dns_proto::rr::rdata::a::A;
use trust_dns_proto::rr::rdata::aaaa::AAAA;
use trust_dns_proto::rr::rdata::caa::KeyValue;
use trust_dns_proto::rr::rdata::caa::CAA;
use trust_dns_proto::rr::rdata::mx::MX;
use trust_dns_proto::rr::rdata::name::ANAME;
use trust_dns_proto::rr::rdata::name::CNAME;
use trust_dns_proto::rr::rdata::name::NS;
use trust_dns_proto::rr::rdata::name::PTR;
use trust_dns_proto::rr::rdata::naptr::NAPTR;
use trust_dns_proto::rr::rdata::srv::SRV;
use trust_dns_proto::rr::rdata::txt::TXT;
Expand All @@ -794,7 +800,7 @@ mod tests {
#[test]
fn rdata_to_return_record_a() {
let func = rdata_to_return_record(RecordType::A);
let rdata = RData::A(Ipv4Addr::new(127, 0, 0, 1));
let rdata = RData::A(A(Ipv4Addr::new(127, 0, 0, 1)));
assert_eq!(
func(&rdata).unwrap(),
Some(DnsReturnRecord::A("127.0.0.1".to_string()))
Expand All @@ -804,7 +810,7 @@ mod tests {
#[test]
fn rdata_to_return_record_aaaa() {
let func = rdata_to_return_record(RecordType::AAAA);
let rdata = RData::AAAA(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1));
let rdata = RData::AAAA(AAAA(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)));
assert_eq!(
func(&rdata).unwrap(),
Some(DnsReturnRecord::Aaaa("::1".to_string()))
Expand All @@ -814,7 +820,7 @@ mod tests {
#[test]
fn rdata_to_return_record_aname() {
let func = rdata_to_return_record(RecordType::ANAME);
let rdata = RData::ANAME(Name::new());
let rdata = RData::ANAME(ANAME(Name::new()));
assert_eq!(
func(&rdata).unwrap(),
Some(DnsReturnRecord::Aname("".to_string()))
Expand Down Expand Up @@ -842,7 +848,7 @@ mod tests {
#[test]
fn rdata_to_return_record_cname() {
let func = rdata_to_return_record(RecordType::CNAME);
let rdata = RData::CNAME(Name::new());
let rdata = RData::CNAME(CNAME(Name::new()));
assert_eq!(
func(&rdata).unwrap(),
Some(DnsReturnRecord::Cname("".to_string()))
Expand Down Expand Up @@ -889,7 +895,7 @@ mod tests {
#[test]
fn rdata_to_return_record_ns() {
let func = rdata_to_return_record(RecordType::NS);
let rdata = RData::NS(Name::new());
let rdata = RData::NS(NS(Name::new()));
assert_eq!(
func(&rdata).unwrap(),
Some(DnsReturnRecord::Ns("".to_string()))
Expand All @@ -899,7 +905,7 @@ mod tests {
#[test]
fn rdata_to_return_record_ptr() {
let func = rdata_to_return_record(RecordType::PTR);
let rdata = RData::PTR(Name::new());
let rdata = RData::PTR(PTR(Name::new()));
assert_eq!(
func(&rdata).unwrap(),
Some(DnsReturnRecord::Ptr("".to_string()))
Expand Down
4 changes: 2 additions & 2 deletions tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ serde.workspace = true
test_util.workspace = true
tokio.workspace = true
tower-lsp.workspace = true
trust-dns-client = "=0.22.0"
trust-dns-server = "=0.22.1"
trust-dns-client = "=0.23.2"
trust-dns-server = "=0.23.2"
url.workspace = true
uuid = { workspace = true, features = ["serde"] }
zeromq.workspace = true
Expand Down
7 changes: 2 additions & 5 deletions tests/integration/run_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4011,11 +4011,8 @@ async fn test_resolve_dns() {
)
.unwrap();
let lexer = Lexer::new(&zone_file);
let records = Parser::new().parse(
lexer,
Some(Name::from_str("example.com").unwrap()),
None,
);
let records =
Parser::new().parse(lexer, Some(Name::from_str("example.com").unwrap()));
if records.is_err() {
panic!("failed to parse: {:?}", records.err())
}
Expand Down

0 comments on commit c789444

Please sign in to comment.