pub struct Discv4Config {Show 21 fields
pub enable_packet_filter: bool,
pub udp_egress_message_buffer: usize,
pub udp_ingress_message_buffer: usize,
pub max_find_node_failures: u8,
pub ping_interval: Duration,
pub ping_expiration: Duration,
pub lookup_interval: Duration,
pub request_timeout: Duration,
pub enr_expiration: Duration,
pub neighbours_expiration: Duration,
pub ban_list: BanList,
pub ban_duration: Option<Duration>,
pub bootstrap_nodes: HashSet<NodeRecord>,
pub enable_dht_random_walk: bool,
pub enable_lookup: bool,
pub enable_eip868: bool,
pub enforce_expiration_timestamps: bool,
pub additional_eip868_rlp_pairs: HashMap<Vec<u8>, Bytes>,
pub external_ip_resolver: Option<NatResolver>,
pub resolve_external_ip_interval: Option<Duration>,
pub bond_expiration: Duration,
}
Expand description
Configuration parameters that define the performance of the discovery network.
Fields§
§enable_packet_filter: bool
Whether to enable the incoming packet filter. Default: false.
udp_egress_message_buffer: usize
Size of the channel buffer for outgoing messages.
udp_ingress_message_buffer: usize
Size of the channel buffer for incoming messages.
max_find_node_failures: u8
The number of allowed consecutive failures for FindNode
requests. Default: 5.
ping_interval: Duration
The interval to use when checking for expired nodes that need to be re-pinged. Default: 10min.
ping_expiration: Duration
The duration of we consider a ping timed out.
lookup_interval: Duration
The rate at which new random lookups should be triggered.
request_timeout: Duration
The duration of we consider a FindNode
request timed out.
enr_expiration: Duration
The duration after which we consider an enr request timed out.
neighbours_expiration: Duration
The duration we set for neighbours responses.
ban_list: BanList
Provides a way to ban peers and ips.
ban_duration: Option<Duration>
Set the default duration for which nodes are banned for. This timeouts are checked every 5
minutes, so the precision will be to the nearest 5 minutes. If set to None
, bans from
the filter will last indefinitely. Default is 1 hour.
bootstrap_nodes: HashSet<NodeRecord>
Nodes to boot from.
enable_dht_random_walk: bool
Whether to randomly discover new peers.
If true, the node will automatically randomly walk the DHT in order to find new peers.
enable_lookup: bool
Whether to automatically lookup peers.
enable_eip868: bool
Whether to enforce EIP-868 extension.
enforce_expiration_timestamps: bool
Whether to respect expiration timestamps in messages.
additional_eip868_rlp_pairs: HashMap<Vec<u8>, Bytes>
Additional pairs to include in The Enr
if EIP-868 extension is enabled https://eips.ethereum.org/EIPS/eip-868
external_ip_resolver: Option<NatResolver>
If configured, try to resolve public ip
resolve_external_ip_interval: Option<Duration>
If configured and a external_ip_resolver
is configured, try to resolve the external ip
using this interval.
bond_expiration: Duration
The duration after which we consider a bond expired.
Implementations§
Source§impl Discv4Config
impl Discv4Config
Sourcepub fn builder() -> Discv4ConfigBuilder
pub fn builder() -> Discv4ConfigBuilder
Returns a new default builder instance
Sourcepub fn add_eip868_pair(
&mut self,
key: impl Into<Vec<u8>>,
value: impl Encodable,
) -> &mut Self
pub fn add_eip868_pair( &mut self, key: impl Into<Vec<u8>>, value: impl Encodable, ) -> &mut Self
Add another key value pair to include in the ENR
Sourcepub fn add_eip868_rlp_pair(
&mut self,
key: impl Into<Vec<u8>>,
rlp: Bytes,
) -> &mut Self
pub fn add_eip868_rlp_pair( &mut self, key: impl Into<Vec<u8>>, rlp: Bytes, ) -> &mut Self
Add another key value pair to include in the ENR
Sourcepub fn extend_eip868_rlp_pairs(
&mut self,
pairs: impl IntoIterator<Item = (impl Into<Vec<u8>>, Bytes)>,
) -> &mut Self
pub fn extend_eip868_rlp_pairs( &mut self, pairs: impl IntoIterator<Item = (impl Into<Vec<u8>>, Bytes)>, ) -> &mut Self
Extend additional key value pairs to include in the ENR
Sourcepub fn resolve_external_ip_interval(&self) -> Option<ResolveNatInterval>
pub fn resolve_external_ip_interval(&self) -> Option<ResolveNatInterval>
Returns the corresponding [ResolveNatInterval
], if a NatResolver
and an interval was
configured
Trait Implementations§
Source§impl Clone for Discv4Config
impl Clone for Discv4Config
Source§fn clone(&self) -> Discv4Config
fn clone(&self) -> Discv4Config
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for Discv4Config
impl Debug for Discv4Config
Source§impl Default for Discv4Config
impl Default for Discv4Config
Source§impl<'de> Deserialize<'de> for Discv4Config
impl<'de> Deserialize<'de> for Discv4Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Discv4Config
impl RefUnwindSafe for Discv4Config
impl Send for Discv4Config
impl Sync for Discv4Config
impl Unpin for Discv4Config
impl UnwindSafe for Discv4Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> MaybeSendSync for T
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 376 bytes