pub struct ConfigBuilder { /* private fields */ }Expand description
Builds a Config.
Implementations§
Source§impl ConfigBuilder
impl ConfigBuilder
Sourcepub fn new_from(discv5_config: Config) -> Self
pub fn new_from(discv5_config: Config) -> Self
Returns a new builder, with all fields set like given instance.
Sourcepub fn discv5_config(self, discv5_config: Config) -> Self
pub fn discv5_config(self, discv5_config: Config) -> Self
Set [discv5::Config], which contains the [discv5::Discv5] listen socket.
Sourcepub fn add_signed_boot_nodes(self, nodes: impl IntoIterator<Item = Enr>) -> Self
pub fn add_signed_boot_nodes(self, nodes: impl IntoIterator<Item = Enr>) -> Self
Adds multiple boot nodes from a list of Enrs.
Sourcepub fn add_cl_serialized_signed_boot_nodes(self, enrs: &str) -> Self
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.
Sourcepub fn add_unsigned_boot_nodes(
self,
enodes: impl IntoIterator<Item = NodeRecord>,
) -> Self
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.
Sourcepub fn add_serialized_unsigned_boot_nodes(self, enodes: &[&str]) -> Self
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.
Sourcepub const fn fork(self, fork_key: &'static [u8], fork_id: ForkId) -> Self
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.
Sourcepub const fn fork_if_unset(
self,
fork_key: &'static [u8],
fork_id: ForkId,
) -> Self
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.
Sourcepub const fn tcp_socket(self, socket: SocketAddr) -> Self
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.
Sourcepub const fn advertised_ip(self, ip: IpAddr) -> Self
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.
Sourcepub fn add_enr_kv_pair(self, key: &'static [u8], value: Bytes) -> Self
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.
Sourcepub const fn lookup_interval(self, seconds: u64) -> Self
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.
Sourcepub const fn bootstrap_lookup_interval(self, seconds: u64) -> Self
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.
Sourcepub const fn bootstrap_lookup_countdown(self, counts: u64) -> Self
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.
Sourcepub fn must_not_include_keys(self, not_keys: &[&'static [u8]]) -> Self
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.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ConfigBuilder
impl !UnwindSafe for ConfigBuilder
impl Freeze for ConfigBuilder
impl Send for ConfigBuilder
impl Sync for ConfigBuilder
impl Unpin for ConfigBuilder
impl UnsafeUnpin for ConfigBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
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