diff --git a/.github/workflows/tests_and_checks.yml b/.github/workflows/tests_and_checks.yml index 23ca9de8..20e3befb 100644 --- a/.github/workflows/tests_and_checks.yml +++ b/.github/workflows/tests_and_checks.yml @@ -89,7 +89,6 @@ jobs: - name: Run Linter run: cargo clippy --all -- -D warnings - continue-on-error: ${{ matrix.rust-toolchain == 'nightly' && matrix.os == 'macos-14' }} - name: Install cargo-hakari if: ${{ matrix.rust-toolchain == 'stable' }} diff --git a/homestar-runtime/src/cli/show.rs b/homestar-runtime/src/cli/show.rs index 51bc1dea..ce4016e8 100644 --- a/homestar-runtime/src/cli/show.rs +++ b/homestar-runtime/src/cli/show.rs @@ -55,6 +55,7 @@ pub trait ConsoleTable { } /// Style trait for console table output responses. +#[allow(dead_code)] pub(crate) trait ApplyStyle { fn default(&mut self) -> Output; fn default_with_title(&mut self, ext_title: &str) -> Output; diff --git a/homestar-runtime/src/db/utils.rs b/homestar-runtime/src/db/utils.rs index 08d76e36..091de85c 100644 --- a/homestar-runtime/src/db/utils.rs +++ b/homestar-runtime/src/db/utils.rs @@ -3,6 +3,7 @@ use chrono::NaiveDateTime; /// Trait for converting nanoseconds to a timestamp. +#[allow(dead_code)] pub(crate) trait Timestamp { fn timestamp_from_nanos(&self) -> Option; } diff --git a/homestar-runtime/src/network/swarm.rs b/homestar-runtime/src/network/swarm.rs index a84f819b..13292f77 100644 --- a/homestar-runtime/src/network/swarm.rs +++ b/homestar-runtime/src/network/swarm.rs @@ -408,14 +408,38 @@ fn build_transport( keypair: Keypair, ) -> Result> { let build_tcp = || libp2p::tcp::tokio::Transport::new(libp2p::tcp::Config::new().nodelay(true)); - let build_ws_or_tcp = libp2p::websocket::WsConfig::new(build_tcp()).or_transport(build_tcp()); let build_quic = if settings.libp2p.quic.enable { OptionalTransport::some(quic::tokio::Transport::new(quic::Config::new(&keypair))) } else { OptionalTransport::none() }; - let transport = build_ws_or_tcp + let dns_transport = || { + if let Ok((conf, opts)) = hickory_resolver::system_conf::read_system_conf() { + info!( + subject = "swarm.init", + category = "libp2p.swarm", + "using system DNS configuration from /etc/resolv.conf" + ); + dns::tokio::Transport::custom(build_tcp(), conf, opts) + } else { + info!( + subject = "swarm.init", + category = "libp2p.swarm", + "using cloudflare DNS configuration as a fallback" + ); + dns::tokio::Transport::custom( + build_tcp(), + dns::ResolverConfig::cloudflare(), + dns::ResolverOpts::default(), + ) + } + }; + + // ws + wss transport or dns + tcp transport or ws + tcp + let transport = libp2p::websocket::WsConfig::new(dns_transport()) + .or_transport(dns_transport()) + .or_transport(libp2p::websocket::WsConfig::new(build_tcp())) .upgrade(upgrade::Version::V1Lazy) .authenticate(noise::Config::new(&keypair)?) .multiplex(yamux::Config::default()) @@ -424,27 +448,8 @@ fn build_transport( .map(|either_output, _| match either_output { Either::Left((peer_id, muxer)) => (peer_id, StreamMuxerBox::new(muxer)), Either::Right((peer_id, muxer)) => (peer_id, StreamMuxerBox::new(muxer)), - }); - - let transport = if let Ok((conf, opts)) = hickory_resolver::system_conf::read_system_conf() { - info!( - subject = "swarm.init", - category = "libp2p.swarm", - "using system DNS configuration from /etc/resolv.conf" - ); - dns::tokio::Transport::custom(transport, conf, opts) - } else { - info!( - subject = "swarm.init", - category = "libp2p.swarm", - "using cloudflare DNS configuration as a fallback" - ); - dns::tokio::Transport::custom( - transport, - dns::ResolverConfig::cloudflare(), - dns::ResolverOpts::default(), - ) - }; + }) + .boxed(); - Ok(transport.boxed()) + Ok(transport) } diff --git a/homestar-runtime/src/network/webserver/prom.rs b/homestar-runtime/src/network/webserver/prom.rs index 622b8850..45cd228e 100644 --- a/homestar-runtime/src/network/webserver/prom.rs +++ b/homestar-runtime/src/network/webserver/prom.rs @@ -8,7 +8,9 @@ use regex::Regex; use serde::{Deserialize, Serialize}; use std::collections::HashMap; +#[allow(dead_code)] const HISTOGRAM_TYPE: &str = "HISTOGRAM"; +#[allow(dead_code)] const SUMMARY_TYPE: &str = "SUMMARY"; static METRIC_REGEX_NO_LABEL: Lazy<&Regex> = Lazy::new(|| { diff --git a/homestar-runtime/src/tasks.rs b/homestar-runtime/src/tasks.rs index c054c877..f072a681 100644 --- a/homestar-runtime/src/tasks.rs +++ b/homestar-runtime/src/tasks.rs @@ -23,6 +23,7 @@ pub(crate) enum RegisteredTasks { } /// Trait for loading files for different task-types directly. +#[allow(dead_code)] #[async_trait] pub(crate) trait FileLoad { /// Load file asynchronously.