Clean up and better comment math somewhat further
[dnssec-prover] / src / http.rs
index 98aec6181e1aa32e06eb2bf3fb68cfede3af429d..ab162c94e68f2e5d65c9adfcbcd7f3cfb723250f 100644 (file)
@@ -2,12 +2,21 @@
 
 #![deny(missing_docs)]
 
+// const_slice_from_raw_parts was stabilized in 1.64, however we support building on 1.63 as well.
+// Luckily, it seems to work fine in 1.63 with the feature flag (and RUSTC_BOOTSTRAP=1) enabled.
+#![cfg_attr(feature = "validation", allow(stable_features))]
+#![cfg_attr(feature = "validation", feature(const_slice_from_raw_parts))]
+
 extern crate alloc;
 
 pub mod rr;
 pub mod ser;
 pub mod query;
 
+#[cfg(feature = "validation")]
+mod base32;
+#[cfg(feature = "validation")]
+mod crypto;
 #[cfg(feature = "validation")]
 pub mod validation;
 
@@ -143,7 +152,8 @@ mod imp {
 mod test {
        use super::*;
 
-       use crate::validation::{parse_rr_stream, verify_rr_stream};
+       use crate::ser::parse_rr_stream;
+       use crate::validation::verify_rr_stream;
 
        use minreq;
 
@@ -165,7 +175,7 @@ mod test {
 
        #[tokio::test(flavor = "multi_thread", worker_threads = 1)]
        async fn test_lookup_a() {
-               let ns = "4.4.4.4:53".parse().unwrap();
+               let ns = "9.9.9.9:53".parse().unwrap();
                let listener = tokio::net::TcpListener::bind("127.0.0.1:17493").await
                        .expect("Failed to bind to socket");
                tokio::spawn(imp::run_server(listener, ns));
@@ -176,7 +186,7 @@ mod test {
                assert_eq!(resp.status_code, 200);
                let rrs = parse_rr_stream(resp.as_bytes()).unwrap();
                let verified_rrs = verify_rr_stream(&rrs).unwrap();
-               assert_eq!(verified_rrs.verified_rrs.len(), 1);
+               assert!(verified_rrs.verified_rrs.len() >= 1);
        }
 
        #[tokio::test(flavor = "multi_thread", worker_threads = 1)]