Skip to main content

ConfigBuilder

Struct ConfigBuilder 

Source
pub struct ConfigBuilder { /* private fields */ }
Expand description

Builds a Config.

Implementations§

Source§

impl ConfigBuilder

Source

pub fn new_from(discv5_config: Config) -> Self

Returns a new builder, with all fields set like given instance.

Source

pub fn discv5_config(self, discv5_config: Config) -> Self

Set [discv5::Config], which contains the [discv5::Discv5] listen socket.

Source

pub fn add_signed_boot_nodes(self, nodes: impl IntoIterator<Item = Enr>) -> Self

Adds multiple boot nodes from a list of Enrs.

Source

pub fn add_cl_serialized_signed_boot_nodes(self, enrs: &str) -> Self

Parses a comma-separated list of serialized Enrs, signed node records, and adds any successfully deserialized records to boot nodes. Note: this type is serialized in CL format since [discv5] is originally a CL library.

Source

pub fn add_unsigned_boot_nodes( self, enodes: impl IntoIterator<Item = NodeRecord>, ) -> Self

Adds boot nodes in the form a list of NodeRecords, parsed enodes.

Source

pub fn add_serialized_unsigned_boot_nodes(self, enodes: &[&str]) -> Self

Adds a comma-separated list of enodes, serialized unsigned node records, to boot nodes.

Source

pub const fn fork(self, fork_key: &'static [u8], fork_id: ForkId) -> Self

Set fork ID kv-pair to set in local Enr. This lets peers on discovery network know which chain this node belongs to.

Source

pub const fn fork_if_unset( self, fork_key: &'static [u8], fork_id: ForkId, ) -> Self

Sets the fork ID kv-pair if none has already been configured.

Source

pub const fn tcp_socket(self, socket: SocketAddr) -> Self

Sets the tcp socket to advertise in the local Enr. The IP address of this socket will overwrite the discovery address of the same IP version, if one is configured.

Source

pub const fn advertised_ip(self, ip: IpAddr) -> Self

Sets the IP address to advertise in the local Enr, without changing the discv5 listen socket.

Routed to the matching address family, so calling this once per family yields a dual-stack advertisement.

Source

pub fn add_enr_kv_pair(self, key: &'static [u8], value: Bytes) -> Self

Adds an additional kv-pair to include in the local Enr. Takes the key to use for the kv-pair and the rlp encoded value.

Source

pub const fn lookup_interval(self, seconds: u64) -> Self

Sets the interval at which to run lookup queries, in order to fill kbuckets. Lookup queries are done periodically at the given interval for the whole run of the program.

Source

pub const fn bootstrap_lookup_interval(self, seconds: u64) -> Self

Sets the interval at which to run boost lookup queries at start up. Queries will be started at this interval for the configured number of times after start up.

Source

pub const fn bootstrap_lookup_countdown(self, counts: u64) -> Self

Sets the number of times at which to run boost lookup queries to bootstrap the node.

Source

pub fn must_not_include_keys(self, not_keys: &[&'static [u8]]) -> Self

Adds keys to disallow when filtering a discovered peer, to determine whether or not it should be passed to rlpx. The discovered node record is scanned for any kv-pairs where the key matches the disallowed keys. If not explicitly set, b“eth2“ key will be disallowed.

Source

pub fn build(self) -> Config

Returns a new 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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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> NonStaticAny for T
where T: ?Sized,

§

fn type_id(&self) -> TypeId

Returns the lifetime-erased type ID of self.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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

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: 888 bytes