mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-29 17:18:08 -05:00
chore: add disable discovery options (#1182)
This commit is contained in:
@@ -238,12 +238,24 @@ impl NetworkConfigBuilder {
|
||||
self
|
||||
}
|
||||
|
||||
/// Disables Discv4 discovery.
|
||||
pub fn no_discv4_discovery(mut self) -> Self {
|
||||
self.discovery_v4_builder = None;
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets the dns discovery config to use.
|
||||
pub fn dns_discovery(mut self, config: DnsDiscoveryConfig) -> Self {
|
||||
self.dns_discovery_config = Some(config);
|
||||
self
|
||||
}
|
||||
|
||||
/// Disables DNS discovery
|
||||
pub fn no_dns_discovery(mut self) -> Self {
|
||||
self.dns_discovery_config = None;
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets the boot nodes.
|
||||
pub fn boot_nodes(mut self, nodes: impl IntoIterator<Item = NodeRecord>) -> Self {
|
||||
self.boot_nodes = nodes.into_iter().collect();
|
||||
@@ -258,9 +270,10 @@ impl NetworkConfigBuilder {
|
||||
self
|
||||
}
|
||||
|
||||
/// disables discovery.
|
||||
/// Disables all discovery services.
|
||||
pub fn disable_discovery(&mut self) {
|
||||
self.discovery_v4_builder = None;
|
||||
self.dns_discovery_config = None;
|
||||
}
|
||||
|
||||
/// Consumes the type and creates the actual [`NetworkConfig`]
|
||||
|
||||
@@ -308,6 +308,7 @@ where
|
||||
NetworkConfigBuilder::new(secret_key)
|
||||
.listener_addr(SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::UNSPECIFIED, 0)))
|
||||
.discovery_addr(SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::UNSPECIFIED, 0)))
|
||||
.no_dns_discovery()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user