mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-30 03:01:58 -04:00
support IPv6 for NetworkArgs.addr and DiscoveryArgs.addr (#7210)
This commit is contained in:
@@ -38,11 +38,7 @@ use reth_stages::{
|
||||
};
|
||||
use reth_static_file::StaticFileProducer;
|
||||
use reth_tasks::TaskExecutor;
|
||||
use std::{
|
||||
net::{SocketAddr, SocketAddrV4},
|
||||
path::PathBuf,
|
||||
sync::Arc,
|
||||
};
|
||||
use std::{net::SocketAddr, path::PathBuf, sync::Arc};
|
||||
use tokio::sync::watch;
|
||||
use tracing::*;
|
||||
|
||||
@@ -166,11 +162,11 @@ impl Command {
|
||||
.network
|
||||
.network_config(config, self.chain.clone(), secret_key, default_peers_path)
|
||||
.with_task_executor(Box::new(task_executor))
|
||||
.listener_addr(SocketAddr::V4(SocketAddrV4::new(self.network.addr, self.network.port)))
|
||||
.discovery_addr(SocketAddr::V4(SocketAddrV4::new(
|
||||
.listener_addr(SocketAddr::new(self.network.addr, self.network.port))
|
||||
.discovery_addr(SocketAddr::new(
|
||||
self.network.discovery.addr,
|
||||
self.network.discovery.port,
|
||||
)))
|
||||
))
|
||||
.build(ProviderFactory::new(
|
||||
db,
|
||||
self.chain.clone(),
|
||||
|
||||
@@ -25,11 +25,7 @@ use reth_provider::{
|
||||
};
|
||||
use reth_tasks::TaskExecutor;
|
||||
use reth_trie::{updates::TrieKey, StateRoot};
|
||||
use std::{
|
||||
net::{SocketAddr, SocketAddrV4},
|
||||
path::PathBuf,
|
||||
sync::Arc,
|
||||
};
|
||||
use std::{net::SocketAddr, path::PathBuf, sync::Arc};
|
||||
use tracing::*;
|
||||
|
||||
/// `reth debug in-memory-merkle` command
|
||||
@@ -89,11 +85,11 @@ impl Command {
|
||||
.network
|
||||
.network_config(config, self.chain.clone(), secret_key, default_peers_path)
|
||||
.with_task_executor(Box::new(task_executor))
|
||||
.listener_addr(SocketAddr::V4(SocketAddrV4::new(self.network.addr, self.network.port)))
|
||||
.discovery_addr(SocketAddr::V4(SocketAddrV4::new(
|
||||
.listener_addr(SocketAddr::new(self.network.addr, self.network.port))
|
||||
.discovery_addr(SocketAddr::new(
|
||||
self.network.discovery.addr,
|
||||
self.network.discovery.port,
|
||||
)))
|
||||
))
|
||||
.build(ProviderFactory::new(
|
||||
db,
|
||||
self.chain.clone(),
|
||||
|
||||
@@ -33,11 +33,7 @@ use reth_stages::{
|
||||
ExecInput, Stage,
|
||||
};
|
||||
use reth_tasks::TaskExecutor;
|
||||
use std::{
|
||||
net::{SocketAddr, SocketAddrV4},
|
||||
path::PathBuf,
|
||||
sync::Arc,
|
||||
};
|
||||
use std::{net::SocketAddr, path::PathBuf, sync::Arc};
|
||||
use tracing::{debug, info, warn};
|
||||
|
||||
/// `reth merkle-debug` command
|
||||
@@ -98,11 +94,11 @@ impl Command {
|
||||
.network
|
||||
.network_config(config, self.chain.clone(), secret_key, default_peers_path)
|
||||
.with_task_executor(Box::new(task_executor))
|
||||
.listener_addr(SocketAddr::V4(SocketAddrV4::new(self.network.addr, self.network.port)))
|
||||
.discovery_addr(SocketAddr::V4(SocketAddrV4::new(
|
||||
.listener_addr(SocketAddr::new(self.network.addr, self.network.port))
|
||||
.discovery_addr(SocketAddr::new(
|
||||
self.network.discovery.addr,
|
||||
self.network.discovery.port,
|
||||
)))
|
||||
))
|
||||
.build(ProviderFactory::new(
|
||||
db,
|
||||
self.chain.clone(),
|
||||
|
||||
@@ -32,12 +32,7 @@ use reth_stages::Pipeline;
|
||||
use reth_static_file::StaticFileProducer;
|
||||
use reth_tasks::TaskExecutor;
|
||||
use reth_transaction_pool::noop::NoopTransactionPool;
|
||||
use std::{
|
||||
net::{SocketAddr, SocketAddrV4},
|
||||
path::PathBuf,
|
||||
sync::Arc,
|
||||
time::Duration,
|
||||
};
|
||||
use std::{net::SocketAddr, path::PathBuf, sync::Arc, time::Duration};
|
||||
use tokio::sync::{mpsc, oneshot};
|
||||
use tracing::*;
|
||||
|
||||
@@ -97,11 +92,11 @@ impl Command {
|
||||
.network
|
||||
.network_config(config, self.chain.clone(), secret_key, default_peers_path)
|
||||
.with_task_executor(Box::new(task_executor))
|
||||
.listener_addr(SocketAddr::V4(SocketAddrV4::new(self.network.addr, self.network.port)))
|
||||
.discovery_addr(SocketAddr::V4(SocketAddrV4::new(
|
||||
.listener_addr(SocketAddr::new(self.network.addr, self.network.port))
|
||||
.discovery_addr(SocketAddr::new(
|
||||
self.network.discovery.addr,
|
||||
self.network.discovery.port,
|
||||
)))
|
||||
))
|
||||
.build(ProviderFactory::new(
|
||||
db,
|
||||
self.chain.clone(),
|
||||
|
||||
@@ -235,7 +235,7 @@ mod tests {
|
||||
fn parse_discovery_addr() {
|
||||
let cmd =
|
||||
NodeCommand::try_parse_args_from(["reth", "--discovery.addr", "127.0.0.1"]).unwrap();
|
||||
assert_eq!(cmd.network.discovery.addr, Ipv4Addr::LOCALHOST);
|
||||
assert_eq!(cmd.network.discovery.addr, IpAddr::V4(Ipv4Addr::LOCALHOST));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -248,8 +248,8 @@ mod tests {
|
||||
"127.0.0.1",
|
||||
])
|
||||
.unwrap();
|
||||
assert_eq!(cmd.network.discovery.addr, Ipv4Addr::LOCALHOST);
|
||||
assert_eq!(cmd.network.addr, Ipv4Addr::LOCALHOST);
|
||||
assert_eq!(cmd.network.discovery.addr, IpAddr::V4(Ipv4Addr::LOCALHOST));
|
||||
assert_eq!(cmd.network.addr, IpAddr::V4(Ipv4Addr::LOCALHOST));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user