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.