diff --git a/crates/net/network/Cargo.toml b/crates/net/network/Cargo.toml index efadac80cf14..61b887f042d5 100644 --- a/crates/net/network/Cargo.toml +++ b/crates/net/network/Cargo.toml @@ -30,7 +30,7 @@ reth-storage-api.workspace = true reth-provider = { workspace = true, optional = true } reth-tokio-util.workspace = true reth-consensus.workspace = true -reth-network-peers.workspace = true +reth-network-peers = { workspace = true, features = ["net"] } reth-network-types.workspace = true # ethereum diff --git a/crates/net/peers/Cargo.toml b/crates/net/peers/Cargo.toml index 6b107432632e..5ac24edea759 100644 --- a/crates/net/peers/Cargo.toml +++ b/crates/net/peers/Cargo.toml @@ -25,13 +25,15 @@ secp256k1 = { workspace = true, optional = true } serde_with.workspace = true thiserror.workspace = true url.workspace = true -tokio = { workspace = true, features = ["full"] } +tokio = { workspace = true, optional = true } [dev-dependencies] alloy-primitives = { workspace = true, features = ["rand"] } rand.workspace = true secp256k1 = { workspace = true, features = ["rand"] } serde_json.workspace = true +tokio = { workspace = true, features = ["net", "macros", "rt"] } [features] secp256k1 = ["dep:secp256k1", "enr/secp256k1"] +net = ["dep:tokio", "tokio?/net"] diff --git a/crates/net/peers/src/lib.rs b/crates/net/peers/src/lib.rs index b58f499abf3a..e80331f90468 100644 --- a/crates/net/peers/src/lib.rs +++ b/crates/net/peers/src/lib.rs @@ -39,6 +39,11 @@ //! - [`TrustedPeer`]: A [`NodeRecord`] with an optional domain name, which can be resolved to a //! [`NodeRecord`]. Useful for adding trusted peers at startup, whose IP address may not be //! static. +//! +//! +//! ## Feature Flags +//! +//! - `net`: Support for address lookups. #![doc( html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", diff --git a/crates/net/peers/src/trusted_peer.rs b/crates/net/peers/src/trusted_peer.rs index b52c98232f5c..aa7e0a015336 100644 --- a/crates/net/peers/src/trusted_peer.rs +++ b/crates/net/peers/src/trusted_peer.rs @@ -76,6 +76,7 @@ impl TrustedPeer { } /// Resolves the host in a [`TrustedPeer`] to an IP address, returning a [`NodeRecord`]. + #[cfg(any(test, feature = "net"))] pub async fn resolve(&self) -> Result { let domain = match self.try_node_record() { Ok(record) => return Ok(record),