From 3457409e3059c5aa31b793e7949b1603822b3ad4 Mon Sep 17 00:00:00 2001 From: Diva M Date: Fri, 8 Nov 2024 09:50:41 -0500 Subject: [PATCH] massive fmt --- iroh-net/bench/src/iroh.rs | 3 +-- iroh-net/src/defaults.rs | 3 +-- iroh-net/src/disco.rs | 2 +- iroh-net/src/discovery.rs | 4 ++-- iroh-net/src/discovery/dns.rs | 3 +-- iroh-net/src/discovery/pkarr.rs | 3 +-- iroh-net/src/endpoint.rs | 2 +- iroh-net/src/magicsock.rs | 4 ++-- iroh-net/src/magicsock/node_map.rs | 2 +- iroh-net/src/magicsock/node_map/node_state.rs | 4 +--- iroh-net/src/magicsock/node_map/path_state.rs | 2 +- iroh-net/src/magicsock/relay_actor.rs | 2 +- iroh-net/src/metrics.rs | 6 +++--- iroh-net/src/netcheck.rs | 5 ++--- iroh-net/src/netcheck/reportgen.rs | 4 +--- iroh-net/src/netcheck/reportgen/hairpin.rs | 3 +-- iroh-net/src/netcheck/reportgen/probes.rs | 3 +-- iroh-net/src/test_utils.rs | 7 +++---- iroh-relay/src/client.rs | 4 +--- iroh-relay/src/defaults.rs | 6 ++---- iroh-relay/src/main.rs | 6 +++--- iroh-relay/src/protos/relay.rs | 4 +--- iroh-relay/src/protos/stun.rs | 3 ++- iroh-relay/src/server.rs | 3 +-- iroh-relay/src/server/actor.rs | 2 +- iroh-relay/src/server/client_conn.rs | 10 ++++++---- iroh-relay/src/server/clients.rs | 5 ++--- iroh-relay/src/server/http_server.rs | 3 +-- iroh-relay/src/server/testing.rs | 4 +--- iroh-relay/src/server/types.rs | 2 +- iroh/src/node/rpc.rs | 5 ++--- 31 files changed, 49 insertions(+), 70 deletions(-) diff --git a/iroh-net/bench/src/iroh.rs b/iroh-net/bench/src/iroh.rs index 72f74128dc..d0cdf5c9be 100644 --- a/iroh-net/bench/src/iroh.rs +++ b/iroh-net/bench/src/iroh.rs @@ -10,9 +10,8 @@ use iroh_net::{ endpoint::{Connection, ConnectionError, RecvStream, SendStream, TransportConfig}, Endpoint, NodeAddr, }; -use tracing::{trace, warn}; - use iroh_relay::{RelayMap, RelayMode, RelayUrl}; +use tracing::{trace, warn}; use crate::{ client_handler, stats::TransferResult, ClientStats, ConnectionSelector, EndpointSelector, Opt, diff --git a/iroh-net/src/defaults.rs b/iroh-net/src/defaults.rs index 746356116d..085aba2d75 100644 --- a/iroh-net/src/defaults.rs +++ b/iroh-net/src/defaults.rs @@ -1,8 +1,7 @@ //! Default values used in [`iroh-net`][`crate`] -use url::Url; - use iroh_relay::{RelayMap, RelayNode}; +use url::Url; /// The default STUN port used by the Relay server. /// diff --git a/iroh-net/src/disco.rs b/iroh-net/src/disco.rs index e3a3c24873..29a1525884 100644 --- a/iroh-net/src/disco.rs +++ b/iroh-net/src/disco.rs @@ -24,12 +24,12 @@ use std::{ }; use anyhow::{anyhow, bail, ensure, Context, Result}; +use iroh_relay::RelayUrl; use serde::{Deserialize, Serialize}; use url::Url; use super::key::PublicKey; use crate::key; -use iroh_relay::RelayUrl; // TODO: custom magicn /// The 6 byte header of all discovery messages. diff --git a/iroh-net/src/discovery.rs b/iroh-net/src/discovery.rs index 69b0bbd854..8a7ec6d59c 100644 --- a/iroh-net/src/discovery.rs +++ b/iroh-net/src/discovery.rs @@ -439,13 +439,13 @@ mod tests { time::SystemTime, }; + use iroh_relay::RelayMode; use parking_lot::Mutex; use rand::Rng; use tokio_util::task::AbortOnDropHandle; use super::*; use crate::key::SecretKey; - use iroh_relay::RelayMode; #[derive(Debug, Clone, Default)] struct TestDiscoveryShared { @@ -732,6 +732,7 @@ mod test_dns_pkarr { use anyhow::Result; use iroh_base::key::SecretKey; + use iroh_relay::{RelayMap, RelayMode}; use tokio_util::task::AbortOnDropHandle; use crate::{ @@ -744,7 +745,6 @@ mod test_dns_pkarr { }, AddrInfo, Endpoint, NodeAddr, }; - use iroh_relay::{RelayMap, RelayMode}; const PUBLISH_TIMEOUT: Duration = Duration::from_secs(10); diff --git a/iroh-net/src/discovery/dns.rs b/iroh-net/src/discovery/dns.rs index d2af578176..6c95627324 100644 --- a/iroh-net/src/discovery/dns.rs +++ b/iroh-net/src/discovery/dns.rs @@ -2,6 +2,7 @@ use anyhow::Result; use futures_lite::stream::Boxed as BoxStream; +use iroh_relay::force_staging_infra; use crate::{ discovery::{Discovery, DiscoveryItem}, @@ -9,8 +10,6 @@ use crate::{ Endpoint, NodeId, }; -use iroh_relay::force_staging_infra; - /// The n0 testing DNS node origin, for production. pub const N0_DNS_NODE_ORIGIN_PROD: &str = "dns.iroh.link"; /// The n0 testing DNS node origin, for testing. diff --git a/iroh-net/src/discovery/pkarr.rs b/iroh-net/src/discovery/pkarr.rs index 3611d10d22..45ebd54c3f 100644 --- a/iroh-net/src/discovery/pkarr.rs +++ b/iroh-net/src/discovery/pkarr.rs @@ -48,6 +48,7 @@ use std::sync::Arc; use anyhow::{anyhow, bail, Result}; use futures_util::stream::BoxStream; +use iroh_relay::force_staging_infra; use pkarr::SignedPacket; use tokio::{ task::JoinHandle, @@ -64,8 +65,6 @@ use crate::{ AddrInfo, Endpoint, NodeId, }; -use iroh_relay::force_staging_infra; - #[cfg(feature = "discovery-pkarr-dht")] #[cfg_attr(iroh_docsrs, doc(cfg(feature = "discovery-pkarr-dht")))] pub mod dht; diff --git a/iroh-net/src/endpoint.rs b/iroh-net/src/endpoint.rs index b426542270..4bf3157ec8 100644 --- a/iroh-net/src/endpoint.rs +++ b/iroh-net/src/endpoint.rs @@ -24,6 +24,7 @@ use std::{ use anyhow::{anyhow, bail, Context, Result}; use derive_more::Debug; use futures_lite::{Stream, StreamExt}; +use iroh_relay::{force_staging_infra, RelayMode, RelayUrl}; use pin_project::pin_project; use tokio_util::sync::{CancellationToken, WaitForCancellationFuture}; use tracing::{debug, instrument, trace, warn}; @@ -38,7 +39,6 @@ use crate::{ magicsock::{self, Handle, QuicMappedAddr}, tls, NodeId, }; -use iroh_relay::{force_staging_infra, RelayMode, RelayUrl}; mod rtt_actor; diff --git a/iroh-net/src/magicsock.rs b/iroh-net/src/magicsock.rs index 15058cd1d7..9e5c518f56 100644 --- a/iroh-net/src/magicsock.rs +++ b/iroh-net/src/magicsock.rs @@ -35,6 +35,7 @@ use futures_lite::{FutureExt, Stream, StreamExt}; use futures_util::stream::BoxStream; use iroh_base::key::NodeId; use iroh_metrics::{inc, inc_by}; +use iroh_relay::{protos::stun, RelayMap, RelayUrl}; use netwatch::{interfaces, ip::LocalAddresses, netmon}; use quinn::AsyncUdpSocket; use rand::{seq::SliceRandom, Rng, SeedableRng}; @@ -67,7 +68,6 @@ use crate::{ key::{PublicKey, SecretKey, SharedSecret}, netcheck, AddrInfo, }; -use iroh_relay::{protos::stun, RelayMap, RelayUrl}; mod metrics; mod node_map; @@ -2778,13 +2778,13 @@ impl NetInfo { #[cfg(test)] mod tests { use anyhow::Context; + use iroh_relay::RelayMode; use iroh_test::CallOnDrop; use rand::RngCore; use tokio_util::task::AbortOnDropHandle; use super::*; use crate::{defaults::staging::EU_RELAY_HOSTNAME, tls, Endpoint}; - use iroh_relay::RelayMode; const ALPN: &[u8] = b"n0/test/1"; diff --git a/iroh-net/src/magicsock/node_map.rs b/iroh-net/src/magicsock/node_map.rs index 19f7624b70..c3728ec644 100644 --- a/iroh-net/src/magicsock/node_map.rs +++ b/iroh-net/src/magicsock/node_map.rs @@ -10,6 +10,7 @@ use std::{ use futures_lite::stream::Stream; use iroh_base::key::NodeId; use iroh_metrics::inc; +use iroh_relay::RelayUrl; use parking_lot::Mutex; use serde::{Deserialize, Serialize}; use stun_rs::TransactionId; @@ -27,7 +28,6 @@ use crate::{ key::PublicKey, NodeAddr, }; -use iroh_relay::RelayUrl; mod best_addr; mod node_state; diff --git a/iroh-net/src/magicsock/node_map/node_state.rs b/iroh-net/src/magicsock/node_map/node_state.rs index 7d716f029b..2f23c1c6c3 100644 --- a/iroh-net/src/magicsock/node_map/node_state.rs +++ b/iroh-net/src/magicsock/node_map/node_state.rs @@ -6,6 +6,7 @@ use std::{ }; use iroh_metrics::inc; +use iroh_relay::{protos::stun, RelayUrl}; use netwatch::ip::is_unicast_link_local; use serde::{Deserialize, Serialize}; use tokio::sync::mpsc; @@ -27,9 +28,6 @@ use crate::{ NodeAddr, NodeId, }; -use iroh_relay::protos::stun; -use iroh_relay::RelayUrl; - /// Number of addresses that are not active that we keep around per node. /// /// See [`NodeState::prune_direct_addresses`]. diff --git a/iroh-net/src/magicsock/node_map/path_state.rs b/iroh-net/src/magicsock/node_map/path_state.rs index 4ee27af188..b8ff645e63 100644 --- a/iroh-net/src/magicsock/node_map/path_state.rs +++ b/iroh-net/src/magicsock/node_map/path_state.rs @@ -7,6 +7,7 @@ use std::{ }; use iroh_base::key::NodeId; +use iroh_relay::protos::stun; use tracing::{debug, event, Level}; use super::{ @@ -14,7 +15,6 @@ use super::{ IpPort, PingRole, Source, }; use crate::{disco::SendAddr, magicsock::HEARTBEAT_INTERVAL}; -use iroh_relay::protos::stun; /// The minimum time between pings to an endpoint. /// diff --git a/iroh-net/src/magicsock/relay_actor.rs b/iroh-net/src/magicsock/relay_actor.rs index a2830cb522..5c07c0a494 100644 --- a/iroh-net/src/magicsock/relay_actor.rs +++ b/iroh-net/src/magicsock/relay_actor.rs @@ -10,6 +10,7 @@ use anyhow::Context; use backoff::backoff::Backoff; use bytes::{Bytes, BytesMut}; use iroh_metrics::{inc, inc_by}; +use iroh_relay::{self as relay, client::ClientError, ReceivedMessage, RelayUrl, MAX_PACKET_SIZE}; use tokio::{ sync::{mpsc, oneshot}, task::{JoinHandle, JoinSet}, @@ -20,7 +21,6 @@ use tracing::{debug, info, info_span, trace, warn, Instrument}; use super::{ActorMessage, MagicSock, Metrics as MagicsockMetrics, RelayContents}; use crate::key::{NodeId, PUBLIC_KEY_LENGTH}; -use iroh_relay::{self as relay, client::ClientError, ReceivedMessage, RelayUrl, MAX_PACKET_SIZE}; /// How long a non-home relay connection needs to be idle (last written to) before we close it. const RELAY_INACTIVE_CLEANUP_TIME: Duration = Duration::from_secs(60); diff --git a/iroh-net/src/metrics.rs b/iroh-net/src/metrics.rs index 2f5419bbb0..8274899e73 100644 --- a/iroh-net/src/metrics.rs +++ b/iroh-net/src/metrics.rs @@ -1,7 +1,7 @@ //! Co-locating all of the iroh-net metrics structs -pub use portmapper::Metrics as PortmapMetrics; - -pub use crate::{magicsock::Metrics as MagicsockMetrics, netcheck::Metrics as NetcheckMetrics}; #[cfg(feature = "iroh-relay")] #[cfg_attr(iroh_docsrs, doc(cfg(feature = "iroh-relay")))] pub use iroh_relay::server::Metrics as RelayMetrics; +pub use portmapper::Metrics as PortmapMetrics; + +pub use crate::{magicsock::Metrics as MagicsockMetrics, netcheck::Metrics as NetcheckMetrics}; diff --git a/iroh-net/src/netcheck.rs b/iroh-net/src/netcheck.rs index a37536c253..86be59770f 100644 --- a/iroh-net/src/netcheck.rs +++ b/iroh-net/src/netcheck.rs @@ -17,6 +17,7 @@ use anyhow::{anyhow, Context as _, Result}; use bytes::Bytes; use hickory_resolver::TokioAsyncResolver as DnsResolver; use iroh_metrics::inc; +use iroh_relay::{protos::stun, RelayMap, RelayUrl}; use netwatch::{IpFamily, UdpSocket}; use tokio::{ sync::{self, mpsc, oneshot}, @@ -25,8 +26,6 @@ use tokio::{ use tokio_util::{sync::CancellationToken, task::AbortOnDropHandle}; use tracing::{debug, error, info_span, trace, warn, Instrument}; -use iroh_relay::{protos::stun, RelayMap, RelayUrl}; - mod metrics; mod reportgen; @@ -773,6 +772,7 @@ mod tests { use std::net::Ipv4Addr; use bytes::BytesMut; + use iroh_relay::RelayNode; use tokio::time; use tracing::info; @@ -781,7 +781,6 @@ mod tests { defaults::{staging::EU_RELAY_HOSTNAME, DEFAULT_STUN_PORT}, ping::Pinger, }; - use iroh_relay::RelayNode; mod stun_utils { //! Utils for testing that expose a simple stun server. diff --git a/iroh-net/src/netcheck/reportgen.rs b/iroh-net/src/netcheck/reportgen.rs index d1a5efd04d..532309d5f2 100644 --- a/iroh-net/src/netcheck/reportgen.rs +++ b/iroh-net/src/netcheck/reportgen.rs @@ -26,6 +26,7 @@ use std::{ use anyhow::{anyhow, bail, Context, Result}; use iroh_metrics::inc; +use iroh_relay::{http::RELAY_PROBE_PATH, protos::stun, RelayMap, RelayNode, RelayUrl}; use netwatch::{interfaces, UdpSocket}; use rand::seq::IteratorRandom; use tokio::{ @@ -46,9 +47,6 @@ use crate::{ util::MaybeFuture, }; -use iroh_relay::protos::stun; -use iroh_relay::{http::RELAY_PROBE_PATH, RelayMap, RelayNode, RelayUrl}; - mod hairpin; mod probes; diff --git a/iroh-net/src/netcheck/reportgen/hairpin.rs b/iroh-net/src/netcheck/reportgen/hairpin.rs index be0ecf06fb..b2a3fc806c 100644 --- a/iroh-net/src/netcheck/reportgen/hairpin.rs +++ b/iroh-net/src/netcheck/reportgen/hairpin.rs @@ -15,6 +15,7 @@ use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4}; use anyhow::{bail, Context, Result}; +use iroh_relay::protos::stun; use netwatch::UdpSocket; use tokio::{sync::oneshot, time::Instant}; use tokio_util::task::AbortOnDropHandle; @@ -25,8 +26,6 @@ use crate::{ netcheck::{self, reportgen, Inflight}, }; -use iroh_relay::protos::stun; - /// Handle to the hairpin actor. /// /// Dropping it will abort the actor. diff --git a/iroh-net/src/netcheck/reportgen/probes.rs b/iroh-net/src/netcheck/reportgen/probes.rs index 21bc9db408..5fa66e1dc9 100644 --- a/iroh-net/src/netcheck/reportgen/probes.rs +++ b/iroh-net/src/netcheck/reportgen/probes.rs @@ -7,13 +7,12 @@ use std::{collections::BTreeSet, fmt, sync::Arc}; use anyhow::{ensure, Result}; +use iroh_relay::{RelayMap, RelayNode, RelayUrl}; use netwatch::interfaces; use tokio::time::Duration; use crate::netcheck::Report; -use iroh_relay::{RelayMap, RelayNode, RelayUrl}; - /// The retransmit interval used when netcheck first runs. /// /// We have no past context to work with, and we want answers relatively quickly, so it's diff --git a/iroh-net/src/test_utils.rs b/iroh-net/src/test_utils.rs index 3772c90d6b..dd9e4d3d05 100644 --- a/iroh-net/src/test_utils.rs +++ b/iroh-net/src/test_utils.rs @@ -4,14 +4,13 @@ use std::net::Ipv4Addr; use anyhow::Result; pub use dns_and_pkarr_servers::DnsPkarrServer; pub use dns_server::create_dns_resolver; -use tokio::sync::oneshot; - -use crate::defaults::DEFAULT_STUN_PORT; - use iroh_relay::{ server::{CertConfig, RelayConfig, Server, ServerConfig, StunConfig, TlsConfig}, RelayMap, RelayNode, RelayUrl, }; +use tokio::sync::oneshot; + +use crate::defaults::DEFAULT_STUN_PORT; /// A drop guard to clean up test infrastructure. /// diff --git a/iroh-relay/src/client.rs b/iroh-relay/src/client.rs index 90ab02eacc..afd5310667 100644 --- a/iroh-relay/src/client.rs +++ b/iroh-relay/src/client.rs @@ -44,11 +44,9 @@ use crate::{ defaults::timeouts::*, http::{Protocol, RELAY_PATH}, protos::relay::DerpCodec, - RelayUrl, + util, RelayUrl, }; -use crate::util; - pub(crate) mod conn; pub(crate) mod streams; diff --git a/iroh-relay/src/defaults.rs b/iroh-relay/src/defaults.rs index 77ad947f4d..469025b291 100644 --- a/iroh-relay/src/defaults.rs +++ b/iroh-relay/src/defaults.rs @@ -20,9 +20,8 @@ pub const DEFAULT_METRICS_PORT: u16 = 9090; pub mod prod { use url::Url; - use crate::{RelayMap, RelayNode}; - use super::*; + use crate::{RelayMap, RelayNode}; /// Hostname of the default NA relay. pub const NA_RELAY_HOSTNAME: &str = "use1-1.relay.iroh.network."; @@ -89,9 +88,8 @@ pub mod prod { pub mod staging { use url::Url; - use crate::{RelayMap, RelayNode}; - use super::*; + use crate::{RelayMap, RelayNode}; /// Hostname of the default NA relay. pub const NA_RELAY_HOSTNAME: &str = "staging-use1-1.relay.iroh.network."; diff --git a/iroh-relay/src/main.rs b/iroh-relay/src/main.rs index 9b83f55b3b..aad6b95352 100644 --- a/iroh-relay/src/main.rs +++ b/iroh-relay/src/main.rs @@ -10,10 +10,10 @@ use std::{ use anyhow::{anyhow, bail, Context as _, Result}; use clap::Parser; -use iroh_relay::defaults::{ - DEFAULT_HTTPS_PORT, DEFAULT_HTTP_PORT, DEFAULT_METRICS_PORT, DEFAULT_STUN_PORT, +use iroh_relay::{ + defaults::{DEFAULT_HTTPS_PORT, DEFAULT_HTTP_PORT, DEFAULT_METRICS_PORT, DEFAULT_STUN_PORT}, + server as relay, }; -use iroh_relay::server as relay; use serde::{Deserialize, Serialize}; use tokio_rustls_acme::{caches::DirCache, AcmeConfig}; use tracing::debug; diff --git a/iroh-relay/src/protos/relay.rs b/iroh-relay/src/protos/relay.rs index 5875622e78..a12137a28b 100644 --- a/iroh-relay/src/protos/relay.rs +++ b/iroh-relay/src/protos/relay.rs @@ -9,13 +9,11 @@ use bytes::{Buf, BufMut, Bytes, BytesMut}; use futures_lite::{Stream, StreamExt}; use futures_sink::Sink; use futures_util::SinkExt; -use iroh_base::key::{Signature, PUBLIC_KEY_LENGTH}; +use iroh_base::key::{PublicKey, SecretKey, Signature, PUBLIC_KEY_LENGTH}; use postcard::experimental::max_size::MaxSize; use serde::{Deserialize, Serialize}; use tokio_util::codec::{Decoder, Encoder}; -use iroh_base::key::{PublicKey, SecretKey}; - /// The maximum size of a packet sent over relay. /// (This only includes the data bytes visible to magicsock, not /// including its on-wire framing overhead) diff --git a/iroh-relay/src/protos/stun.rs b/iroh-relay/src/protos/stun.rs index 92fa63b85b..e74e036444 100644 --- a/iroh-relay/src/protos/stun.rs +++ b/iroh-relay/src/protos/stun.rs @@ -150,9 +150,10 @@ pub fn parse_response(b: &[u8]) -> Result<(TransactionId, SocketAddr), Error> { #[cfg(test)] mod tests { - use super::*; use std::net::{IpAddr, Ipv4Addr}; + use super::*; + // TODO(@divma): what's this and why is it commented? // Test to check if an existing stun server works // #[tokio::test] diff --git a/iroh-relay/src/server.rs b/iroh-relay/src/server.rs index a163e2bbaf..d9e13359bf 100644 --- a/iroh-relay/src/server.rs +++ b/iroh-relay/src/server.rs @@ -34,8 +34,7 @@ use tokio::{ use tokio_util::task::AbortOnDropHandle; use tracing::{debug, error, info, info_span, instrument, trace, warn, Instrument}; -use crate::http::RELAY_PROBE_PATH; -use crate::protos::stun; +use crate::{http::RELAY_PROBE_PATH, protos::stun}; pub(crate) mod actor; pub(crate) mod client_conn; diff --git a/iroh-relay/src/server/actor.rs b/iroh-relay/src/server/actor.rs index 9ecc74b21d..e07ec6c9de 100644 --- a/iroh-relay/src/server/actor.rs +++ b/iroh-relay/src/server/actor.rs @@ -13,6 +13,7 @@ use std::{ use anyhow::{bail, Context as _, Result}; use hyper::HeaderMap; +use iroh_base::key::PublicKey; use iroh_metrics::{core::UsageStatsReport, inc, inc_by, report_usage_stats}; use time::{Date, OffsetDateTime}; use tokio::sync::mpsc; @@ -36,7 +37,6 @@ use crate::{ types::ServerMessage, }, }; -use iroh_base::key::PublicKey; // TODO: skipping `verboseDropKeys` for now diff --git a/iroh-relay/src/server/client_conn.rs b/iroh-relay/src/server/client_conn.rs index e9211e8665..e4872c3190 100644 --- a/iroh-relay/src/server/client_conn.rs +++ b/iroh-relay/src/server/client_conn.rs @@ -12,21 +12,23 @@ use anyhow::{Context, Result}; use bytes::Bytes; use futures_lite::StreamExt; use futures_util::SinkExt; +use iroh_base::key::PublicKey; use iroh_metrics::{inc, inc_by}; use tokio::sync::mpsc; use tokio_util::{sync::CancellationToken, task::AbortOnDropHandle}; use tracing::{trace, Instrument}; use crate::{ - protos::disco, - protos::relay::{write_frame, Frame, KEEP_ALIVE}, + protos::{ + disco, + relay::{write_frame, Frame, KEEP_ALIVE}, + }, server::{ metrics::Metrics, streams::RelayIo, types::{Packet, ServerMessage}, }, }; -use iroh_base::key::PublicKey; /// The [`Server`] side representation of a [`Client`]'s connection. /// @@ -460,6 +462,7 @@ impl ClientConnIo { #[cfg(test)] mod tests { use anyhow::bail; + use iroh_base::key::SecretKey; use tokio_util::codec::Framed; use super::*; @@ -468,7 +471,6 @@ mod tests { protos::relay::{recv_frame, DerpCodec, FrameType}, server::streams::MaybeTlsStream, }; - use iroh_base::key::SecretKey; #[tokio::test] async fn test_client_conn_io_basic() -> Result<()> { diff --git a/iroh-relay/src/server/clients.rs b/iroh-relay/src/server/clients.rs index 12a49cf7d3..2eb7ec6888 100644 --- a/iroh-relay/src/server/clients.rs +++ b/iroh-relay/src/server/clients.rs @@ -3,6 +3,7 @@ //! The "Server" side of the client. Uses the `ClientConnManager`. use std::collections::{HashMap, HashSet}; +use iroh_base::key::PublicKey; use iroh_metrics::inc; use tokio::{sync::mpsc, task::JoinSet}; use tracing::{Instrument, Span}; @@ -12,7 +13,6 @@ use super::{ metrics::Metrics, types::Packet, }; -use iroh_base::key::PublicKey; /// Number of times we try to send to a client connection before dropping the data; const RETRIES: usize = 3; @@ -255,6 +255,7 @@ impl Clients { mod tests { use anyhow::Result; use bytes::Bytes; + use iroh_base::key::SecretKey; use tokio::io::DuplexStream; use tokio_util::codec::{Framed, FramedRead}; @@ -264,8 +265,6 @@ mod tests { server::streams::{MaybeTlsStream, RelayIo}, }; - use iroh_base::key::SecretKey; - fn test_client_builder( key: PublicKey, conn_num: usize, diff --git a/iroh-relay/src/server/http_server.rs b/iroh-relay/src/server/http_server.rs index 26e4b630b7..1a1d112a62 100644 --- a/iroh-relay/src/server/http_server.rs +++ b/iroh-relay/src/server/http_server.rs @@ -583,6 +583,7 @@ mod tests { use anyhow::Result; use bytes::Bytes; + use iroh_base::key::{PublicKey, SecretKey}; use reqwest::Url; use tokio::{sync::mpsc, task::JoinHandle}; use tracing::{info, info_span, Instrument}; @@ -591,8 +592,6 @@ mod tests { use super::*; use crate::client::{conn::ReceivedMessage, Client, ClientBuilder}; - use iroh_base::key::{PublicKey, SecretKey}; - pub(crate) fn make_tls_config() -> TlsConfig { let subject_alt_names = vec!["localhost".to_string()]; diff --git a/iroh-relay/src/server/testing.rs b/iroh-relay/src/server/testing.rs index f45f617b8d..580d44addb 100644 --- a/iroh-relay/src/server/testing.rs +++ b/iroh-relay/src/server/testing.rs @@ -4,10 +4,8 @@ use std::net::Ipv4Addr; use anyhow::Result; use tokio::sync::oneshot; -use crate::defaults::DEFAULT_STUN_PORT; - use super::{CertConfig, RelayConfig, Server, ServerConfig, StunConfig, TlsConfig}; -use crate::{RelayMap, RelayNode, RelayUrl}; +use crate::{defaults::DEFAULT_STUN_PORT, RelayMap, RelayNode, RelayUrl}; /// A drop guard to clean up test infrastructure. /// diff --git a/iroh-relay/src/server/types.rs b/iroh-relay/src/server/types.rs index d4626b79fc..0ce67b1d1d 100644 --- a/iroh-relay/src/server/types.rs +++ b/iroh-relay/src/server/types.rs @@ -1,9 +1,9 @@ //! Types that are shared between [`super::actor`] and [`super::client_conn`]. use bytes::Bytes; +use iroh_base::key::PublicKey; use crate::server::client_conn::ClientConnBuilder; -use iroh_base::key::PublicKey; /// A request to write a dataframe to a Client #[derive(Debug, Clone)] diff --git a/iroh/src/node/rpc.rs b/iroh/src/node/rpc.rs index 03da16f840..88dfb2355d 100644 --- a/iroh/src/node/rpc.rs +++ b/iroh/src/node/rpc.rs @@ -4,11 +4,9 @@ use std::{ time::Duration, }; -use crate::base::node_addr::RelayUrl; use anyhow::{anyhow, Result}; use futures_lite::{Stream, StreamExt}; -use iroh_base::key::NodeId; -use iroh_base::node_addr::NodeAddr; +use iroh_base::{key::NodeId, node_addr::NodeAddr}; use iroh_blobs::{ export::ExportProgress, net_protocol::Blobs as BlobsProtocol, @@ -29,6 +27,7 @@ use tracing::{debug, info, warn}; use super::IrohServerEndpoint; use crate::{ + base::node_addr::RelayUrl, client::NodeStatus, node::NodeInner, rpc_protocol::{