diff --git a/iroh-net/src/endpoint.rs b/iroh-net/src/endpoint.rs index 32763af14c6..823fd4d709a 100644 --- a/iroh-net/src/endpoint.rs +++ b/iroh-net/src/endpoint.rs @@ -133,7 +133,7 @@ impl Builder { discovery: self.discovery, proxy_url: self.proxy_url, dns_resolver, - #[cfg(all(test, feature = "test-utils"))] + #[cfg(any(test, feature = "test-utils"))] insecure_skip_relay_cert_verify: self.insecure_skip_relay_cert_verify, }; Endpoint::bind(static_config, msock_opts, self.alpn_protocols).await diff --git a/iroh-net/src/magicsock.rs b/iroh-net/src/magicsock.rs index 5d8247092c4..c2a285556bb 100644 --- a/iroh-net/src/magicsock.rs +++ b/iroh-net/src/magicsock.rs @@ -128,7 +128,7 @@ pub(crate) struct Options { /// Skip verification of SSL certificates from relay servers /// /// May only be used in tests. - #[cfg(all(test, feature = "test-utils"))] + #[cfg(any(test, feature = "test-utils"))] #[cfg_attr(iroh_docsrs, doc(cfg(any(test, feature = "test-utils"))))] pub(crate) insecure_skip_relay_cert_verify: bool, } @@ -144,7 +144,7 @@ impl Default for Options { discovery: None, proxy_url: None, dns_resolver: crate::dns::default_resolver().clone(), - #[cfg(all(test, feature = "test-utils"))] + #[cfg(any(test, feature = "test-utils"))] insecure_skip_relay_cert_verify: false, } } @@ -243,7 +243,7 @@ pub(crate) struct MagicSock { /// Skip verification of SSL certificates from relay servers /// /// May only be used in tests. - #[cfg(all(test, feature = "test-utils"))] + #[cfg(any(test, feature = "test-utils"))] #[cfg_attr(iroh_docsrs, doc(cfg(any(test, feature = "test-utils"))))] insecure_skip_relay_cert_verify: bool, } @@ -1397,7 +1397,7 @@ impl Handle { discovery, dns_resolver, proxy_url, - #[cfg(all(test, feature = "test-utils"))] + #[cfg(any(test, feature = "test-utils"))] insecure_skip_relay_cert_verify, } = opts; @@ -1453,7 +1453,7 @@ impl Handle { pending_call_me_maybes: Default::default(), direct_addr_update_state: DirectAddrUpdateState::new(), dns_resolver, - #[cfg(all(test, feature = "test-utils"))] + #[cfg(any(test, feature = "test-utils"))] insecure_skip_relay_cert_verify, }); diff --git a/iroh-net/src/magicsock/relay_actor.rs b/iroh-net/src/magicsock/relay_actor.rs index 998638da5c3..0a7b6c8fdae 100644 --- a/iroh-net/src/magicsock/relay_actor.rs +++ b/iroh-net/src/magicsock/relay_actor.rs @@ -487,7 +487,7 @@ impl RelayActor { .can_ack_pings(true) .is_preferred(my_relay.as_ref() == Some(&url1)); - #[cfg(all(test, feature = "test-utils"))] + #[cfg(any(test, feature = "test-utils"))] let builder = builder.insecure_skip_cert_verify(self.msock.insecure_skip_relay_cert_verify); let (dc, dc_receiver) = builder.build( diff --git a/iroh-net/src/relay/client.rs b/iroh-net/src/relay/client.rs index bddda1217c4..3b276a83293 100644 --- a/iroh-net/src/relay/client.rs +++ b/iroh-net/src/relay/client.rs @@ -218,7 +218,7 @@ pub struct ClientBuilder { /// Relay protocol protocol: Protocol, /// Allow self-signed certificates from relay servers - #[cfg(all(test, feature = "test-utils"))] + #[cfg(any(test, feature = "test-utils"))] #[cfg_attr(iroh_docsrs, doc(cfg(any(test, feature = "test-utils"))))] insecure_skip_cert_verify: bool, /// HTTP Proxy @@ -236,7 +236,7 @@ impl ClientBuilder { server_public_key: None, url: url.into(), protocol: Protocol::Relay, - #[cfg(all(test, feature = "test-utils"))] + #[cfg(any(test, feature = "test-utils"))] insecure_skip_cert_verify: false, proxy_url: None, } @@ -291,7 +291,7 @@ impl ClientBuilder { /// Skip the verification of the relay server's SSL certificates. /// /// May only be used in tests. - #[cfg(all(test, feature = "test-utils"))] + #[cfg(any(test, feature = "test-utils"))] #[cfg_attr(iroh_docsrs, doc(cfg(any(test, feature = "test-utils"))))] pub fn insecure_skip_cert_verify(mut self, skip: bool) -> Self { self.insecure_skip_cert_verify = skip; @@ -317,7 +317,7 @@ impl ClientBuilder { .expect("protocols supported by ring") .with_root_certificates(roots) .with_no_client_auth(); - #[cfg(all(test, feature = "test-utils"))] + #[cfg(any(test, feature = "test-utils"))] if self.insecure_skip_cert_verify { warn!("Insecure config: SSL certificates from relay servers will be trusted without verification"); config @@ -1050,12 +1050,12 @@ async fn resolve_host( } /// Used to allow self signed certificates in tests -#[cfg(all(test, feature = "test-utils"))] +#[cfg(any(test, feature = "test-utils"))] #[cfg_attr(iroh_docsrs, doc(cfg(any(test, feature = "test-utils"))))] #[derive(Debug)] struct NoCertVerifier; -#[cfg(all(test, feature = "test-utils"))] +#[cfg(any(test, feature = "test-utils"))] impl rustls::client::danger::ServerCertVerifier for NoCertVerifier { fn verify_server_cert( &self, diff --git a/iroh/src/node/builder.rs b/iroh/src/node/builder.rs index 2a478e90608..92dec5d4795 100644 --- a/iroh/src/node/builder.rs +++ b/iroh/src/node/builder.rs @@ -120,7 +120,7 @@ where dns_resolver: Option, node_discovery: DiscoveryConfig, docs_storage: DocsStorage, - #[cfg(all(test, feature = "test-utils"))] + #[cfg(any(test, feature = "test-utils"))] insecure_skip_relay_cert_verify: bool, /// Callback to register when a gc loop is done #[debug("callback")] @@ -250,7 +250,7 @@ impl Default for Builder { gc_policy: GcPolicy::Disabled, docs_storage: DocsStorage::Disabled, node_discovery: Default::default(), - #[cfg(all(test, feature = "test-utils"))] + #[cfg(any(test, feature = "test-utils"))] insecure_skip_relay_cert_verify: false, gc_done_callback: None, blob_events: Default::default(), @@ -286,7 +286,7 @@ impl Builder { gc_policy: GcPolicy::Disabled, docs_storage, node_discovery: Default::default(), - #[cfg(all(test, feature = "test-utils"))] + #[cfg(any(test, feature = "test-utils"))] insecure_skip_relay_cert_verify: false, gc_done_callback: None, blob_events: Default::default(), @@ -346,7 +346,7 @@ where gc_policy: self.gc_policy, docs_storage, node_discovery: self.node_discovery, - #[cfg(all(test, feature = "test-utils"))] + #[cfg(any(test, feature = "test-utils"))] insecure_skip_relay_cert_verify: false, gc_done_callback: self.gc_done_callback, blob_events: self.blob_events, @@ -508,14 +508,14 @@ where /// Skip verification of SSL certificates from relay servers /// /// May only be used in tests. - #[cfg(all(test, feature = "test-utils"))] + #[cfg(any(test, feature = "test-utils"))] pub fn insecure_skip_relay_cert_verify(mut self, skip_verify: bool) -> Self { self.insecure_skip_relay_cert_verify = skip_verify; self } /// Register a callback for when GC is done. - #[cfg(all(test, feature = "test-utils"))] + #[cfg(any(test, feature = "test-utils"))] pub fn register_gc_done_cb(mut self, cb: Box) -> Self { self.gc_done_callback.replace(cb); self @@ -617,7 +617,7 @@ where None => endpoint, }; - #[cfg(all(test, feature = "test-utils"))] + #[cfg(any(test, feature = "test-utils"))] { endpoint = endpoint.insecure_skip_relay_cert_verify(self.insecure_skip_relay_cert_verify);