From a48b8007f4d7325e1689d3ff9a19d6127faba390 Mon Sep 17 00:00:00 2001 From: Roland Sherwin Date: Fri, 19 Jul 2024 19:42:52 +0530 Subject: [PATCH] chore: remove dcutr --- Cargo.lock | 40 +++----------------------------- sn_networking/Cargo.toml | 1 - sn_networking/src/driver.rs | 2 -- sn_networking/src/event/mod.rs | 6 ----- sn_networking/src/event/swarm.rs | 12 ---------- sn_networking/src/metrics/mod.rs | 6 ----- 6 files changed, 3 insertions(+), 64 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a116a5fb90..cea5629e5a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3736,7 +3736,6 @@ dependencies = [ "libp2p-autonat", "libp2p-connection-limits", "libp2p-core", - "libp2p-dcutr", "libp2p-dns", "libp2p-gossipsub", "libp2p-identify", @@ -3833,29 +3832,6 @@ dependencies = [ "void", ] -[[package]] -name = "libp2p-dcutr" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4f7bb7fa2b9e6cad9c30a6f67e3ff5c1e4b658c62b6375e35861a85f9c97bf3" -dependencies = [ - "asynchronous-codec 0.6.2", - "either", - "futures", - "futures-bounded", - "futures-timer", - "instant", - "libp2p-core", - "libp2p-identity", - "libp2p-swarm", - "lru 0.11.1", - "quick-protobuf", - "quick-protobuf-codec 0.2.0", - "thiserror", - "tracing", - "void", -] - [[package]] name = "libp2p-dns" version = "0.41.1" @@ -3917,7 +3893,7 @@ dependencies = [ "libp2p-core", "libp2p-identity", "libp2p-swarm", - "lru 0.12.3", + "lru", "quick-protobuf", "quick-protobuf-codec 0.3.1", "smallvec", @@ -4003,7 +3979,6 @@ dependencies = [ "futures", "instant", "libp2p-core", - "libp2p-dcutr", "libp2p-identify", "libp2p-identity", "libp2p-kad", @@ -4125,7 +4100,7 @@ dependencies = [ "libp2p-core", "libp2p-identity", "libp2p-swarm-derive", - "lru 0.12.3", + "lru", "multistream-select", "once_cell", "rand 0.8.5", @@ -4297,15 +4272,6 @@ version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" -[[package]] -name = "lru" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a83fb7698b3643a0e34f9ae6f2e8f0178c0fd42f8b59d493aa271ff3a5bf21" -dependencies = [ - "hashbrown 0.14.5", -] - [[package]] name = "lru" version = "0.12.3" @@ -5998,7 +5964,7 @@ dependencies = [ "compact_str", "crossterm", "itertools 0.12.1", - "lru 0.12.3", + "lru", "paste", "serde", "stability", diff --git a/sn_networking/Cargo.toml b/sn_networking/Cargo.toml index 1004fbc36d..ee5a975d00 100644 --- a/sn_networking/Cargo.toml +++ b/sn_networking/Cargo.toml @@ -30,7 +30,6 @@ libp2p = { version = "0.53", features = [ "request-response", "cbor", "identify", - "dcutr", "tcp", "relay", "noise", diff --git a/sn_networking/src/driver.rs b/sn_networking/src/driver.rs index 02b414dc99..a5c290d9f2 100644 --- a/sn_networking/src/driver.rs +++ b/sn_networking/src/driver.rs @@ -206,7 +206,6 @@ pub(super) struct NodeBehaviour { pub(super) upnp: libp2p::swarm::behaviour::toggle::Toggle, pub(super) relay_client: libp2p::relay::client::Behaviour, pub(super) relay_server: libp2p::relay::Behaviour, - pub(super) dcutr: libp2p::dcutr::Behaviour, pub(super) kademlia: kad::Behaviour, pub(super) request_response: request_response::cbor::Behaviour, } @@ -583,7 +582,6 @@ impl NetworkBuilder { identify, #[cfg(feature = "local-discovery")] mdns, - dcutr: libp2p::dcutr::Behaviour::new(peer_id), }; #[cfg(not(target_arch = "wasm32"))] diff --git a/sn_networking/src/event/mod.rs b/sn_networking/src/event/mod.rs index 4457f2f071..85e0d65400 100644 --- a/sn_networking/src/event/mod.rs +++ b/sn_networking/src/event/mod.rs @@ -42,7 +42,6 @@ pub(super) enum NodeEvent { #[cfg(feature = "local-discovery")] Mdns(Box), Identify(Box), - Dcutr(Box), RelayClient(Box), RelayServer(Box), Void(void::Void), @@ -79,11 +78,6 @@ impl From for NodeEvent { NodeEvent::Identify(Box::new(event)) } } -impl From for NodeEvent { - fn from(event: libp2p::dcutr::Event) -> Self { - NodeEvent::Dcutr(Box::new(event)) - } -} impl From for NodeEvent { fn from(event: libp2p::relay::client::Event) -> Self { NodeEvent::RelayClient(Box::new(event)) diff --git a/sn_networking/src/event/swarm.rs b/sn_networking/src/event/swarm.rs index 04d23ead05..00f8f2cba9 100644 --- a/sn_networking/src/event/swarm.rs +++ b/sn_networking/src/event/swarm.rs @@ -59,18 +59,6 @@ impl SwarmDriver { event_string = "kad_event"; self.handle_kad_event(kad_event)?; } - SwarmEvent::Behaviour(NodeEvent::Dcutr(event)) => { - #[cfg(feature = "open-metrics")] - if let Some(metrics) = &self.network_metrics { - metrics.record(&(*event)); - } - - event_string = "dcutr_event"; - info!( - "Dcutr with remote peer: {:?} is: {:?}", - event.remote_peer_id, event.result - ); - } SwarmEvent::Behaviour(NodeEvent::RelayClient(event)) => { event_string = "relay_client_event"; diff --git a/sn_networking/src/metrics/mod.rs b/sn_networking/src/metrics/mod.rs index cdb351407e..ba8cdebad0 100644 --- a/sn_networking/src/metrics/mod.rs +++ b/sn_networking/src/metrics/mod.rs @@ -165,12 +165,6 @@ impl Recorder for NetworkMetrics { } } -impl Recorder for NetworkMetrics { - fn record(&self, event: &libp2p::dcutr::Event) { - self.libp2p_metrics.record(event) - } -} - impl Recorder for NetworkMetrics { fn record(&self, event: &libp2p::relay::Event) { self.libp2p_metrics.record(event)