mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-29 00:58:11 -05:00
feat: add Default for NetworkArgs and DiscoveryArgs (#5658)
This commit is contained in:
@@ -125,6 +125,26 @@ impl NetworkArgs {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for NetworkArgs {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
discovery: DiscoveryArgs::default(),
|
||||
trusted_peers: vec![],
|
||||
trusted_only: false,
|
||||
bootnodes: None,
|
||||
peers_file: None,
|
||||
identity: P2P_CLIENT_VERSION.to_string(),
|
||||
p2p_secret_key: None,
|
||||
no_persist_peers: false,
|
||||
nat: NatResolver::Any,
|
||||
addr: DEFAULT_DISCOVERY_ADDR,
|
||||
port: DEFAULT_DISCOVERY_PORT,
|
||||
max_outbound_peers: None,
|
||||
max_inbound_peers: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Arguments to setup discovery
|
||||
#[derive(Debug, Args)]
|
||||
pub struct DiscoveryArgs {
|
||||
@@ -166,6 +186,18 @@ impl DiscoveryArgs {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for DiscoveryArgs {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
disable_discovery: false,
|
||||
disable_dns_discovery: false,
|
||||
disable_discv4_discovery: false,
|
||||
addr: DEFAULT_DISCOVERY_ADDR,
|
||||
port: DEFAULT_DISCOVERY_PORT,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user