pub struct NetworkConfig { /* private fields */ }Expand description
The network configuration.
Implementations§
Source§impl NetworkConfig
impl NetworkConfig
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new NetworkConfig.
Sourcepub fn build() -> NetworkConfigBuilder
pub fn build() -> NetworkConfigBuilder
Returns a NetworkConfigBuilder to construct a NetworkConfig iteratively.
Sourcepub fn replace_addr(&mut self, addr: Protocol<'_>) -> Result<(), Error>
pub fn replace_addr(&mut self, addr: Protocol<'_>) -> Result<(), Error>
Replaces the address, but keeps the port of the bind address.
The argument addr must be either the Ip4, Ip6, or Dns variant of Protocol.
Sourcepub fn replace_port(&mut self, port: Protocol<'_>) -> Result<(), Error>
pub fn replace_port(&mut self, port: Protocol<'_>) -> Result<(), Error>
Replaces the port of the bind address.
The argument port must be the TCP variant of Protocol.
Sourcepub fn add_static_peer(
&mut self,
peer_id: PeerId,
multiaddr: Multiaddr,
alias: Option<String>,
) -> Result<(), Error>
pub fn add_static_peer( &mut self, peer_id: PeerId, multiaddr: Multiaddr, alias: Option<String>, ) -> Result<(), Error>
Adds a static peer.
Sourcepub fn bind_multiaddr(&self) -> &Multiaddr
pub fn bind_multiaddr(&self) -> &Multiaddr
Returns the configured bind address as a Multiaddr.
Sourcepub fn reconnect_interval_secs(&self) -> u64
pub fn reconnect_interval_secs(&self) -> u64
Returns the number of seconds at which reconnect attempts occur.
Sourcepub fn max_unknown_peers(&self) -> usize
pub fn max_unknown_peers(&self) -> usize
Returns the maximum number of unknown peers that are allowed to connect.
Sourcepub fn static_peers(&self) -> &HashSet<Peer>
pub fn static_peers(&self) -> &HashSet<Peer>
Returns the statically configured peers.
Trait Implementations§
Source§impl Clone for NetworkConfig
impl Clone for NetworkConfig
Source§fn clone(&self) -> NetworkConfig
fn clone(&self) -> NetworkConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for NetworkConfig
impl RefUnwindSafe for NetworkConfig
impl Send for NetworkConfig
impl Sync for NetworkConfig
impl Unpin for NetworkConfig
impl UnwindSafe for NetworkConfig
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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 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>
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