From 6de1c8604e538dcb7f5494c224529484bef435c0 Mon Sep 17 00:00:00 2001 From: Marc Schoolderman Date: Thu, 7 Dec 2023 18:19:54 +0100 Subject: [PATCH] generalized interface --- ntp-proto/src/nts_record.rs | 2 +- ntpd/src/daemon/keyexchange.rs | 4 ++-- ntpd/src/daemon/spawn/nts_pool.rs | 5 +---- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/ntp-proto/src/nts_record.rs b/ntp-proto/src/nts_record.rs index aa1696fd6..89700b67e 100644 --- a/ntp-proto/src/nts_record.rs +++ b/ntp-proto/src/nts_record.rs @@ -1181,7 +1181,7 @@ impl KeyExchangeClient { pub fn new( server_name: String, tls_config: rustls::ClientConfig, - denied_servers: Vec, + denied_servers: impl IntoIterator, ) -> Result { let mut client = Self::new_without_tls_write(server_name, tls_config)?; diff --git a/ntpd/src/daemon/keyexchange.rs b/ntpd/src/daemon/keyexchange.rs index 1c72b8a3b..c63c7a599 100644 --- a/ntpd/src/daemon/keyexchange.rs +++ b/ntpd/src/daemon/keyexchange.rs @@ -56,7 +56,7 @@ pub(crate) async fn key_exchange_client_with_denied_servers( server_name: String, port: u16, extra_certificates: &[Certificate], - denied_servers: Vec, + denied_servers: impl IntoIterator, ) -> Result { let socket = tokio::net::TcpStream::connect((server_name.as_str(), port)).await?; let config = build_client_config(extra_certificates)?; @@ -218,7 +218,7 @@ where io: IO, server_name: String, config: rustls::ClientConfig, - denied_servers: Vec, + denied_servers: impl IntoIterator, ) -> Result { Ok(Self { inner: Some(BoundKeyExchangeClientData { diff --git a/ntpd/src/daemon/spawn/nts_pool.rs b/ntpd/src/daemon/spawn/nts_pool.rs index ecfa7149c..89c6b1284 100644 --- a/ntpd/src/daemon/spawn/nts_pool.rs +++ b/ntpd/src/daemon/spawn/nts_pool.rs @@ -96,10 +96,7 @@ impl NtsPoolSpawner { self.config.addr.server_name.clone(), self.config.addr.port, &self.config.certificate_authorities, - self.current_peers - .iter() - .map(|peer| peer.remote.clone()) - .collect(), + self.current_peers.iter().map(|peer| peer.remote.clone()), ) .await {