Struct discv5::Config

source ·
pub struct Config {
Show 24 fields pub enable_packet_filter: bool, pub request_timeout: Duration, pub vote_duration: Duration, pub query_peer_timeout: Duration, pub query_timeout: Duration, pub request_retries: u8, pub session_timeout: Duration, pub session_cache_capacity: usize, pub enr_update: bool, pub max_nodes_response: usize, pub enr_peer_update_min: usize, pub query_parallelism: usize, pub ip_limit: bool, pub incoming_bucket_limit: usize, pub table_filter: fn(_: &Enr) -> bool, pub ping_interval: Duration, pub report_discovered_peers: bool, pub filter_rate_limiter: Option<RateLimiter>, pub filter_max_nodes_per_ip: Option<usize>, pub filter_max_bans_per_ip: Option<usize>, pub permit_ban_list: PermitBanList, pub ban_duration: Option<Duration>, pub executor: Option<Box<dyn Executor + Send + Sync>>, pub listen_config: ListenConfig,
}
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.

§request_timeout: Duration

The request timeout for each UDP request. Default: 1 seconds.

§vote_duration: Duration

The interval over which votes are remembered when determining our external IP. A lower interval will respond faster to IP changes. Default is 30 seconds.

§query_peer_timeout: Duration

The timeout after which a QueryPeer in an ongoing query is marked unresponsive. Unresponsive peers don’t count towards the parallelism limits for a query. Hence, we may potentially end up making more requests to good peers. Default: 2 seconds.

§query_timeout: Duration

The timeout for an entire query. Any peers discovered for this query are returned. Default 60 seconds.

§request_retries: u8

The number of retries for each UDP request. Default: 1.

§session_timeout: Duration

The session timeout for each node. Default: 1 day.

§session_cache_capacity: usize

The maximum number of established sessions to maintain. Default: 1000.

§enr_update: bool

Updates the local ENR IP and port based on PONG responses from peers. Default: true.

§max_nodes_response: usize

The maximum number of nodes we return to a find nodes request. The default is 16.

§enr_peer_update_min: usize

The minimum number of peer’s who agree on an external IP port before updating the local ENR. Default: 10.

§query_parallelism: usize

The number of peers to request in parallel in a single query. Default: 3.

§ip_limit: bool

Limits the number of IP addresses from the same /24 subnet in the kbuckets table. This is to mitigate eclipse attacks. Default: false.

§incoming_bucket_limit: usize

Sets a maximum limit to the number of incoming nodes (nodes that have dialed us) to exist per-bucket. This cannot be larger than the bucket size (16). By default this is disabled (set to the maximum bucket size, 16).

§table_filter: fn(_: &Enr) -> bool

A filter used to decide whether to insert nodes into our local routing table. Nodes can be excluded if they do not pass this filter. The default is to accept all nodes.

§ping_interval: Duration

The time between pings to ensure connectivity amongst connected nodes. Default: 300 seconds.

§report_discovered_peers: bool

Reports all discovered ENR’s when traversing the DHT to the event stream. Default true.

§filter_rate_limiter: Option<RateLimiter>

A set of configuration parameters for setting inbound request rate limits. See RateLimiterBuilder for options. This is only functional if the packet filter is enabled via the enable_packet_filter option. See the Default implementation for default values. If set to None, inbound requests are not filtered.

§filter_max_nodes_per_ip: Option<usize>

The maximum number of node-ids allowed per IP address before the IP address gets banned. Having this set to None, disables this feature. Default value is 10. This is only applicable if the enable_packet_filter option is set.

§filter_max_bans_per_ip: Option<usize>

The maximum number of nodes that can be banned by a single IP before that IP gets banned. The default is 5. This is only applicable if the enable_packet_filter option is set.

§permit_ban_list: PermitBanList

A set of lists that permit or ban IP’s or NodeIds from the server. See crate::PermitBanList.

§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.

§executor: Option<Box<dyn Executor + Send + Sync>>

A custom executor which can spawn the discv5 tasks. This must be a tokio runtime, with timing support. By default, the executor that created the discv5 struct will be used.

§listen_config: ListenConfig

Configuration for the sockets to listen on.

Trait Implementations§

source§

impl Clone for Config

source§

fn clone(&self) -> Config

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 Config

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Config

§

impl !RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl !UnwindSafe for Config

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

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

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

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

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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>,

§

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.
source§

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

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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