#[non_exhaustive]pub struct Config {Show 15 fields
pub(crate) name: Arc<String>,
pub(crate) noise_protocols: NonEmpty<BTreeMap<Version, Protocol>>,
pub(crate) keypair: Keypair,
pub(crate) bind: NetAddr,
pub(crate) parties: Vec<(PublicKey, NetAddr)>,
pub(crate) peer_budget: NonZeroUsize,
pub(crate) max_message_size: NonZeroUsize,
pub(crate) connect_retry_delays: NonEmpty<Vec<u8>>,
pub(crate) send_retry_delays: NonEmpty<Vec<u8>>,
pub(crate) random_connect_delay: bool,
pub(crate) connect_timeout: Duration,
pub(crate) handshake_timeout: Duration,
pub(crate) receive_timeout: Duration,
pub(crate) backoff_duration: Duration,
pub(crate) metrics: Option<Arc<dyn Metrics>>,
}Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: Arc<String>Network name.
noise_protocols: NonEmpty<BTreeMap<Version, Protocol>>The supported noise protocols.
Nodes negotiate a common supported version which implies the exact noise protocol parameters they are going to use for the subsequent handshake.
With this map, a node specifies the noise protocol names it supports per version number.
keypair: KeypairDH keypair
bind: NetAddrAddress to bind to.
parties: Vec<(PublicKey, NetAddr)>Network members with public key and network address.
peer_budget: NonZeroUsize§max_message_size: NonZeroUsizeMax. number of bytes per message to send or receive.
connect_retry_delays: NonEmpty<Vec<u8>>Connect retry delays in seconds.
send_retry_delays: NonEmpty<Vec<u8>>Send retry delays in seconds.
random_connect_delay: boolRandomly delay the initial connect attempt between 0 and 1s.
connect_timeout: DurationHow long to wait to establish a TCP connection?
handshake_timeout: DurationHow long to wait for a noise handshake to complete?
receive_timeout: DurationAfter sending a message we expect to hear back from the peer.
If we do not receive anything for this duration we reconnect.
backoff_duration: DurationIf a party is not known we tell it to back off for this amount of time.
This may happen when not all peers have a consistent configuration.
metrics: Option<Arc<dyn Metrics>>Optional metrics implementation.
Implementations§
Source§impl Config
impl Config
Sourcepub fn builder() -> ConfigBuilder
pub fn builder() -> ConfigBuilder
Create an instance of Config using the builder syntax