From ddf06d551e094eab33317283bf22c9eba38ee264 Mon Sep 17 00:00:00 2001 From: Frando Date: Tue, 17 Feb 2026 09:43:00 +0000 Subject: [PATCH] deploy: 8c313172403e3722c186c1706ae1bf66d2a6c243 --- .../docs/iroh_relay/server/clients/index.html | 2 +- .../server/clients/struct.Clients.html | 4 +- .../docs/search.index/path/6672b0125fc6.js | 1 - .../docs/search.index/path/b9c1e5ceea68.js | 1 + pr/3921/docs/search.index/root.js | 2 +- .../src/iroh_relay/server/clients.rs.html | 767 +++++++++--------- 6 files changed, 386 insertions(+), 391 deletions(-) delete mode 100644 pr/3921/docs/search.index/path/6672b0125fc6.js create mode 100644 pr/3921/docs/search.index/path/b9c1e5ceea68.js diff --git a/pr/3921/docs/iroh_relay/server/clients/index.html b/pr/3921/docs/iroh_relay/server/clients/index.html index c943148936..e0d3b12644 100644 --- a/pr/3921/docs/iroh_relay/server/clients/index.html +++ b/pr/3921/docs/iroh_relay/server/clients/index.html @@ -1,3 +1,3 @@ -iroh_relay::server::clients - Rust

Module clients

Module clients 

Source
Available on crate feature server only.
Expand description

The “Server” side of the client. Uses the ClientConnManager.

+iroh_relay::server::clients - Rust

Module clients

Module clients 

Source
Available on crate feature server only.
Expand description

The “Server” side of the client. Uses the ClientConnManager.

Structs§

Clients
Manages the connections to all currently connected clients. Registry of connected relay clients.
\ No newline at end of file diff --git a/pr/3921/docs/iroh_relay/server/clients/struct.Clients.html b/pr/3921/docs/iroh_relay/server/clients/struct.Clients.html index 4a34846e2c..07e09269df 100644 --- a/pr/3921/docs/iroh_relay/server/clients/struct.Clients.html +++ b/pr/3921/docs/iroh_relay/server/clients/struct.Clients.html @@ -2,11 +2,11 @@ Registry of connected relay clients.

This type manages the collection of active client connections and handles routing messages between them.

-

Implementations§

Source§

impl Clients

Source

pub async fn shutdown(&self)

Shuts down all connected clients.

+

Implementations§

Source§

impl Clients

Source

pub async fn shutdown(&self)

Shuts down all connected clients.

This method gracefully disconnects all active client connections managed by this registry. It will wait for all clients to complete their shutdown before returning.

-
Source

pub fn register<S>(&self, client_config: Config<S>, metrics: Arc<Metrics>)
where +

Source

pub fn register<S>(&self, client_config: Config<S>, metrics: Arc<Metrics>)
where S: BytesStreamSink + Send + 'static,

Builds the client handler and starts the read & write loops for the connection.

Trait Implementations§

Source§

impl Clone for Clients

Source§

fn clone(&self) -> Clients

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Clients

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Clients

Source§

fn default() -> Clients

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where diff --git a/pr/3921/docs/search.index/path/6672b0125fc6.js b/pr/3921/docs/search.index/path/6672b0125fc6.js deleted file mode 100644 index 176b43d2db..0000000000 --- a/pr/3921/docs/search.index/path/6672b0125fc6.js +++ /dev/null @@ -1 +0,0 @@ -rd_("f[1,\"\"]0Al[10,\"core::cmp\",\"core::cmp\"]Al[10,\"core::ops\",\"core::ops\"]Ce[5,\"clap_builder::util::id\",\"clap_builder::util::id\"]Bd[15,\"iroh_relay::client::DialError\"]Cg[5,\"iroh::endpoint::presets\",\"iroh::endpoint::presets\"]Eg[5,\"tower_http::follow_redirect::policy::or\",\"tower_http::follow_redirect::policy::or\"]66Ei[5,\"tower_http::follow_redirect::policy::and\",\"tower_http::follow_redirect::policy::and\"]A`[10,\"core::any\"]Ao[5,\"alloc::sync\",\"alloc::sync\"]Ba[5,\"alloc::boxed\",\"alloc::boxed\"]Cb[10,\"bytes::buf::buf_impl\",\"bytes::buf::buf_impl\"]Ad[6,\"iroh::endpoint\"]8g[17,\"\"]Am[5,\"n0_watcher\",\"n0_watcher\"]Ae[10,\"core::ops::bit\"]Am[5,\"iroh_bench\",\"iroh_bench\"]Bg[5,\"iroh_bench::s2n\",\"iroh_bench::s2n\"]A`[10,\"core::cmp\"]Ak[5,\"core::pin\",\"core::pin\"]Bg[15,\"iroh_relay::client::ConnectError\"]o[5,\"url\",\"url\"]Am[5,\"alloc::vec\",\"alloc::vec\"]Ba[2,\"iroh::address_lookup::pkarr\"]j[2,\"iroh\"]Aj[2,\"iroh::address_lookup\"]A`[2,\"iroh_relay\"]Ae[2,\"iroh_dns_server\"]f[1,\"\"]000o[2,\"iroh_base\"]f[0,\"\"]A`[2,\"iroh_bench\"]3Ak[2,\"iroh_dns_server::http\"]444Ak[10,\"clap_builder::derive\"]Bb[10,\"core::marker\",\"core::marker\"]>Af[10,\"core::ops::drop\"]Ad[10,\"core::convert\"]Aa[10,\"core::hash\"]Cl[15,\"iroh_relay::server::http_server::ServeConnectionError\"]2g[17,\"\"]Ca[5,\"iroh::address_lookup\",\"iroh::address_lookup\"]Ad[5,\"iroh::endpoint\"]Be[5,\"n0_error::meta\",\"n0_error::meta\"]Cc[5,\"reqwest::dns::resolve\",\"reqwest::dns::resolve\"]Dg[5,\"hickory_proto::rr::domain::name\",\"hickory_proto::rr::domain::name\"]Ak[5,\"std::path\",\"std::path\"]Am[15,\"iroh::endpoint::Source\"]Bi[6,\"core::task::poll\",\"core::task::poll\"]Cc[15,\"iroh_relay::server::client::HandleFrameError\"]>0Ad[6,\"iroh::endpoint\"]Ac[10,\"futures_sink\"]Bb[10,\"core::marker\",\"core::marker\"]Bb[15,\"iroh::address_lookup::Error\"]Cc[15,\"iroh::address_lookup::IntoAddressLookupError\"]Bb[15,\"iroh::protocol::AcceptError\"]Bg[15,\"iroh::address_lookup::ParseError\"]Bl[15,\"iroh_relay::endpoint_info::ParseError\"]Ah[10,\"ppv_lite86::types\"]Ad[2,\"iroh::endpoint\"]f[1,\"\"]f[3,\"\"]Ah[2,\"iroh_relay::client\"]A`[2,\"iroh_relay\"]Ae[2,\"iroh_dns_server\"]A`[2,\"iroh_bench\"]4Aj[2,\"iroh::address_lookup\"]Ad[2,\"iroh::defaults\"]Af[2,\"iroh::test_utils\"]An[2,\"iroh_quinn_proto::config\"]:6Bk[2,\"iroh_quinn_proto::connection::streams\"]::Bd[10,\"core::convert\",\"core::convert\"]0Ca[8,\"futures_lite::future\",\"futures_lite::future\"]Ca[8,\"futures_lite::stream\",\"futures_lite::stream\"]Ba[5,\"bytes::bytes\",\"bytes::bytes\"]Ad[5,\"iroh::endpoint\"]Ab[10,\"core::clone\"]Cg[6,\"iroh_quinn_proto::frame\",\"iroh_quinn_proto::frame\"]A`[10,\"core::fmt\"]Ag[10,\"core::ops::deref\"]g[17,\"\"]Ak[5,\"core::fmt\",\"core::fmt\"]Ab[10,\"core::error\"]Be[5,\"std::io::error\",\"std::io::error\"]Aj[2,\"iroh::address_lookup\"]Ba[8,\"clap_builder\",\"clap_builder\"]Bi[5,\"signature::error\",\"signature::error\"]Af[2,\"iroh_relay::quic\"]Bc[2,\"iroh_relay::protos::handshake\"]Ao[2,\"iroh_relay::protos::relay\"]Ba[5,\"hyper::error\",\"hyper::error\"]Ee[6,\"iroh_quinn_proto::transport_parameters\",\"iroh_quinn_proto::transport_parameters\"]Be[5,\"reqwest::error\",\"reqwest::error\"]Bg[6,\"postcard::error\",\"postcard::error\"]Cg[6,\"tokio_websockets::error\",\"tokio_websockets::error\"]Bi[6,\"netwatch::netmon\",\"netwatch::netmon\"]Ca[6,\"iroh::address_lookup\",\"iroh::address_lookup\"]Bi[6,\"iroh_relay::quic\",\"iroh_relay::quic\"]Dc[6,\"iroh_relay::protos::handshake\",\"iroh_relay::protos::handshake\"]Ck[6,\"iroh_relay::protos::relay\",\"iroh_relay::protos::relay\"]Bk[15,\"iroh_relay::server::client::RunError\"]Cl[15,\"iroh_relay::server::http_server::ServeConnectionError\"]Bm[15,\"iroh_relay::server::streams::RecvError\"]Bk[15,\"iroh::endpoint::ConnectWithOptsError\"]Bg[15,\"iroh_relay::protos::relay::Error\"]Bb[10,\"core::marker\",\"core::marker\"]Bk[5,\"iroh_bench::stats\",\"iroh_bench::stats\"]Am[5,\"n0_watcher\",\"n0_watcher\"]2g[17,\"\"]Ah[10,\"std::io\",\"std::io\"]f[1,\"\"]Af[2,\"iroh_quinn_proto\"]Ad[2,\"iroh::endpoint\"]Bb[2,\"iroh_quinn_proto::connection\"]Aj[2,\"iroh::address_lookup\"]A`[2,\"iroh_bench\"]Ah[2,\"iroh_relay::protos\"]6Ae[2,\"iroh_dns_server\"]240677Cn[15,\"iroh_relay::server::http_server::ConnectionHandlerError\"]Ca[5,\"iroh::endpoint\",\"iroh::endpoint::connection\"]Bm[6,\"iroh_relay::server\",\"iroh_relay::server\"]Ac[10,\"core::borrow\"]C`[10,\"bytes::buf::buf_mut\",\"bytes::buf::buf_mut\"]Bc[5,\"pkarr::client\",\"pkarr::client\"]Bm[5,\"iroh_relay::client\",\"iroh_relay::client\"]Cm[5,\"iroh_relay::server::client\",\"iroh_relay::server::client\"]Bd[15,\"iroh::endpoint::EndpointError\"]Ba[5,\"async_compat\",\"async_compat\"]Cg[5,\"iroh_dns_server::config\",\"iroh_dns_server::config\"]3Cb[10,\"core::future::future\",\"core::future::future\"]Ca[5,\"iroh_dns_server::dns\",\"iroh_dns_server::dns\"]An[10,\"core::hash\",\"core::hash\"]Cb[15,\"iroh_relay::protos::relay::RelayToClientMsg\"]Bm[6,\"core::net::ip_addr\",\"core::net::ip_addr\"]Bm[5,\"iroh_relay::server\",\"iroh_relay::server\"]Bh[10,\"reloadable_core\",\"reloadable_core\"]Be[15,\"iroh_relay::server::CertConfig\"]Bj[15,\"iroh::endpoint::AuthenticationError\"]Ad[5,\"iroh::endpoint\"]Ba[6,\"core::option\",\"core::option\"]g[17,\"\"]2E`[10,\"tower_http::follow_redirect::policy\",\"tower_http::follow_redirect::policy\"]Ch[10,\"iroh::endpoint::presets\",\"iroh::endpoint::presets\"]Co[5,\"hickory_proto::rr::resource\",\"hickory_proto::rr::resource\"]Bl[15,\"iroh::endpoint::AfterHandshakeOutcome\"]Ak[8,\"core::fmt\",\"core::fmt\"]Ba[6,\"core::result\",\"core::result\"]Be[8,\"std::io::error\",\"std::io::error\"]Ai[8,\"n0_error\",\"n0_error\"]Be[5,\"iroh::protocol\",\"iroh::protocol\"]Cg[5,\"iroh_dns_server::server\",\"iroh_dns_server::server\"]Bm[5,\"iroh_relay::server\",\"iroh_relay::server\"]Ad[2,\"iroh::endpoint\"]Bo[6,\"iroh::endpoint\",\"iroh::socket::remote_map\"]Cb[15,\"iroh_relay::server::client::WriteFrameError\"]Ak[10,\"futures_core::stream\"]Am[5,\"n0_watcher\",\"n0_watcher\"]Bc[5,\"alloc::string\",\"alloc::string\"]Ak[5,\"core::any\",\"core::any\"]Ci[5,\"iroh_quinn_proto::varint\",\"iroh_quinn_proto::varint\"]Ad[5,\"iroh::endpoint\"]Bn[15,\"iroh::address_lookup::pkarr::PkarrError\"]A`[2,\"iroh_relay\"]Ah[2,\"iroh_relay::server\"]Ah[2,\"iroh_relay::protos\"]Af[2,\"iroh_quinn_proto\"]Ae[2,\"iroh_dns_server\"]1Aj[2,\"iroh::address_lookup\"]551j[2,\"iroh\"]3Ae[10,\"iroh::endpoint\"]Bg[8,\"iroh_relay::dns\",\"iroh_relay::dns\"]Be[5,\"iroh::endpoint\",\"iroh::endpoint\"]Di[5,\"iroh::address_lookup::pkarr::dht\",\"iroh::address_lookup::pkarr::dht\"]Bg[5,\"iroh_relay::dns\",\"iroh_relay::dns\"]Co[5,\"iroh_relay::server::clients\",\"iroh_relay::server::clients\"]De[5,\"clap_builder::builder::command\",\"clap_builder::builder::command\"]Bc[15,\"iroh::endpoint::ConnectError\"]An[15,\"iroh_relay::quic::Error\"]Bi[5,\"core::task::wake\",\"core::task::wake\"]Cc[5,\"iroh_metrics::metrics\",\"iroh_metrics::metrics\"]Ad[10,\"core::default\"]A`[10,\"core::fmt\"]Bm[5,\"tokio::time::error\",\"tokio::time::error\"]Ca[15,\"iroh::address_lookup::mdns::DiscoveryEvent\"]Bc[10,\"axum_core::extract::from_ref\"]Ah[10,\"core::str::traits\"]Ak[5,\"std::time\",\"std::time\"]Ag[5,\"std::io\",\"std::io\"]Ci[5,\"iroh_quinn_proto::crypto\",\"iroh_quinn_proto::crypto\"]Bj[15,\"iroh_relay::server::SupervisorError\"]Ci[5,\"iroh_dns_server::metrics\",\"iroh_dns_server::metrics\"]Cf[5,\"iroh_relay::server\",\"iroh_relay::server::metrics\"]Am[5,\"n0_watcher\",\"n0_watcher\"]Ad[5,\"iroh::endpoint\"]Ak[5,\"std::path\",\"std::path\"]Bk[5,\"dyn_clone::sealed\",\"dyn_clone::sealed\"]Bo[5,\"tokio::io::read_buf\",\"tokio::io::read_buf\"]Bc[5,\"http::request\",\"http::request\"]Eg[5,\"hickory_server::server::request_handler\",\"hickory_server::server::request_handler\"]B`[15,\"iroh_relay::dns::DnsError\"]Al[10,\"reqwest::dns::resolve\"]Cg[5,\"tokio::runtime::runtime\",\"tokio::runtime::runtime\"]An[10,\"hyper::service::service\"]B`[15,\"iroh::endpoint::BindError\"]Cg[5,\"iroh_quinn::send_stream\",\"iroh_quinn::send_stream\"]Bd[15,\"iroh_relay::client::DialError\"]Cb[15,\"iroh_relay::server::client::WriteFrameError\"]Cl[15,\"iroh_relay::server::http_server::ServeConnectionError\"]8Ad[10,\"alloc::borrow\"]Ad[10,\"core::convert\"]0Bg[15,\"iroh_relay::client::ConnectError\"]k[10,\"iroh\"]Ad[5,\"iroh::endpoint\"]Ah[2,\"iroh_relay::server\"]j[2,\"iroh\"]1Ae[2,\"iroh_dns_server\"]f[1,\"\"]Ad[2,\"iroh::endpoint\"]Ad[2,\"iroh::defaults\"]5Ah[2,\"iroh_relay::protos\"]Bb[2,\"iroh_quinn_proto::connection\"]78Bc[5,\"n0_error::any\",\"n0_error::any\"]Ce[5,\"iroh_dns_server::state\",\"iroh_dns_server::state\"]De[5,\"alloc::collections::btree::set\",\"alloc::collections::btree::set\"]Bk[5,\"iroh::endpoint\",\"iroh::endpoint::bind\"]Bi[5,\"bytes::bytes_mut\",\"bytes::bytes_mut\"]Ch[6,\"iroh_dns_server::http\",\"iroh_dns_server::http::tls\"]Am[6,\"iroh_bench\",\"iroh_bench\"]Ag[10,\"core::ops::deref\"]Ae[2,\"iroh_relay::dns\"]Bg[6,\"iroh_relay::dns\",\"iroh_relay::dns\"]Am[5,\"core::time\",\"core::time\"]A`[10,\"dyn_clone\"]Bn[15,\"iroh::address_lookup::pkarr::PkarrError\"]Ca[5,\"iroh_quinn::endpoint\",\"iroh_quinn::endpoint\"]Be[5,\"iroh::endpoint\",\"iroh::endpoint\"]Bg[6,\"n0_error::error\",\"n0_error::error\"]Dg[5,\"iroh_relay::server::http_server\",\"iroh_relay::server::http_server\"]4Cc[5,\"hyper::body::incoming\",\"hyper::body::incoming\"]Ca[5,\"iroh::endpoint\",\"iroh::endpoint::connection\"]Bm[5,\"core::net::ip_addr\",\"core::net::ip_addr\"]0Ck[6,\"iroh_relay::endpoint_info\",\"iroh_relay::endpoint_info\"]Am[10,\"iroh_metrics::iterable\"]Db[10,\"core::iter::traits::iterator\",\"core::iter::traits::iterator\"]Bh[6,\"iroh_relay\",\"iroh_relay::key_cache\"]Am[15,\"iroh::endpoint::Source\"]An[10,\"n0_watcher\",\"n0_watcher\"]Ak[6,\"core::cmp\",\"core::cmp\"]Cm[5,\"iroh::endpoint\",\"iroh::socket::remote_map::remote_state\"]Bd[15,\"iroh_relay::client::RecvError\"]j[5,\"iroh\"]Bh[5,\"iroh_relay\",\"iroh_relay::relay_map\"]Ca[5,\"iroh_base::relay_url\",\"iroh_base::relay_url\"]2Bf[5,\"iroh_base\",\"iroh_base::relay_url\"]Bj[15,\"iroh::endpoint::AuthenticationError\"]Bh[10,\"iroh_relay::dns\",\"iroh_relay::dns\"]B`[2,\"iroh_relay::server::client\"]Cm[6,\"iroh_relay::server::client\",\"iroh_relay::server::client\"]Ad[5,\"iroh::endpoint\"]Ad[10,\"alloc::string\"]Ae[10,\"iroh::endpoint\"]Bg[15,\"iroh_relay::protos::relay::Error\"]Ck[5,\"iroh_relay::endpoint_info\",\"iroh_relay::endpoint_info\"]4Aj[5,\"iroh::address_lookup\"]1o[6,\"z32\",\"z32\"]j[2,\"iroh\"]A`[2,\"iroh_relay\"]11Ah[2,\"iroh_relay::server\"]Aj[2,\"iroh_relay::defaults\"]:Ca[5,\"iroh::endpoint\",\"iroh::endpoint::connection\"]Ci[5,\"tokio_rustls_acme::state\",\"tokio_rustls_acme::state\"]Bh[15,\"iroh::endpoint::InvalidSocketAddr\"]Ad[2,\"iroh::endpoint\"]Ca[6,\"iroh::endpoint\",\"iroh::endpoint::connection\"]Al[10,\"tokio::io::async_read\"]2Bc[6,\"iroh::endpoint\",\"iroh::socket\"]Ac[10,\"core::borrow\"]Ac[10,\"async_compat\"]Al[10,\"rand_core\",\"rand_core\"]Cb[15,\"iroh_relay::protos::relay::ClientToRelayMsg\"]Cb[15,\"iroh_relay::protos::relay::RelayToClientMsg\"]Ck[5,\"iroh_relay::protos::relay\",\"iroh_relay::protos::relay\"]Ao[10,\"iroh_quinn_proto::coding\"]Ah[2,\"iroh_relay::client\"]Bm[6,\"iroh_relay::client\",\"iroh_relay::client\"]Ca[5,\"iroh_dns_server::dns\",\"iroh_dns_server::dns\"]03Ak[5,\"core::fmt\",\"core::fmt\"]Ad[6,\"iroh::endpoint\"]Cm[6,\"iroh_relay::protos::common\",\"iroh_relay::protos::common\"]Bg[15,\"iroh_relay::client::ConnectError\"]Cc[15,\"iroh_relay::server::http_server::AcceptError\"]Ae[10,\"iroh::endpoint\"]Bk[5,\"http::header::map\",\"http::header::map\"]Ba[5,\"hdrhistogram\",\"hdrhistogram\"]Co[5,\"tokio::runtime::task::error\",\"tokio::runtime::task::error\"]Bj[15,\"iroh_relay::server::SupervisorError\"]Be[15,\"iroh_relay::server::SpawnError\"]Dc[6,\"iroh_relay::protos::handshake\",\"iroh_relay::protos::handshake\"]j[5,\"iroh\"]Bk[15,\"iroh::endpoint::ConnectWithOptsError\"]Bb[15,\"iroh::address_lookup::Error\"]Bg[15,\"iroh::address_lookup::ParseError\"]Bl[15,\"iroh_relay::endpoint_info::ParseError\"];A`[10,\"core::cmp\"]Ad[5,\"iroh::endpoint\"]An[10,\"crossbeam_epoch::atomic\"]Bj[10,\"tower_http::follow_redirect::policy\"]Bn[15,\"iroh::address_lookup::pkarr::PkarrError\"]Be[5,\"iroh_base::key\",\"iroh_base::key\"]:B`[5,\"iroh_base\",\"iroh_base::key\"]=Ad[6,\"iroh::endpoint\"]Ck[5,\"hickory_proto::rr::rr_set\",\"hickory_proto::rr::rr_set\"]Ck[5,\"tokio::sync::watch::error\",\"tokio::sync::watch::error\"]Ah[2,\"iroh_relay::client\"]Ba[2,\"iroh_relay::server::streams\"]Cc[6,\"iroh_relay::client\",\"iroh_relay::client::conn\"]Co[6,\"iroh_relay::server::streams\",\"iroh_relay::server::streams\"]Be[6,\"iroh::endpoint\",\"iroh::endpoint\"]Cc[8,\"reqwest::dns::resolve\",\"reqwest::dns::resolve\"]:j[5,\"iroh\"]:6543Af[10,\"serde_core::ser\"]1;Cg[5,\"tokio::net::tcp::stream\",\"tokio::net::tcp::stream\"]Bk[15,\"iroh_relay::server::client::RunError\"]Bm[5,\"iroh_relay::server\",\"iroh_relay::server\"]Dg[5,\"iroh_relay::server::http_server\",\"iroh_relay::server::http_server\"]Ak[10,\"futures_core::future\"]Ak[10,\"futures_core::stream\"]Bi[5,\"core::str::error\",\"core::str::error\"]An[15,\"iroh_relay::quic::Error\"]Bg[15,\"iroh_relay::client::ConnectError\"]Bk[15,\"iroh_relay::protos::handshake::Error\"]Bn[5,\"iroh_dns_server\",\"iroh_dns_server::store\"]Bb[2,\"iroh_quinn_proto::connection\"]Ah[2,\"iroh_relay::protos\"]f[3,\"\"]A`[2,\"iroh_relay\"]f[1,\"\"]1o[2,\"iroh_base\"]An[2,\"iroh_quinn_proto::config\"]Em[5,\"clap_builder::parser::matches::arg_matches\",\"clap_builder::parser::matches::arg_matches\"]Am[10,\"tokio::io::async_write\"]Ah[2,\"iroh_relay::server\"]Bm[6,\"iroh_relay::server\",\"iroh_relay::server\"]Bm[5,\"iroh_relay::client\",\"iroh_relay::client\"]Aa[10,\"equivalent\"]Bc[15,\"iroh::endpoint::ConnectError\"]Bb[15,\"iroh::protocol::AcceptError\"]Ca[5,\"iroh::endpoint\",\"iroh::endpoint::connection\"]Am[15,\"iroh::endpoint::Source\"]Cm[5,\"iroh::endpoint::connection\",\"iroh::endpoint::connection\"]43An[15,\"iroh_relay::quic::Error\"]Ce[5,\"iroh_quinn::connection\",\"iroh_quinn::connection\"]4Ae[10,\"iroh::endpoint\"]Bc[5,\"iroh::endpoint\",\"iroh::socket\"]Ca[15,\"iroh::address_lookup::mdns::DiscoveryEvent\"]Ca[5,\"iroh_dns_server::dns\",\"iroh_dns_server::dns\"]Ak[8,\"iroh\",\"iroh_base::key\"]B`[8,\"iroh_base\",\"iroh_base::key\"]Be[8,\"iroh_base::key\",\"iroh_base::key\"]A`[10,\"hashbrown\"]?Ad[5,\"iroh::endpoint\"]Bm[5,\"http::header::name\",\"http::header::name\"]Cc[5,\"iroh_dns_server::http\",\"iroh_dns_server::http\"]0Bc[6,\"core::convert\",\"core::convert\"]Bh[15,\"iroh::endpoint::InvalidSocketAddr\"]B`[10,\"core::future::into_future\"]Bi[15,\"iroh::endpoint_info::DecodingError\"]Bo[15,\"iroh_relay::endpoint_info::DecodingError\"]Bd[15,\"iroh_relay::client::DialError\"]Cg[6,\"iroh_quinn_proto::frame\",\"iroh_quinn_proto::frame\"]Bm[5,\"iroh_metrics::base\",\"iroh_metrics::base\"]B`[15,\"iroh_relay::dns::DnsError\"]Bm[8,\"core::num::nonzero\",\"core::num::nonzero\"]Bb[15,\"iroh::protocol::AcceptError\"]Bk[15,\"iroh_relay::server::client::RunError\"]Aj[2,\"iroh::address_lookup\"]Ao[6,\"url::parser\",\"url::parser\"]Bc[15,\"iroh_relay::dns::LookupError\"]Ao[2,\"iroh_relay::endpoint_info\"]Aj[6,\"iroh::address_lookup\"]Ck[6,\"iroh_relay::endpoint_info\",\"iroh_relay::endpoint_info\"]A`[10,\"core::cmp\"]Ba[2,\"iroh::address_lookup::pkarr\"]Co[6,\"iroh::address_lookup::pkarr\",\"iroh::address_lookup::pkarr\"]Ad[5,\"iroh::endpoint\"]Bi[5,\"iroh_relay::quic\",\"iroh_relay::quic\"]Bm[5,\"iroh_relay::server\",\"iroh_relay::server\"]De[6,\"hickory_proto::rr::record_type\",\"hickory_proto::rr::record_type\"]3Dj[5,\"iroh::endpoint\",\"iroh::socket::remote_map::remote_state::remote_info\"]Ad[6,\"iroh::endpoint\"]Cb[15,\"iroh_relay::protos::relay::RelayToClientMsg\"]Ca[5,\"iroh_quinn::incoming\",\"iroh_quinn::incoming\"]Ca[5,\"iroh::endpoint\",\"iroh::endpoint::connection\"]8Bh[10,\"serde_core::ser\",\"serde_core::ser\"]Ce[6,\"core::net::socket_addr\",\"core::net::socket_addr\"]Ah[2,\"iroh_relay::server\"]Bm[6,\"iroh_relay::server\",\"iroh_relay::server\"]Af[10,\"n0_error::error\"]Ba[5,\"http::status\",\"http::status\"]Ak[10,\"clap_builder::derive\"]Ak[5,\"std::time\",\"std::time\"]Ae[10,\"iroh::endpoint\"]Bl[10,\"iroh::endpoint\",\"iroh::endpoint::bind\"]A`[2,\"iroh_relay\"]An[2,\"iroh::socket::remote_map\"]Am[15,\"iroh::endpoint::Source\"]B`[15,\"iroh::endpoint::BindError\"]Cb[10,\"iroh::address_lookup\",\"iroh::address_lookup\"]Bm[5,\"iroh_relay::client\",\"iroh_relay::client\"]Ab[10,\"core::clone\"]Bg[15,\"iroh::address_lookup::ParseError\"]Ai[2,\"iroh::endpoint_info\"]Ao[2,\"iroh_relay::endpoint_info\"]Bl[15,\"iroh_relay::endpoint_info::ParseError\"]Ai[6,\"iroh::endpoint_info\"]Ck[6,\"iroh_relay::endpoint_info\",\"iroh_relay::endpoint_info\"]4310Ad[2,\"iroh::endpoint\"]Be[6,\"iroh::endpoint\",\"iroh::endpoint\"]Bm[10,\"iroh::endpoint\",\"iroh::endpoint::hooks\"]Aj[10,\"iroh::endpoint_info\"]Cl[10,\"iroh_relay::endpoint_info\",\"iroh_relay::endpoint_info\"]Cc[15,\"iroh_relay::server::client::HandleFrameError\"]Bk[15,\"iroh_relay::server::client::RunError\"]Bg[15,\"iroh_relay::protos::relay::Error\"]1Bi[15,\"iroh::endpoint_info::DecodingError\"]Bo[15,\"iroh_relay::endpoint_info::DecodingError\"]Bh[15,\"iroh::endpoint::InvalidSocketAddr\"]Cg[5,\"iroh_dns_server::config\",\"iroh_dns_server::config\"]Co[5,\"iroh::address_lookup::pkarr\",\"iroh::address_lookup::pkarr\"]Bi[6,\"rustls_pki_types\",\"rustls_pki_types\"]Bo[5,\"iroh::test_utils\",\"iroh::test_utils::qlog\"]Co[5,\"iroh_relay::server::streams\",\"iroh_relay::server::streams\"]Be[5,\"iroh::protocol\",\"iroh::protocol\"]Ac[5,\"iroh::metrics\"]Bj[15,\"iroh_relay::server::SupervisorError\"]Ci[6,\"iroh_base::endpoint_addr\",\"iroh_base::endpoint_addr\"]j[6,\"iroh\"]Bj[6,\"iroh_base\",\"iroh_base::endpoint_addr\"]Bg[5,\"iroh_relay::dns\",\"iroh_relay::dns\"]Ca[15,\"iroh_relay::protos::common::FrameTypeError\"]Bk[15,\"iroh_relay::protos::handshake::Error\"]Ci[5,\"iroh_quinn_proto::coding\",\"iroh_quinn_proto::coding\"]Ca[6,\"iroh::endpoint\",\"iroh::endpoint::connection\"]o[2,\"iroh_base\"]j[2,\"iroh\"]A`[2,\"iroh_relay\"]Ak[2,\"iroh_dns_server::http\"]Bk[5,\"core::net::parser\",\"core::net::parser\"]Bg[15,\"iroh::address_lookup::ParseError\"]Bl[15,\"iroh_relay::endpoint_info::ParseError\"]Cn[15,\"iroh_relay::server::http_server::ConnectionHandlerError\"]Bi[5,\"rustls_pki_types\",\"rustls_pki_types\"]Ak[10,\"clap_builder::derive\"]Be[5,\"iroh::endpoint\",\"iroh::endpoint\"]Ca[5,\"iroh::endpoint\",\"iroh::endpoint::connection\"]Bc[6,\"iroh::endpoint\",\"iroh::socket\"]B`[2,\"iroh::address_lookup::mdns\"]Cm[6,\"iroh::address_lookup::mdns\",\"iroh::address_lookup::mdns\"]D`[5,\"iroh::test_utils\",\"iroh::test_utils::dns_and_pkarr_servers\"]Bk[15,\"iroh::endpoint::ConnectWithOptsError\"]Cc[15,\"iroh::address_lookup::IntoAddressLookupError\"]B`[2,\"iroh_relay::protos::common\"]Bk[15,\"iroh_relay::protos::handshake::Error\"]Bg[15,\"iroh_relay::protos::relay::Error\"]Cm[6,\"iroh_relay::protos::common\",\"iroh_relay::protos::common\"]Al[15,\"iroh::KeyParsingError\"]Ba[15,\"iroh_base::KeyParsingError\"]Co[5,\"iroh_relay::server::streams\",\"iroh_relay::server::streams\"]Bg[15,\"iroh_relay::client::ConnectError\"]Bb[15,\"iroh::address_lookup::Error\"]Ca[5,\"iroh::endpoint::quic\",\"iroh::endpoint::quic\"]Bk[5,\"iroh::endpoint\",\"iroh::endpoint::quic\"]0>Bk[15,\"iroh_relay::protos::handshake::Error\"]?Bl[6,\"iroh::endpoint\",\"iroh::endpoint::hooks\"]:Be[6,\"iroh::endpoint\",\"iroh::endpoint\"]2Bh[15,\"iroh::endpoint::InvalidSocketAddr\"]Bd[15,\"iroh_relay::client::SendError\"]Bm[15,\"iroh_relay::server::streams::SendError\"]An[10,\"iroh_relay\",\"iroh_relay\"]Bi[15,\"iroh::endpoint_info::EncodingError\"]Bo[15,\"iroh_relay::endpoint_info::EncodingError\"]Af[10,\"core::ops::drop\"]Ad[10,\"core::convert\"]Aa[10,\"core::hash\"]Cl[15,\"iroh_relay::server::http_server::ServeConnectionError\"]2g[17,\"\"]Ca[5,\"iroh::address_lookup\",\"iroh::address_lookup\"]Ad[5,\"iroh::endpoint\"]Be[5,\"n0_error::meta\",\"n0_error::meta\"]Cc[5,\"reqwest::dns::resolve\",\"reqwest::dns::resolve\"]Dg[5,\"hickory_proto::rr::domain::name\",\"hickory_proto::rr::domain::name\"]Ak[5,\"std::path\",\"std::path\"]Am[15,\"iroh::endpoint::Source\"]Bi[6,\"core::task::poll\",\"core::task::poll\"]Cc[15,\"iroh_relay::server::client::HandleFrameError\"]>0Ad[6,\"iroh::endpoint\"]Ac[10,\"futures_sink\"]Bb[10,\"core::marker\",\"core::marker\"]Bb[15,\"iroh::address_lookup::Error\"]Cc[15,\"iroh::address_lookup::IntoAddressLookupError\"]Bb[15,\"iroh::protocol::AcceptError\"]Bg[15,\"iroh::address_lookup::ParseError\"]Bl[15,\"iroh_relay::endpoint_info::ParseError\"]Ah[10,\"ppv_lite86::types\"]Ad[2,\"iroh::endpoint\"]f[1,\"\"]f[3,\"\"]Ah[2,\"iroh_relay::client\"]A`[2,\"iroh_relay\"]Ae[2,\"iroh_dns_server\"]A`[2,\"iroh_bench\"]4Aj[2,\"iroh::address_lookup\"]Ad[2,\"iroh::defaults\"]Af[2,\"iroh::test_utils\"]An[2,\"iroh_quinn_proto::config\"]:6Bk[2,\"iroh_quinn_proto::connection::streams\"]::Bd[10,\"core::convert\",\"core::convert\"]Ad[10,\"core::convert\"]Ca[8,\"futures_lite::future\",\"futures_lite::future\"]Ca[8,\"futures_lite::stream\",\"futures_lite::stream\"]Ba[5,\"bytes::bytes\",\"bytes::bytes\"]Ad[5,\"iroh::endpoint\"]Ab[10,\"core::clone\"]Cg[6,\"iroh_quinn_proto::frame\",\"iroh_quinn_proto::frame\"]A`[10,\"core::fmt\"]Ag[10,\"core::ops::deref\"]g[17,\"\"]Ak[5,\"core::fmt\",\"core::fmt\"]Ab[10,\"core::error\"]Be[5,\"std::io::error\",\"std::io::error\"]Aj[2,\"iroh::address_lookup\"]Ba[8,\"clap_builder\",\"clap_builder\"]Bi[5,\"signature::error\",\"signature::error\"]Af[2,\"iroh_relay::quic\"]Bc[2,\"iroh_relay::protos::handshake\"]Ao[2,\"iroh_relay::protos::relay\"]Ba[5,\"hyper::error\",\"hyper::error\"]Ee[6,\"iroh_quinn_proto::transport_parameters\",\"iroh_quinn_proto::transport_parameters\"]Be[5,\"reqwest::error\",\"reqwest::error\"]Bg[6,\"postcard::error\",\"postcard::error\"]Cg[6,\"tokio_websockets::error\",\"tokio_websockets::error\"]Bi[6,\"netwatch::netmon\",\"netwatch::netmon\"]Ca[6,\"iroh::address_lookup\",\"iroh::address_lookup\"]Bi[6,\"iroh_relay::quic\",\"iroh_relay::quic\"]Dc[6,\"iroh_relay::protos::handshake\",\"iroh_relay::protos::handshake\"]Ck[6,\"iroh_relay::protos::relay\",\"iroh_relay::protos::relay\"]Bk[15,\"iroh_relay::server::client::RunError\"]Cl[15,\"iroh_relay::server::http_server::ServeConnectionError\"]Bm[15,\"iroh_relay::server::streams::RecvError\"]Bk[15,\"iroh::endpoint::ConnectWithOptsError\"]Bg[15,\"iroh_relay::protos::relay::Error\"]Bb[10,\"core::marker\",\"core::marker\"]Bk[5,\"iroh_bench::stats\",\"iroh_bench::stats\"]Am[5,\"n0_watcher\",\"n0_watcher\"]2g[17,\"\"]Ah[10,\"std::io\",\"std::io\"]f[1,\"\"]Af[2,\"iroh_quinn_proto\"]Ad[2,\"iroh::endpoint\"]Bb[2,\"iroh_quinn_proto::connection\"]Aj[2,\"iroh::address_lookup\"]A`[2,\"iroh_bench\"]Ah[2,\"iroh_relay::protos\"]6Ae[2,\"iroh_dns_server\"]240677Cn[15,\"iroh_relay::server::http_server::ConnectionHandlerError\"]Ca[5,\"iroh::endpoint\",\"iroh::endpoint::connection\"]Bm[6,\"iroh_relay::server\",\"iroh_relay::server\"]Ac[10,\"core::borrow\"]C`[10,\"bytes::buf::buf_mut\",\"bytes::buf::buf_mut\"]Bc[5,\"pkarr::client\",\"pkarr::client\"]Bm[5,\"iroh_relay::client\",\"iroh_relay::client\"]Cm[5,\"iroh_relay::server::client\",\"iroh_relay::server::client\"]Bd[15,\"iroh::endpoint::EndpointError\"]Ba[5,\"async_compat\",\"async_compat\"]Cg[5,\"iroh_dns_server::config\",\"iroh_dns_server::config\"]3Cb[10,\"core::future::future\",\"core::future::future\"]Ca[5,\"iroh_dns_server::dns\",\"iroh_dns_server::dns\"]An[10,\"core::hash\",\"core::hash\"]Cb[15,\"iroh_relay::protos::relay::RelayToClientMsg\"]Bm[6,\"core::net::ip_addr\",\"core::net::ip_addr\"]Bm[5,\"iroh_relay::server\",\"iroh_relay::server\"]Bh[10,\"reloadable_core\",\"reloadable_core\"]Be[15,\"iroh_relay::server::CertConfig\"]Bj[15,\"iroh::endpoint::AuthenticationError\"]Ad[5,\"iroh::endpoint\"]Ba[6,\"core::option\",\"core::option\"]g[17,\"\"]2E`[10,\"tower_http::follow_redirect::policy\",\"tower_http::follow_redirect::policy\"]Ch[10,\"iroh::endpoint::presets\",\"iroh::endpoint::presets\"]Co[5,\"hickory_proto::rr::resource\",\"hickory_proto::rr::resource\"]Bl[15,\"iroh::endpoint::AfterHandshakeOutcome\"]Ak[8,\"core::fmt\",\"core::fmt\"]Ba[6,\"core::result\",\"core::result\"]Be[8,\"std::io::error\",\"std::io::error\"]Ai[8,\"n0_error\",\"n0_error\"]Be[5,\"iroh::protocol\",\"iroh::protocol\"]Cg[5,\"iroh_dns_server::server\",\"iroh_dns_server::server\"]Bm[5,\"iroh_relay::server\",\"iroh_relay::server\"]Ad[2,\"iroh::endpoint\"]Bo[6,\"iroh::endpoint\",\"iroh::socket::remote_map\"]Cb[15,\"iroh_relay::server::client::WriteFrameError\"]Ak[10,\"futures_core::stream\"]Am[5,\"n0_watcher\",\"n0_watcher\"]Bc[5,\"alloc::string\",\"alloc::string\"]Ak[5,\"core::any\",\"core::any\"]Ci[5,\"iroh_quinn_proto::varint\",\"iroh_quinn_proto::varint\"]Ad[5,\"iroh::endpoint\"]Bn[15,\"iroh::address_lookup::pkarr::PkarrError\"]A`[2,\"iroh_relay\"]Ah[2,\"iroh_relay::server\"]Ah[2,\"iroh_relay::protos\"]Af[2,\"iroh_quinn_proto\"]Ae[2,\"iroh_dns_server\"]1Aj[2,\"iroh::address_lookup\"]551j[2,\"iroh\"]3Ae[10,\"iroh::endpoint\"]Bg[8,\"iroh_relay::dns\",\"iroh_relay::dns\"]Be[5,\"iroh::endpoint\",\"iroh::endpoint\"]Di[5,\"iroh::address_lookup::pkarr::dht\",\"iroh::address_lookup::pkarr::dht\"]Bg[5,\"iroh_relay::dns\",\"iroh_relay::dns\"]Co[5,\"iroh_relay::server::clients\",\"iroh_relay::server::clients\"]De[5,\"clap_builder::builder::command\",\"clap_builder::builder::command\"]Bc[15,\"iroh::endpoint::ConnectError\"]An[15,\"iroh_relay::quic::Error\"]Bi[5,\"core::task::wake\",\"core::task::wake\"]Cc[5,\"iroh_metrics::metrics\",\"iroh_metrics::metrics\"]Ad[10,\"core::default\"]A`[10,\"core::fmt\"]Bm[5,\"tokio::time::error\",\"tokio::time::error\"]Ca[15,\"iroh::address_lookup::mdns::DiscoveryEvent\"]Bc[10,\"axum_core::extract::from_ref\"]Ah[10,\"core::str::traits\"]Ak[5,\"std::time\",\"std::time\"]Ag[5,\"std::io\",\"std::io\"]Ci[5,\"iroh_quinn_proto::crypto\",\"iroh_quinn_proto::crypto\"]Bj[15,\"iroh_relay::server::SupervisorError\"]Ci[5,\"iroh_dns_server::metrics\",\"iroh_dns_server::metrics\"]Cf[5,\"iroh_relay::server\",\"iroh_relay::server::metrics\"]Am[5,\"n0_watcher\",\"n0_watcher\"]Ad[5,\"iroh::endpoint\"]Ak[5,\"std::path\",\"std::path\"]Bk[5,\"dyn_clone::sealed\",\"dyn_clone::sealed\"]Bo[5,\"tokio::io::read_buf\",\"tokio::io::read_buf\"]Bc[5,\"http::request\",\"http::request\"]Eg[5,\"hickory_server::server::request_handler\",\"hickory_server::server::request_handler\"]B`[15,\"iroh_relay::dns::DnsError\"]Al[10,\"reqwest::dns::resolve\"]Cg[5,\"tokio::runtime::runtime\",\"tokio::runtime::runtime\"]An[10,\"hyper::service::service\"]B`[15,\"iroh::endpoint::BindError\"]Cg[5,\"iroh_quinn::send_stream\",\"iroh_quinn::send_stream\"]Bd[15,\"iroh_relay::client::DialError\"]Cb[15,\"iroh_relay::server::client::WriteFrameError\"]Cl[15,\"iroh_relay::server::http_server::ServeConnectionError\"]8Ad[10,\"alloc::borrow\"]Ad[10,\"core::convert\"]0Bg[15,\"iroh_relay::client::ConnectError\"]k[10,\"iroh\"]Ad[5,\"iroh::endpoint\"]Ah[2,\"iroh_relay::server\"]j[2,\"iroh\"]1Ae[2,\"iroh_dns_server\"]f[1,\"\"]Ad[2,\"iroh::endpoint\"]Ad[2,\"iroh::defaults\"]5Ah[2,\"iroh_relay::protos\"]Bb[2,\"iroh_quinn_proto::connection\"]78Bc[5,\"n0_error::any\",\"n0_error::any\"]Ce[5,\"iroh_dns_server::state\",\"iroh_dns_server::state\"]De[5,\"alloc::collections::btree::set\",\"alloc::collections::btree::set\"]Bk[5,\"iroh::endpoint\",\"iroh::endpoint::bind\"]Bi[5,\"bytes::bytes_mut\",\"bytes::bytes_mut\"]Ch[6,\"iroh_dns_server::http\",\"iroh_dns_server::http::tls\"]Am[6,\"iroh_bench\",\"iroh_bench\"]Ag[10,\"core::ops::deref\"]Ae[2,\"iroh_relay::dns\"]Bg[6,\"iroh_relay::dns\",\"iroh_relay::dns\"]Am[5,\"core::time\",\"core::time\"]A`[10,\"dyn_clone\"]Bn[15,\"iroh::address_lookup::pkarr::PkarrError\"]Ca[5,\"iroh_quinn::endpoint\",\"iroh_quinn::endpoint\"]Be[5,\"iroh::endpoint\",\"iroh::endpoint\"]Bg[6,\"n0_error::error\",\"n0_error::error\"]Dg[5,\"iroh_relay::server::http_server\",\"iroh_relay::server::http_server\"]4Cc[5,\"hyper::body::incoming\",\"hyper::body::incoming\"]Ca[5,\"iroh::endpoint\",\"iroh::endpoint::connection\"]Bm[5,\"core::net::ip_addr\",\"core::net::ip_addr\"]0Ck[6,\"iroh_relay::endpoint_info\",\"iroh_relay::endpoint_info\"]Am[10,\"iroh_metrics::iterable\"]Db[10,\"core::iter::traits::iterator\",\"core::iter::traits::iterator\"]Bh[6,\"iroh_relay\",\"iroh_relay::key_cache\"]Am[15,\"iroh::endpoint::Source\"]An[10,\"n0_watcher\",\"n0_watcher\"]Ak[6,\"core::cmp\",\"core::cmp\"]Cm[5,\"iroh::endpoint\",\"iroh::socket::remote_map::remote_state\"]Bd[15,\"iroh_relay::client::RecvError\"]j[5,\"iroh\"]Bh[5,\"iroh_relay\",\"iroh_relay::relay_map\"]Ca[5,\"iroh_base::relay_url\",\"iroh_base::relay_url\"]2Bf[5,\"iroh_base\",\"iroh_base::relay_url\"]Bj[15,\"iroh::endpoint::AuthenticationError\"]Bh[10,\"iroh_relay::dns\",\"iroh_relay::dns\"]B`[2,\"iroh_relay::server::client\"]Cm[6,\"iroh_relay::server::client\",\"iroh_relay::server::client\"]Ad[5,\"iroh::endpoint\"]Ad[10,\"alloc::string\"]Ae[10,\"iroh::endpoint\"]Bg[15,\"iroh_relay::protos::relay::Error\"]Ck[5,\"iroh_relay::endpoint_info\",\"iroh_relay::endpoint_info\"]4Aj[5,\"iroh::address_lookup\"]1o[6,\"z32\",\"z32\"]j[2,\"iroh\"]A`[2,\"iroh_relay\"]11Ah[2,\"iroh_relay::server\"]Aj[2,\"iroh_relay::defaults\"]:Ca[5,\"iroh::endpoint\",\"iroh::endpoint::connection\"]Ci[5,\"tokio_rustls_acme::state\",\"tokio_rustls_acme::state\"]Bh[15,\"iroh::endpoint::InvalidSocketAddr\"]Ad[2,\"iroh::endpoint\"]Ca[6,\"iroh::endpoint\",\"iroh::endpoint::connection\"]Al[10,\"tokio::io::async_read\"]2Bc[6,\"iroh::endpoint\",\"iroh::socket\"]Ac[10,\"core::borrow\"]Ac[10,\"async_compat\"]Al[10,\"rand_core\",\"rand_core\"]Cb[15,\"iroh_relay::protos::relay::ClientToRelayMsg\"]Cb[15,\"iroh_relay::protos::relay::RelayToClientMsg\"]Ck[5,\"iroh_relay::protos::relay\",\"iroh_relay::protos::relay\"]Ao[10,\"iroh_quinn_proto::coding\"]Ah[2,\"iroh_relay::client\"]Bm[6,\"iroh_relay::client\",\"iroh_relay::client\"]Ca[5,\"iroh_dns_server::dns\",\"iroh_dns_server::dns\"]03Ak[5,\"core::fmt\",\"core::fmt\"]Ad[6,\"iroh::endpoint\"]Cm[6,\"iroh_relay::protos::common\",\"iroh_relay::protos::common\"]Bg[15,\"iroh_relay::client::ConnectError\"]Cc[15,\"iroh_relay::server::http_server::AcceptError\"]Ae[10,\"iroh::endpoint\"]Bk[5,\"http::header::map\",\"http::header::map\"]Ba[5,\"hdrhistogram\",\"hdrhistogram\"]Co[5,\"tokio::runtime::task::error\",\"tokio::runtime::task::error\"]Bj[15,\"iroh_relay::server::SupervisorError\"]Be[15,\"iroh_relay::server::SpawnError\"]Dc[6,\"iroh_relay::protos::handshake\",\"iroh_relay::protos::handshake\"]j[5,\"iroh\"]Bk[15,\"iroh::endpoint::ConnectWithOptsError\"]Bb[15,\"iroh::address_lookup::Error\"]Bg[15,\"iroh::address_lookup::ParseError\"]Bl[15,\"iroh_relay::endpoint_info::ParseError\"];A`[10,\"core::cmp\"]Ad[5,\"iroh::endpoint\"]An[10,\"crossbeam_epoch::atomic\"]Bj[10,\"tower_http::follow_redirect::policy\"]Bn[15,\"iroh::address_lookup::pkarr::PkarrError\"]Be[5,\"iroh_base::key\",\"iroh_base::key\"]:B`[5,\"iroh_base\",\"iroh_base::key\"]=Ad[6,\"iroh::endpoint\"]Ck[5,\"hickory_proto::rr::rr_set\",\"hickory_proto::rr::rr_set\"]Ck[5,\"tokio::sync::watch::error\",\"tokio::sync::watch::error\"]Ah[2,\"iroh_relay::client\"]Ba[2,\"iroh_relay::server::streams\"]Cc[6,\"iroh_relay::client\",\"iroh_relay::client::conn\"]Co[6,\"iroh_relay::server::streams\",\"iroh_relay::server::streams\"]Be[6,\"iroh::endpoint\",\"iroh::endpoint\"]Cc[8,\"reqwest::dns::resolve\",\"reqwest::dns::resolve\"]:j[5,\"iroh\"]:6543Af[10,\"serde_core::ser\"]1;Cg[5,\"tokio::net::tcp::stream\",\"tokio::net::tcp::stream\"]Bk[15,\"iroh_relay::server::client::RunError\"]Bm[5,\"iroh_relay::server\",\"iroh_relay::server\"]Dg[5,\"iroh_relay::server::http_server\",\"iroh_relay::server::http_server\"]Ak[10,\"futures_core::future\"]Ak[10,\"futures_core::stream\"]Bi[5,\"core::str::error\",\"core::str::error\"]An[15,\"iroh_relay::quic::Error\"]Bg[15,\"iroh_relay::client::ConnectError\"]Bk[15,\"iroh_relay::protos::handshake::Error\"]Bn[5,\"iroh_dns_server\",\"iroh_dns_server::store\"]Bb[2,\"iroh_quinn_proto::connection\"]Ah[2,\"iroh_relay::protos\"]f[3,\"\"]A`[2,\"iroh_relay\"]f[1,\"\"]1o[2,\"iroh_base\"]An[2,\"iroh_quinn_proto::config\"]Em[5,\"clap_builder::parser::matches::arg_matches\",\"clap_builder::parser::matches::arg_matches\"]Am[10,\"tokio::io::async_write\"]Ah[2,\"iroh_relay::server\"]Bm[6,\"iroh_relay::server\",\"iroh_relay::server\"]Bm[5,\"iroh_relay::client\",\"iroh_relay::client\"]Aa[10,\"equivalent\"]Bc[15,\"iroh::endpoint::ConnectError\"]Bb[15,\"iroh::protocol::AcceptError\"]Ca[5,\"iroh::endpoint\",\"iroh::endpoint::connection\"]Am[15,\"iroh::endpoint::Source\"]Cm[5,\"iroh::endpoint::connection\",\"iroh::endpoint::connection\"]43An[15,\"iroh_relay::quic::Error\"]Ce[5,\"iroh_quinn::connection\",\"iroh_quinn::connection\"]4Ae[10,\"iroh::endpoint\"]Bc[5,\"iroh::endpoint\",\"iroh::socket\"]Ca[15,\"iroh::address_lookup::mdns::DiscoveryEvent\"]Ca[5,\"iroh_dns_server::dns\",\"iroh_dns_server::dns\"]Ak[8,\"iroh\",\"iroh_base::key\"]B`[8,\"iroh_base\",\"iroh_base::key\"]Be[8,\"iroh_base::key\",\"iroh_base::key\"]A`[10,\"hashbrown\"]?Ad[5,\"iroh::endpoint\"]Bm[5,\"http::header::name\",\"http::header::name\"]Cc[5,\"iroh_dns_server::http\",\"iroh_dns_server::http\"]0Bc[6,\"core::convert\",\"core::convert\"]Bh[15,\"iroh::endpoint::InvalidSocketAddr\"]B`[10,\"core::future::into_future\"]Bi[15,\"iroh::endpoint_info::DecodingError\"]Bo[15,\"iroh_relay::endpoint_info::DecodingError\"]Bd[15,\"iroh_relay::client::DialError\"]Cg[6,\"iroh_quinn_proto::frame\",\"iroh_quinn_proto::frame\"]Bm[5,\"iroh_metrics::base\",\"iroh_metrics::base\"]B`[15,\"iroh_relay::dns::DnsError\"]Bm[8,\"core::num::nonzero\",\"core::num::nonzero\"]Bb[15,\"iroh::protocol::AcceptError\"]Bk[15,\"iroh_relay::server::client::RunError\"]Aj[2,\"iroh::address_lookup\"]Ao[6,\"url::parser\",\"url::parser\"]Bc[15,\"iroh_relay::dns::LookupError\"]Ao[2,\"iroh_relay::endpoint_info\"]Aj[6,\"iroh::address_lookup\"]Ck[6,\"iroh_relay::endpoint_info\",\"iroh_relay::endpoint_info\"]A`[10,\"core::cmp\"]Ba[2,\"iroh::address_lookup::pkarr\"]Co[6,\"iroh::address_lookup::pkarr\",\"iroh::address_lookup::pkarr\"]Ad[5,\"iroh::endpoint\"]Bi[5,\"iroh_relay::quic\",\"iroh_relay::quic\"]Bm[5,\"iroh_relay::server\",\"iroh_relay::server\"]De[6,\"hickory_proto::rr::record_type\",\"hickory_proto::rr::record_type\"]3Dj[5,\"iroh::endpoint\",\"iroh::socket::remote_map::remote_state::remote_info\"]Ad[6,\"iroh::endpoint\"]Cb[15,\"iroh_relay::protos::relay::RelayToClientMsg\"]Ca[5,\"iroh_quinn::incoming\",\"iroh_quinn::incoming\"]Ca[5,\"iroh::endpoint\",\"iroh::endpoint::connection\"]8Bh[10,\"serde_core::ser\",\"serde_core::ser\"]Ce[6,\"core::net::socket_addr\",\"core::net::socket_addr\"]Ah[2,\"iroh_relay::server\"]Bm[6,\"iroh_relay::server\",\"iroh_relay::server\"]Af[10,\"n0_error::error\"]Ba[5,\"http::status\",\"http::status\"]Ak[10,\"clap_builder::derive\"]Ak[5,\"std::time\",\"std::time\"]Ae[10,\"iroh::endpoint\"]Bl[10,\"iroh::endpoint\",\"iroh::endpoint::bind\"]A`[2,\"iroh_relay\"]An[2,\"iroh::socket::remote_map\"]Am[15,\"iroh::endpoint::Source\"]B`[15,\"iroh::endpoint::BindError\"]Cb[10,\"iroh::address_lookup\",\"iroh::address_lookup\"]Bm[5,\"iroh_relay::client\",\"iroh_relay::client\"]Ab[10,\"core::clone\"]Bg[15,\"iroh::address_lookup::ParseError\"]Ai[2,\"iroh::endpoint_info\"]Ao[2,\"iroh_relay::endpoint_info\"]Bl[15,\"iroh_relay::endpoint_info::ParseError\"]Ai[6,\"iroh::endpoint_info\"]Ck[6,\"iroh_relay::endpoint_info\",\"iroh_relay::endpoint_info\"]4310Ad[2,\"iroh::endpoint\"]Be[6,\"iroh::endpoint\",\"iroh::endpoint\"]Bm[10,\"iroh::endpoint\",\"iroh::endpoint::hooks\"]Aj[10,\"iroh::endpoint_info\"]Cl[10,\"iroh_relay::endpoint_info\",\"iroh_relay::endpoint_info\"]Cc[15,\"iroh_relay::server::client::HandleFrameError\"]Bk[15,\"iroh_relay::server::client::RunError\"]Bg[15,\"iroh_relay::protos::relay::Error\"]1Bi[15,\"iroh::endpoint_info::DecodingError\"]Bo[15,\"iroh_relay::endpoint_info::DecodingError\"]Bh[15,\"iroh::endpoint::InvalidSocketAddr\"]Cg[5,\"iroh_dns_server::config\",\"iroh_dns_server::config\"]Co[5,\"iroh::address_lookup::pkarr\",\"iroh::address_lookup::pkarr\"]Bi[6,\"rustls_pki_types\",\"rustls_pki_types\"]Bo[5,\"iroh::test_utils\",\"iroh::test_utils::qlog\"]Co[5,\"iroh_relay::server::streams\",\"iroh_relay::server::streams\"]Be[5,\"iroh::protocol\",\"iroh::protocol\"]Ac[5,\"iroh::metrics\"]Bj[15,\"iroh_relay::server::SupervisorError\"]Ci[6,\"iroh_base::endpoint_addr\",\"iroh_base::endpoint_addr\"]j[6,\"iroh\"]Bj[6,\"iroh_base\",\"iroh_base::endpoint_addr\"]Bg[5,\"iroh_relay::dns\",\"iroh_relay::dns\"]Ca[15,\"iroh_relay::protos::common::FrameTypeError\"]Bk[15,\"iroh_relay::protos::handshake::Error\"]Ci[5,\"iroh_quinn_proto::coding\",\"iroh_quinn_proto::coding\"]Ca[6,\"iroh::endpoint\",\"iroh::endpoint::connection\"]o[2,\"iroh_base\"]j[2,\"iroh\"]A`[2,\"iroh_relay\"]Ak[2,\"iroh_dns_server::http\"]Bk[5,\"core::net::parser\",\"core::net::parser\"]Bg[15,\"iroh::address_lookup::ParseError\"]Bl[15,\"iroh_relay::endpoint_info::ParseError\"]Cn[15,\"iroh_relay::server::http_server::ConnectionHandlerError\"]Bi[5,\"rustls_pki_types\",\"rustls_pki_types\"]Ak[10,\"clap_builder::derive\"]Be[5,\"iroh::endpoint\",\"iroh::endpoint\"]Ca[5,\"iroh::endpoint\",\"iroh::endpoint::connection\"]Bc[6,\"iroh::endpoint\",\"iroh::socket\"]B`[2,\"iroh::address_lookup::mdns\"]Cm[6,\"iroh::address_lookup::mdns\",\"iroh::address_lookup::mdns\"]D`[5,\"iroh::test_utils\",\"iroh::test_utils::dns_and_pkarr_servers\"]Bk[15,\"iroh::endpoint::ConnectWithOptsError\"]Cc[15,\"iroh::address_lookup::IntoAddressLookupError\"]B`[2,\"iroh_relay::protos::common\"]Bk[15,\"iroh_relay::protos::handshake::Error\"]Bg[15,\"iroh_relay::protos::relay::Error\"]Cm[6,\"iroh_relay::protos::common\",\"iroh_relay::protos::common\"]Al[15,\"iroh::KeyParsingError\"]Ba[15,\"iroh_base::KeyParsingError\"]Co[5,\"iroh_relay::server::streams\",\"iroh_relay::server::streams\"]Bg[15,\"iroh_relay::client::ConnectError\"]Bb[15,\"iroh::address_lookup::Error\"]Ca[5,\"iroh::endpoint::quic\",\"iroh::endpoint::quic\"]Bk[5,\"iroh::endpoint\",\"iroh::endpoint::quic\"]0>Bk[15,\"iroh_relay::protos::handshake::Error\"]?Bl[6,\"iroh::endpoint\",\"iroh::endpoint::hooks\"]:Be[6,\"iroh::endpoint\",\"iroh::endpoint\"]2Bh[15,\"iroh::endpoint::InvalidSocketAddr\"]Bd[15,\"iroh_relay::client::SendError\"]Bm[15,\"iroh_relay::server::streams::SendError\"]An[10,\"iroh_relay\",\"iroh_relay\"]Bi[15,\"iroh::endpoint_info::EncodingError\"]Bo[15,\"iroh_relay::endpoint_info::EncodingError\"]33struct Inner { 34 /// The list of all currently connected clients. 35 clients: DashMap<EndpointId, ClientState>, -36 // /// List of clients that are still connected, but not active anymore -37 // /// -38 // /// Clients are moved here if another endpoint with the same id connects. -39 // inactive_clients: DashMap<EndpointId, Vec<Client>>, -40 /// Map of which client has sent where -41 sent_to: DashMap<EndpointId, HashSet<EndpointId>>, -42 /// Connection ID Counter -43 next_connection_id: AtomicU64, -44} -45 -46#[derive(Debug)] -47struct ClientState { -48 active: Client, -49 inactive: Vec<Client>, -50} -51 -52impl ClientState { -53 async fn shutdown_all(mut self) { -54 [self.active] -55 .into_iter() -56 .chain(self.inactive.drain(..)) -57 .map(Client::shutdown) -58 .join_all() -59 .await; -60 } -61} -62 -63impl Clients { -64 /// Shuts down all connected clients. -65 /// -66 /// This method gracefully disconnects all active client connections managed by -67 /// this registry. It will wait for all clients to complete their shutdown before -68 /// returning. -69 pub async fn shutdown(&self) { -70 let keys: Vec<_> = self.0.clients.iter().map(|x| *x.key()).collect(); -71 trace!("shutting down {} clients", keys.len()); -72 let clients = keys.into_iter().filter_map(|k| self.0.clients.remove(&k)); -73 n0_future::join_all(clients.map(|(_, state)| state.shutdown_all())).await; -74 } -75 -76 /// Builds the client handler and starts the read & write loops for the connection. -77 pub fn register<S>(&self, client_config: Config<S>, metrics: Arc<Metrics>) -78 where -79 S: BytesStreamSink + Send + 'static, -80 { -81 let endpoint_id = client_config.endpoint_id; -82 let connection_id = self.get_connection_id(); -83 trace!(remote_endpoint = %endpoint_id.fmt_short(), "registering client"); -84 -85 let client = Client::new(client_config, connection_id, self, metrics); -86 match self.0.clients.entry(endpoint_id) { -87 dashmap::Entry::Occupied(mut entry) => { -88 let state = entry.get_mut(); -89 let old_client = std::mem::replace(&mut state.active, client); -90 debug!( -91 remote_endpoint = %endpoint_id.fmt_short(), -92 "multiple connections found, deactivating old connection", -93 ); -94 old_client -95 .try_send_health("Another endpoint connected with the same endpoint id. No more messages will be received".to_string()) -96 .ok(); -97 state.inactive.push(old_client); -98 } -99 dashmap::Entry::Vacant(entry) => { -100 entry.insert(ClientState { -101 active: client, -102 inactive: Vec::new(), -103 }); -104 } -105 } +36 /// Map of which client has sent where +37 sent_to: DashMap<EndpointId, HashSet<EndpointId>>, +38 /// Connection ID Counter +39 next_connection_id: AtomicU64, +40} +41 +42#[derive(Debug)] +43struct ClientState { +44 active: Client, +45 inactive: Vec<Client>, +46} +47 +48impl ClientState { +49 async fn shutdown_all(mut self) { +50 [self.active] +51 .into_iter() +52 .chain(self.inactive.drain(..)) +53 .map(Client::shutdown) +54 .join_all() +55 .await; +56 } +57} +58 +59impl Clients { +60 /// Shuts down all connected clients. +61 /// +62 /// This method gracefully disconnects all active client connections managed by +63 /// this registry. It will wait for all clients to complete their shutdown before +64 /// returning. +65 pub async fn shutdown(&self) { +66 let keys: Vec<_> = self.0.clients.iter().map(|x| *x.key()).collect(); +67 trace!("shutting down {} clients", keys.len()); +68 let clients = keys.into_iter().filter_map(|k| self.0.clients.remove(&k)); +69 n0_future::join_all(clients.map(|(_, state)| state.shutdown_all())).await; +70 } +71 +72 /// Builds the client handler and starts the read & write loops for the connection. +73 pub fn register<S>(&self, client_config: Config<S>, metrics: Arc<Metrics>) +74 where +75 S: BytesStreamSink + Send + 'static, +76 { +77 let endpoint_id = client_config.endpoint_id; +78 let connection_id = self.get_connection_id(); +79 trace!(remote_endpoint = %endpoint_id.fmt_short(), "registering client"); +80 +81 let client = Client::new(client_config, connection_id, self, metrics); +82 match self.0.clients.entry(endpoint_id) { +83 dashmap::Entry::Occupied(mut entry) => { +84 let state = entry.get_mut(); +85 let old_client = std::mem::replace(&mut state.active, client); +86 debug!( +87 remote_endpoint = %endpoint_id.fmt_short(), +88 "multiple connections found, deactivating old connection", +89 ); +90 old_client +91 .try_send_health("Another endpoint connected with the same endpoint id. No more messages will be received".to_string()) +92 .ok(); +93 state.inactive.push(old_client); +94 } +95 dashmap::Entry::Vacant(entry) => { +96 entry.insert(ClientState { +97 active: client, +98 inactive: Vec::new(), +99 }); +100 } +101 } +102 } +103 +104 fn get_connection_id(&self) -> u64 { +105 self.0.next_connection_id.fetch_add(1, Ordering::Relaxed) 106 } 107 -108 fn get_connection_id(&self) -> u64 { -109 self.0.next_connection_id.fetch_add(1, Ordering::Relaxed) -110 } -111 -112 /// Removes the client from the map of clients, & sends a notification -113 /// to each client that peers has sent data to, to let them know that -114 /// peer is gone from the network. -115 /// -116 /// Must be passed a matching connection_id. -117 pub(super) fn unregister(&self, connection_id: u64, endpoint_id: EndpointId) { -118 trace!( -119 endpoint_id = %endpoint_id.fmt_short(), -120 connection_id, "unregistering client" -121 ); -122 -123 self.0.clients.remove_if_mut(&endpoint_id, |_id, state| { -124 if state.active.connection_id() == connection_id { -125 // The unregistering client is the currently active client -126 let client = &state.active; -127 if let Some(last_inactive_client) = state.inactive.pop() { -128 // There is an inactive client, promote to active again. -129 state.active = last_inactive_client; -130 // Don't remove the entry from client map. -131 false -132 } else { -133 // No inactive clients: Inform other peers that this peer is now gone. -134 if let Some((_, sent_to)) = self.0.sent_to.remove(&endpoint_id) { -135 for key in sent_to { -136 match client.try_send_peer_gone(key) { -137 Ok(_) => {} -138 Err(TrySendError::Full(_)) => { -139 debug!( -140 dst = %key.fmt_short(), -141 "client too busy to receive packet, dropping packet" -142 ); -143 } -144 Err(TrySendError::Closed(_)) => { -145 debug!( -146 dst = %key.fmt_short(), -147 "can no longer write to client, dropping packet" -148 ); -149 } -150 } -151 } -152 } -153 // Remove entry from the client map. -154 true -155 } -156 } else { -157 // The unregistering client is already inactive. Remove from the list of inactive clients. -158 state -159 .inactive -160 .retain(|client| client.connection_id() != connection_id); -161 // Active client is unmodified: keep entry in map. -162 false -163 } -164 }); -165 } -166 -167 /// Attempt to send a packet to client with [`EndpointId`] `dst`. -168 pub(super) fn send_packet( -169 &self, -170 dst: EndpointId, -171 data: Datagrams, -172 src: EndpointId, -173 metrics: &Metrics, -174 ) -> Result<(), ForwardPacketError> { -175 let Some(client) = self.0.clients.get(&dst) else { -176 debug!(dst = %dst.fmt_short(), "no connected client, dropped packet"); -177 metrics.send_packets_dropped.inc(); -178 return Ok(()); -179 }; -180 match client.active.try_send_packet(src, data) { -181 Ok(_) => { -182 // Record sent_to relationship -183 self.0.sent_to.entry(src).or_default().insert(dst); -184 Ok(()) -185 } -186 Err(TrySendError::Full(_)) => { -187 debug!( -188 dst = %dst.fmt_short(), -189 "client too busy to receive packet, dropping packet" -190 ); -191 Err(ForwardPacketError::new(SendError::Full)) -192 } -193 Err(TrySendError::Closed(_)) => { -194 debug!( -195 dst = %dst.fmt_short(), -196 "can no longer write to client, dropping message and pruning connection" -197 ); -198 client.active.start_shutdown(); -199 Err(ForwardPacketError::new(SendError::Closed)) -200 } -201 } -202 } -203 -204 #[cfg(test)] -205 fn active_connection_id(&self, endpoint_id: EndpointId) -> Option<u64> { -206 self.0 -207 .clients -208 .get(&endpoint_id) -209 .map(|s| s.active.connection_id()) -210 } -211} -212 -213#[cfg(test)] -214mod tests { -215 use std::time::Duration; -216 -217 use iroh_base::SecretKey; -218 use n0_error::{Result, StdResultExt}; -219 use n0_future::{Stream, StreamExt}; -220 use n0_tracing_test::traced_test; -221 use rand::SeedableRng; -222 -223 use super::*; -224 use crate::{ -225 client::conn::Conn, -226 protos::{common::FrameType, relay::RelayToClientMsg, streams::WsBytesFramed}, -227 server::streams::{MaybeTlsStream, RateLimited, ServerRelayedStream}, -228 }; -229 -230 async fn recv_frame< -231 E: std::error::Error + Sync + Send + 'static, -232 S: Stream<Item = Result<RelayToClientMsg, E>> + Unpin, -233 >( -234 frame_type: FrameType, -235 mut stream: S, -236 ) -> Result<RelayToClientMsg> { -237 match stream.next().await { -238 Some(Ok(frame)) => { -239 if frame_type != frame.typ() { -240 n0_error::bail_any!( -241 "Unexpected frame, got {:?}, but expected {:?}", -242 frame.typ(), -243 frame_type -244 ); -245 } -246 Ok(frame) -247 } -248 Some(Err(err)) => Err(err).anyerr(), -249 None => n0_error::bail_any!("Unexpected EOF, expected frame {frame_type:?}"), -250 } -251 } -252 -253 fn test_client_builder( -254 key: EndpointId, -255 ) -> (Config<WsBytesFramed<RateLimited<MaybeTlsStream>>>, Conn) { -256 let (server, client) = tokio::io::duplex(1024); -257 ( -258 Config { -259 endpoint_id: key, -260 stream: ServerRelayedStream::test(server), -261 write_timeout: Duration::from_secs(1), -262 channel_capacity: 10, -263 }, -264 Conn::test(client), -265 ) -266 } -267 -268 #[tokio::test] -269 #[traced_test] -270 async fn test_clients() -> Result { -271 let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(0u64); -272 let a_key = SecretKey::generate(&mut rng).public(); -273 let b_key = SecretKey::generate(&mut rng).public(); -274 -275 let (builder_a, mut a_rw) = test_client_builder(a_key); -276 -277 let clients = Clients::default(); -278 let metrics = Arc::new(Metrics::default()); -279 clients.register(builder_a, metrics.clone()); -280 -281 // send packet -282 let data = b"hello world!"; -283 clients.send_packet(a_key, Datagrams::from(&data[..]), b_key, &metrics)?; -284 let frame = recv_frame(FrameType::RelayToClientDatagram, &mut a_rw).await?; -285 assert_eq!( -286 frame, -287 RelayToClientMsg::Datagrams { -288 remote_endpoint_id: b_key, -289 datagrams: data.to_vec().into(), -290 } -291 ); -292 -293 { -294 let client = clients.0.clients.get(&a_key).unwrap(); -295 // shutdown client a, this should trigger the removal from the clients list -296 client.active.start_shutdown(); -297 } -298 -299 // need to wait a moment for the removal to be processed -300 let c = clients.clone(); -301 tokio::time::timeout(Duration::from_secs(1), async move { -302 loop { -303 if !c.0.clients.contains_key(&a_key) { -304 break; -305 } -306 tokio::time::sleep(Duration::from_millis(100)).await; -307 } -308 }) -309 .await -310 .std_context("timeout")?; -311 clients.shutdown().await; -312 -313 Ok(()) -314 } -315 -316 #[tokio::test] -317 #[traced_test] -318 async fn test_clients_same_endpoint_id() -> Result { -319 let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(0u64); -320 let a_key = SecretKey::generate(&mut rng).public(); -321 let b_key = SecretKey::generate(&mut rng).public(); +108 /// Removes the client from the map of clients, & sends a notification +109 /// to each client that peers has sent data to, to let them know that +110 /// peer is gone from the network. +111 /// +112 /// Must be passed a matching connection_id. +113 pub(super) fn unregister(&self, connection_id: u64, endpoint_id: EndpointId) { +114 trace!( +115 endpoint_id = %endpoint_id.fmt_short(), +116 connection_id, "unregistering client" +117 ); +118 +119 self.0.clients.remove_if_mut(&endpoint_id, |_id, state| { +120 if state.active.connection_id() == connection_id { +121 // The unregistering client is the currently active client +122 if let Some(last_inactive_client) = state.inactive.pop() { +123 // There is an inactive client, promote to active again. +124 state.active = last_inactive_client; +125 // Don't remove the entry from client map. +126 false +127 } else { +128 // No inactive clients: Inform other peers that this peer is now gone. +129 if let Some((_, sent_to)) = self.0.sent_to.remove(&endpoint_id) { +130 for key in sent_to { +131 match state.active.try_send_peer_gone(key) { +132 Ok(_) => {} +133 Err(TrySendError::Full(_)) => { +134 debug!( +135 dst = %key.fmt_short(), +136 "client too busy to receive packet, dropping packet" +137 ); +138 } +139 Err(TrySendError::Closed(_)) => { +140 debug!( +141 dst = %key.fmt_short(), +142 "can no longer write to client, dropping packet" +143 ); +144 } +145 } +146 } +147 } +148 // Remove entry from the client map. +149 true +150 } +151 } else { +152 // The unregistering client is already inactive. Remove from the list of inactive clients. +153 state +154 .inactive +155 .retain(|client| client.connection_id() != connection_id); +156 // Active client is unmodified: keep entry in map. +157 false +158 } +159 }); +160 } +161 +162 /// Attempt to send a packet to client with [`EndpointId`] `dst`. +163 pub(super) fn send_packet( +164 &self, +165 dst: EndpointId, +166 data: Datagrams, +167 src: EndpointId, +168 metrics: &Metrics, +169 ) -> Result<(), ForwardPacketError> { +170 let Some(client) = self.0.clients.get(&dst) else { +171 debug!(dst = %dst.fmt_short(), "no connected client, dropped packet"); +172 metrics.send_packets_dropped.inc(); +173 return Ok(()); +174 }; +175 match client.active.try_send_packet(src, data) { +176 Ok(_) => { +177 // Record sent_to relationship +178 self.0.sent_to.entry(src).or_default().insert(dst); +179 Ok(()) +180 } +181 Err(TrySendError::Full(_)) => { +182 debug!( +183 dst = %dst.fmt_short(), +184 "client too busy to receive packet, dropping packet" +185 ); +186 Err(ForwardPacketError::new(SendError::Full)) +187 } +188 Err(TrySendError::Closed(_)) => { +189 debug!( +190 dst = %dst.fmt_short(), +191 "can no longer write to client, dropping message and pruning connection" +192 ); +193 client.active.start_shutdown(); +194 Err(ForwardPacketError::new(SendError::Closed)) +195 } +196 } +197 } +198 +199 #[cfg(test)] +200 fn active_connection_id(&self, endpoint_id: EndpointId) -> Option<u64> { +201 self.0 +202 .clients +203 .get(&endpoint_id) +204 .map(|s| s.active.connection_id()) +205 } +206} +207 +208#[cfg(test)] +209mod tests { +210 use std::time::Duration; +211 +212 use iroh_base::SecretKey; +213 use n0_error::{Result, StdResultExt}; +214 use n0_future::{Stream, StreamExt}; +215 use n0_tracing_test::traced_test; +216 use rand::SeedableRng; +217 +218 use super::*; +219 use crate::{ +220 client::conn::Conn, +221 protos::{common::FrameType, relay::RelayToClientMsg, streams::WsBytesFramed}, +222 server::streams::{MaybeTlsStream, RateLimited, ServerRelayedStream}, +223 }; +224 +225 async fn recv_frame< +226 E: std::error::Error + Sync + Send + 'static, +227 S: Stream<Item = Result<RelayToClientMsg, E>> + Unpin, +228 >( +229 frame_type: FrameType, +230 mut stream: S, +231 ) -> Result<RelayToClientMsg> { +232 match stream.next().await { +233 Some(Ok(frame)) => { +234 if frame_type != frame.typ() { +235 n0_error::bail_any!( +236 "Unexpected frame, got {:?}, but expected {:?}", +237 frame.typ(), +238 frame_type +239 ); +240 } +241 Ok(frame) +242 } +243 Some(Err(err)) => Err(err).anyerr(), +244 None => n0_error::bail_any!("Unexpected EOF, expected frame {frame_type:?}"), +245 } +246 } +247 +248 fn test_client_builder( +249 key: EndpointId, +250 ) -> (Config<WsBytesFramed<RateLimited<MaybeTlsStream>>>, Conn) { +251 let (server, client) = tokio::io::duplex(1024); +252 ( +253 Config { +254 endpoint_id: key, +255 stream: ServerRelayedStream::test(server), +256 write_timeout: Duration::from_secs(1), +257 channel_capacity: 10, +258 }, +259 Conn::test(client), +260 ) +261 } +262 +263 #[tokio::test] +264 #[traced_test] +265 async fn test_clients() -> Result { +266 let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(0u64); +267 let a_key = SecretKey::generate(&mut rng).public(); +268 let b_key = SecretKey::generate(&mut rng).public(); +269 +270 let (builder_a, mut a_rw) = test_client_builder(a_key); +271 +272 let clients = Clients::default(); +273 let metrics = Arc::new(Metrics::default()); +274 clients.register(builder_a, metrics.clone()); +275 +276 // send packet +277 let data = b"hello world!"; +278 clients.send_packet(a_key, Datagrams::from(&data[..]), b_key, &metrics)?; +279 let frame = recv_frame(FrameType::RelayToClientDatagram, &mut a_rw).await?; +280 assert_eq!( +281 frame, +282 RelayToClientMsg::Datagrams { +283 remote_endpoint_id: b_key, +284 datagrams: data.to_vec().into(), +285 } +286 ); +287 +288 { +289 let client = clients.0.clients.get(&a_key).unwrap(); +290 // shutdown client a, this should trigger the removal from the clients list +291 client.active.start_shutdown(); +292 } +293 +294 // need to wait a moment for the removal to be processed +295 let c = clients.clone(); +296 tokio::time::timeout(Duration::from_secs(1), async move { +297 loop { +298 if !c.0.clients.contains_key(&a_key) { +299 break; +300 } +301 tokio::time::sleep(Duration::from_millis(100)).await; +302 } +303 }) +304 .await +305 .std_context("timeout")?; +306 clients.shutdown().await; +307 +308 Ok(()) +309 } +310 +311 #[tokio::test] +312 #[traced_test] +313 async fn test_clients_same_endpoint_id() -> Result { +314 let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(0u64); +315 let a_key = SecretKey::generate(&mut rng).public(); +316 let b_key = SecretKey::generate(&mut rng).public(); +317 +318 let (a1_builder, mut a1_rw) = test_client_builder(a_key); +319 +320 let clients = Clients::default(); +321 let metrics = Arc::new(Metrics::default()); 322 -323 let (a1_builder, mut a1_rw) = test_client_builder(a_key); -324 -325 let clients = Clients::default(); -326 let metrics = Arc::new(Metrics::default()); -327 -328 // register client a -329 clients.register(a1_builder, metrics.clone()); -330 let a1_conn_id = clients.active_connection_id(a_key).unwrap(); -331 -332 // send packet and verify it is send to a1 -333 let data = b"hello world!"; -334 clients.send_packet(a_key, Datagrams::from(&data[..]), b_key, &metrics)?; -335 let frame = recv_frame(FrameType::RelayToClientDatagram, &mut a1_rw).await?; -336 assert_eq!( -337 frame, -338 RelayToClientMsg::Datagrams { -339 remote_endpoint_id: b_key, -340 datagrams: data.to_vec().into(), -341 } -342 ); -343 -344 // register new client with same endpoint id -345 let (a2_builder, mut a2_rw) = test_client_builder(a_key); -346 clients.register(a2_builder, metrics.clone()); -347 let a2_conn_id = clients.active_connection_id(a_key).unwrap(); -348 assert!(a2_conn_id != a1_conn_id); -349 -350 // a1 is marked inactive and should receive a health frame -351 let _frame = recv_frame(FrameType::Health, &mut a1_rw).await?; -352 -353 // send packet and verify it is send to a2 -354 clients.send_packet(a_key, Datagrams::from(&data[..]), b_key, &metrics)?; -355 let frame = recv_frame(FrameType::RelayToClientDatagram, &mut a2_rw).await?; -356 assert_eq!( -357 frame, -358 RelayToClientMsg::Datagrams { -359 remote_endpoint_id: b_key, -360 datagrams: data.to_vec().into(), -361 } -362 ); -363 -364 // disconnect a2 -365 clients -366 .0 -367 .clients -368 .get(&a_key) -369 .unwrap() -370 .active -371 .start_shutdown(); -372 -373 // need to wait a moment for the removal to be processed -374 tokio::time::timeout(Duration::from_secs(1), { -375 let clients = clients.clone(); -376 async move { -377 // wait until the active connection is no longer a2 (which we unregistered) -378 while clients.active_connection_id(a_key) == Some(a2_conn_id) { -379 tokio::time::sleep(Duration::from_millis(100)).await; -380 } -381 } -382 }) -383 .await -384 .std_context("timeout")?; -385 -386 // a1 should be marked active again now, and receive sent messages -387 assert_eq!(clients.active_connection_id(a_key), Some(a1_conn_id)); -388 clients.send_packet(a_key, Datagrams::from(&data[..]), b_key, &metrics)?; -389 let frame = recv_frame(FrameType::RelayToClientDatagram, &mut a1_rw).await?; -390 assert_eq!( -391 frame, -392 RelayToClientMsg::Datagrams { -393 remote_endpoint_id: b_key, -394 datagrams: data.to_vec().into(), -395 } -396 ); -397 -398 // after shutting down the now-active client, there should no longer be an entry for that endpoint id -399 clients -400 .0 -401 .clients -402 .get(&a_key) -403 .unwrap() -404 .active -405 .start_shutdown(); -406 -407 // need to wait a moment for the removal to be processed -408 tokio::time::timeout(Duration::from_secs(1), { -409 let clients = clients.clone(); -410 async move { -411 // wait until the active connection is no longer a2 (which we unregistered) -412 while clients.0.clients.contains_key(&a_key) { -413 tokio::time::sleep(Duration::from_millis(100)).await; -414 } -415 } -416 }) -417 .await -418 .std_context("timeout")?; -419 -420 clients.shutdown().await; -421 -422 Ok(()) -423 } -424}

\ No newline at end of file +323 // register client a +324 clients.register(a1_builder, metrics.clone()); +325 let a1_conn_id = clients.active_connection_id(a_key).unwrap(); +326 +327 // send packet and verify it is send to a1 +328 let data = b"hello world!"; +329 clients.send_packet(a_key, Datagrams::from(&data[..]), b_key, &metrics)?; +330 let frame = recv_frame(FrameType::RelayToClientDatagram, &mut a1_rw).await?; +331 assert_eq!( +332 frame, +333 RelayToClientMsg::Datagrams { +334 remote_endpoint_id: b_key, +335 datagrams: data.to_vec().into(), +336 } +337 ); +338 +339 // register new client with same endpoint id +340 let (a2_builder, mut a2_rw) = test_client_builder(a_key); +341 clients.register(a2_builder, metrics.clone()); +342 let a2_conn_id = clients.active_connection_id(a_key).unwrap(); +343 assert!(a2_conn_id != a1_conn_id); +344 +345 // a1 is marked inactive and should receive a health frame +346 let _frame = recv_frame(FrameType::Health, &mut a1_rw).await?; +347 +348 // send packet and verify it is send to a2 +349 clients.send_packet(a_key, Datagrams::from(&data[..]), b_key, &metrics)?; +350 let frame = recv_frame(FrameType::RelayToClientDatagram, &mut a2_rw).await?; +351 assert_eq!( +352 frame, +353 RelayToClientMsg::Datagrams { +354 remote_endpoint_id: b_key, +355 datagrams: data.to_vec().into(), +356 } +357 ); +358 +359 // disconnect a2 +360 clients +361 .0 +362 .clients +363 .get(&a_key) +364 .unwrap() +365 .active +366 .start_shutdown(); +367 +368 // need to wait a moment for the removal to be processed +369 tokio::time::timeout(Duration::from_secs(1), { +370 let clients = clients.clone(); +371 async move { +372 // wait until the active connection is no longer a2 (which we unregistered) +373 while clients.active_connection_id(a_key) == Some(a2_conn_id) { +374 tokio::time::sleep(Duration::from_millis(100)).await; +375 } +376 } +377 }) +378 .await +379 .std_context("timeout")?; +380 +381 // a1 should be marked active again now, and receive sent messages +382 assert_eq!(clients.active_connection_id(a_key), Some(a1_conn_id)); +383 clients.send_packet(a_key, Datagrams::from(&data[..]), b_key, &metrics)?; +384 let frame = recv_frame(FrameType::RelayToClientDatagram, &mut a1_rw).await?; +385 assert_eq!( +386 frame, +387 RelayToClientMsg::Datagrams { +388 remote_endpoint_id: b_key, +389 datagrams: data.to_vec().into(), +390 } +391 ); +392 +393 // after shutting down the now-active client, there should no longer be an entry for that endpoint id +394 clients +395 .0 +396 .clients +397 .get(&a_key) +398 .unwrap() +399 .active +400 .start_shutdown(); +401 +402 // need to wait a moment for the removal to be processed +403 tokio::time::timeout(Duration::from_secs(1), { +404 let clients = clients.clone(); +405 async move { +406 // wait until the active connection is no longer a2 (which we unregistered) +407 while clients.0.clients.contains_key(&a_key) { +408 tokio::time::sleep(Duration::from_millis(100)).await; +409 } +410 } +411 }) +412 .await +413 .std_context("timeout")?; +414 +415 clients.shutdown().await; +416 +417 Ok(()) +418 } +419} \ No newline at end of file