Skip to content

Commit

Permalink
feat: resolve domains in enode strings (#8188)
Browse files Browse the repository at this point in the history
Co-authored-by: Serge Radinovich <[email protected]>
  • Loading branch information
Rjected and sergerad authored Jun 5, 2024
1 parent c5e3807 commit ef3f677
Show file tree
Hide file tree
Showing 22 changed files with 470 additions and 64 deletions.
72 changes: 38 additions & 34 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ dyn-clone = "1.0.17"
sha2 = { version = "0.10", default-features = false }
paste = "1.0"
url = "2.3"
backon = "0.4"

# metrics
metrics = "0.22.0"
Expand Down
3 changes: 2 additions & 1 deletion bin/reth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ reth-rpc-types-compat.workspace = true
reth-rpc-api = { workspace = true, features = ["client"] }
reth-network = { workspace = true, features = ["serde"] }
reth-network-p2p.workspace = true
reth-net-common.workspace = true
reth-network-api.workspace = true
reth-downloaders.workspace = true
reth-tracing.workspace = true
Expand Down Expand Up @@ -104,7 +105,7 @@ aquamarine.workspace = true
eyre.workspace = true
clap = { workspace = true, features = ["derive", "env"] }
tempfile.workspace = true
backon = "0.4"
backon.workspace = true
similar-asserts.workspace = true
itertools.workspace = true
rayon.workspace = true
Expand Down
4 changes: 2 additions & 2 deletions bin/reth/src/commands/p2p/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ impl Command {

let mut config: Config = confy::load_path(&config_path).unwrap_or_default();

for &peer in &self.network.trusted_peers {
config.peers.trusted_nodes.insert(peer);
for peer in &self.network.trusted_peers {
config.peers.trusted_nodes.insert(peer.resolve().await?);
}

if config.peers.trusted_nodes.is_empty() && self.network.trusted_only {
Expand Down
7 changes: 4 additions & 3 deletions bin/reth/src/commands/stage/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,10 @@ impl Command {
let mut config = config;
config.peers.trusted_nodes_only = self.network.trusted_only;
if !self.network.trusted_peers.is_empty() {
self.network.trusted_peers.iter().for_each(|peer| {
config.peers.trusted_nodes.insert(*peer);
});
for peer in &self.network.trusted_peers {
let peer = peer.resolve().await?;
config.peers.trusted_nodes.insert(peer);
}
}

let network_secret_path = self
Expand Down
5 changes: 5 additions & 0 deletions book/cli/reth/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ Networking:
Will fall back to a network-specific default if not specified.
--dns-retries <DNS_RETRIES>
Amount of DNS resolution requests retries to perform when peering
[default: 0]
--peers-file <FILE>
The path to the known peers file. Connected peers are dumped to this file on nodes
shutdown, and read on startup. Cannot be used with `--no-persist-peers`.
Expand Down
5 changes: 5 additions & 0 deletions book/cli/reth/p2p.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ Networking:
Will fall back to a network-specific default if not specified.
--dns-retries <DNS_RETRIES>
Amount of DNS resolution requests retries to perform when peering
[default: 0]
--peers-file <FILE>
The path to the known peers file. Connected peers are dumped to this file on nodes
shutdown, and read on startup. Cannot be used with `--no-persist-peers`.
Expand Down
5 changes: 5 additions & 0 deletions book/cli/reth/stage/run.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ Networking:

Will fall back to a network-specific default if not specified.

--dns-retries <DNS_RETRIES>
Amount of DNS resolution requests retries to perform when peering

[default: 0]

--peers-file <FILE>
The path to the known peers file. Connected peers are dumped to this file on nodes
shutdown, and read on startup. Cannot be used with `--no-persist-peers`.
Expand Down
5 changes: 5 additions & 0 deletions book/cli/reth/stage/unwind.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ Networking:
Will fall back to a network-specific default if not specified.
--dns-retries <DNS_RETRIES>
Amount of DNS resolution requests retries to perform when peering
[default: 0]
--peers-file <FILE>
The path to the known peers file. Connected peers are dumped to this file on nodes
shutdown, and read on startup. Cannot be used with `--no-persist-peers`.
Expand Down
1 change: 1 addition & 0 deletions crates/net/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

pub mod ban_list;
pub mod bandwidth_meter;

/// Traits related to tokio streams
pub mod stream;

Expand Down
Loading

0 comments on commit ef3f677

Please sign in to comment.