Struct reth_discv4::Discv4Config

source ·
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 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

source

pub fn builder() -> Discv4ConfigBuilder

Returns a new default builder instance

source

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

source

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

source

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

source

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

source§

fn clone(&self) -> Discv4Config

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Discv4Config

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Discv4Config

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for Discv4Config

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for Discv4Config

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit #126799)
Performs copy-assignment from self to dst. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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