pub struct PexConfig {
pub local_peer_id: String,
pub network_id: String,
pub flags: Vec<String>,
pub interval: u32,
pub jitter: bool,
}Expand description
Configuration for a PexEngine (SPEC Appendix A).
Fields§
§local_peer_id: StringThis participant’s own transport identity (peer_id, <64hex>) — excluded from every
advertisement and used to skip self-entries on receive (SPEC §5.4).
network_id: StringThe network this participant serves — every handshake declares it and every entry MUST match it (SPEC §5.2, §7.3).
flags: Vec<String>This participant’s own capability flags, sent in its handshake (SPEC §4.2). For the relay
introducer this is ["introducer"].
interval: u32The declared send interval (seconds) — clamped into [30, 3600] (SPEC §6.2). Default 60.
jitter: boolWhether to add SPEC §6.3 send jitter. Default true; tests may disable it for deterministic
scheduling (0% jitter is within the allowed 0..+10%).
Implementations§
Source§impl PexConfig
impl PexConfig
Sourcepub fn new(
local_peer_id: impl Into<String>,
network_id: impl Into<String>,
) -> Self
pub fn new( local_peer_id: impl Into<String>, network_id: impl Into<String>, ) -> Self
A new config for local_peer_id on network_id, with the default 60 s interval, no flags,
and jitter enabled.
Sourcepub fn with_flags(self, flags: Vec<String>) -> Self
pub fn with_flags(self, flags: Vec<String>) -> Self
Builder: set this participant’s own capability flags.
Sourcepub fn with_interval(self, secs: u32) -> Self
pub fn with_interval(self, secs: u32) -> Self
Builder: set the declared send interval (seconds), clamped into [30, 3600].
Sourcepub fn with_jitter(self, jitter: bool) -> Self
pub fn with_jitter(self, jitter: bool) -> Self
Builder: enable/disable send jitter (SPEC §6.3).