Struct discv5::ConfigBuilder

source ·
pub struct ConfigBuilder { /* private fields */ }

Implementations§

source§

impl ConfigBuilder

source

pub fn new(listen_config: ListenConfig) -> Self

source

pub fn enable_packet_filter(&mut self) -> &mut Self

Whether to enable the incoming packet filter.

source

pub fn request_timeout(&mut self, timeout: Duration) -> &mut Self

The request timeout for each UDP request.

source

pub fn vote_duration(&mut self, vote_duration: Duration) -> &mut Self

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.

source

pub fn query_peer_timeout(&mut self, timeout: Duration) -> &mut Self

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.

source

pub fn query_timeout(&mut self, timeout: Duration) -> &mut Self

The timeout for an entire query. Any peers discovered before this timeout are returned.

source

pub fn request_retries(&mut self, retries: u8) -> &mut Self

The number of retries for each UDP request.

source

pub fn session_timeout(&mut self, timeout: Duration) -> &mut Self

The session timeout for each node.

source

pub fn session_cache_capacity(&mut self, capacity: usize) -> &mut Self

The maximum number of established sessions to maintain.

source

pub fn disable_enr_update(&mut self) -> &mut Self

Disables the auto-update of the local ENR IP and port based on PONG responses from peers.

source

pub fn max_nodes_response(&mut self, max: usize) -> &mut Self

The maximum number of nodes we response to a find nodes request.

source

pub fn enr_peer_update_min(&mut self, min: usize) -> &mut Self

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

source

pub fn query_parallelism(&mut self, parallelism: usize) -> &mut Self

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

source

pub fn ip_limit(&mut self) -> &mut Self

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

source

pub fn incoming_bucket_limit(&mut self, limit: usize) -> &mut Self

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, half of every bucket (8 positions) is the largest number of nodes that we accept that dial us.

source

pub fn table_filter(&mut self, filter: fn(_: &Enr) -> bool) -> &mut Self

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.

source

pub fn ping_interval(&mut self, interval: Duration) -> &mut Self

The time between pings to ensure connectivity amongst connected nodes.

source

pub fn disable_report_discovered_peers(&mut self) -> &mut Self

Disables reporting of discovered peers through the event stream.

source

pub fn filter_rate_limiter( &mut self, rate_limiter: Option<RateLimiter> ) -> &mut Self

A rate limiter for limiting inbound requests.

source

pub fn filter_max_nodes_per_ip( &mut self, max_nodes_per_ip: Option<usize> ) -> &mut Self

If the filter is enabled, sets the maximum number of nodes per IP before banning the IP.

source

pub fn filter_max_bans_per_ip( &mut self, max_bans_per_ip: Option<usize> ) -> &mut Self

The maximum number of times nodes from a single IP can be banned, before the IP itself gets banned.

source

pub fn permit_ban_list(&mut self, list: PermitBanList) -> &mut Self

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

source

pub fn ban_duration(&mut self, ban_duration: Option<Duration>) -> &mut Self

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.

source

pub fn executor( &mut self, executor: Box<dyn Executor + Send + Sync> ) -> &mut Self

A custom executor which can spawn the discv5 tasks. This must be a tokio runtime, with timing support.

source

pub fn build(&mut self) -> Config

Trait Implementations§

source§

impl Debug for ConfigBuilder

source§

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

Formats the value using the given formatter. 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> 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, 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