From: Matt Corallo Date: Tue, 9 Jul 2024 20:55:56 +0000 (+0000) Subject: Add a new query test hosted on an OVH DNS server X-Git-Tag: v0.6.0~1 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=88cf0b7c9346a26e1f8f76307d03ed442a30ecd5;p=dnssec-prover Add a new query test hosted on an OVH DNS server --- diff --git a/src/query.rs b/src/query.rs index e24e52f..e6e6af2 100644 --- a/src/query.rs +++ b/src/query.rs @@ -599,4 +599,32 @@ mod tests { } } + #[cfg(feature = "tokio")] + #[tokio::test] + async fn test_tbast_ovh_hosted() { + // OVH's DNS servers do all kinds of weird inefficient things, making for a good test. + for resolver in ["1.1.1.1:53", "8.8.8.8:53", "9.9.9.9:53"] { + let sockaddr = resolver.to_socket_addrs().unwrap().next().unwrap(); + let query_name = "me.user._bitcoin-payment.t-bast.xyz.".try_into().unwrap(); + let (proof, _) = build_txt_proof_async(sockaddr, &query_name).await.unwrap(); + + let mut rrs = parse_rr_stream(&proof).unwrap(); + rrs.shuffle(&mut rand::rngs::OsRng); + let verified_rrs = verify_rr_stream(&rrs).unwrap(); + assert_eq!(verified_rrs.verified_rrs.len(), 1); + + let now = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap().as_secs(); + assert!(verified_rrs.valid_from < now); + assert!(verified_rrs.expires > now); + + let resolved_rrs = verified_rrs.resolve_name(&query_name); + assert_eq!(resolved_rrs.len(), 1); + if let RR::Txt(txt) = &resolved_rrs[0] { + assert_eq!(txt.name.as_str(), "me.user._bitcoin-payment.t-bast.xyz."); + assert!(txt.data.as_vec().starts_with(b"bitcoin:")); + } else { panic!(); } + } + } + + }