]> git.bitcoin.ninja Git - dnssec-prover/commitdiff
Add a new query test hosted on an OVH DNS server
authorMatt Corallo <git@bluematt.me>
Tue, 9 Jul 2024 20:55:56 +0000 (20:55 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 9 Jul 2024 21:12:49 +0000 (21:12 +0000)
src/query.rs

index e24e52fdfc8562efed94dc821d60824ccfa7b98d..e6e6af2e0230fe7cd1cda3cf1b774baeb1745cca 100644 (file)
@@ -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!(); }
+               }
+       }
+
+
 }