mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: feature gate tokio::net lookup (#9289)
This commit is contained in:
@ -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
|
||||
|
||||
@ -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"]
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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<NodeRecord, Error> {
|
||||
let domain = match self.try_node_record() {
|
||||
Ok(record) => return Ok(record),
|
||||
|
||||
Reference in New Issue
Block a user