pub struct NostrDiscoveryConfig {Show 27 fields
pub enabled: bool,
pub advertise: bool,
pub advert_relays: Vec<String>,
pub dm_relays: Vec<String>,
pub stun_servers: Vec<String>,
pub share_local_candidates: bool,
pub app: String,
pub signal_ttl_secs: u64,
pub policy: NostrDiscoveryPolicy,
pub open_discovery_max_pending: usize,
pub max_concurrent_incoming_offers: usize,
pub advert_cache_max_entries: usize,
pub seen_sessions_max_entries: usize,
pub attempt_timeout_secs: u64,
pub replay_window_secs: u64,
pub punch_start_delay_ms: u64,
pub punch_interval_ms: u64,
pub punch_duration_ms: u64,
pub advert_ttl_secs: u64,
pub advert_refresh_secs: u64,
pub startup_sweep_delay_secs: u64,
pub startup_sweep_max_age_secs: u64,
pub failure_streak_threshold: u32,
pub extended_cooldown_secs: u64,
pub warn_log_interval_secs: u64,
pub failure_state_max_entries: usize,
pub protocol_mismatch_cooldown_secs: u64,
}Expand description
Nostr-mediated overlay endpoint discovery (node.discovery.nostr.*).
Fields§
§enabled: boolEnable Nostr-signaled traversal bootstrap.
advertise: boolPublish service advertisements so remote peers can bootstrap inbound.
advert_relays: Vec<String>Relay URLs used for service advertisements.
dm_relays: Vec<String>Relay URLs used for encrypted signaling events.
stun_servers: Vec<String>STUN servers used for local reflexive address discovery. Outbound observation uses only this local list; peer-advertised STUN values are informational and are not treated as egress targets.
Whether to advertise local (RFC 1918 / ULA) interface addresses as host candidates in the traversal offer.
Off by default: in most deployments the relevant peers are not on the same broadcast domain, and sharing private host candidates causes misleading punch successes when an asymmetric L3 path (corporate VPN, Tailscale subnet route, overlapping address space, etc.) makes a peer’s private IP one-way reachable from this node. Enable only when peers are on the same physical LAN and same-LAN punching is wanted.
app: StringTraversal application namespace and advert identifier suffix.
signal_ttl_secs: u64Signaling TTL in seconds.
policy: NostrDiscoveryPolicyPolicy for advert-derived endpoint discovery.
open_discovery_max_pending: usizeMax number of open-discovery peers queued for outbound retry/connection at once. Prevents unbounded queue growth from ambient advert traffic.
max_concurrent_incoming_offers: usizeMax concurrent inbound traversal offers processed at once. Acts as a rate limit against offer spam from relays.
advert_cache_max_entries: usizeMax cached overlay adverts retained from relay traffic. Bounds memory under ambient advert volume.
seen_sessions_max_entries: usizeMax seen-session IDs retained for replay detection. Oldest entries are evicted when the cap is exceeded.
attempt_timeout_secs: u64Overall punch attempt timeout in seconds.
replay_window_secs: u64Replay tracking retention window in seconds.
punch_start_delay_ms: u64Delay before punch traffic starts.
punch_interval_ms: u64Interval between punch packets.
punch_duration_ms: u64How long to keep punching before failure.
advert_ttl_secs: u64Advert TTL in seconds.
advert_refresh_secs: u64How often adverts are refreshed in seconds.
startup_sweep_delay_secs: u64Settle delay in seconds after Nostr discovery starts before the
one-shot startup sweep of cached adverts runs. Allows the relay
subscription backlog to populate the in-memory advert cache.
Only used under policy: open. Default: 5.
startup_sweep_max_age_secs: u64Maximum age in seconds for cached adverts considered by the
one-shot startup sweep. Adverts whose created_at is older than
now - startup_sweep_max_age_secs are skipped. Only used under
policy: open. Default: 3600 (1 hour).
failure_streak_threshold: u32Number of consecutive NAT-traversal failures against a peer before
an extended cooldown is applied to throttle further offer publishes.
At this threshold the daemon also actively re-fetches the peer’s
advert from advert_relays to evict cache entries for peers that
have gone away. Default: 5.
extended_cooldown_secs: u64Cooldown applied to a peer once failure_streak_threshold is hit.
Suppresses both open-discovery sweep enqueues and per-attempt
retry firings until elapsed. Default: 1800 (30 minutes).
warn_log_interval_secs: u64Minimum interval between NAT traversal failed WARN log lines for
the same peer. Subsequent failures inside the window log at DEBUG.
Reduces log spam on public-test nodes with many cache-learned
peers. Default: 300 (5 minutes).
failure_state_max_entries: usizeMaximum entries retained in the per-npub failure-state map. Bounds memory under high cache turnover. Oldest entries (by last failure time) evicted when the cap is exceeded. Default: 4096.
protocol_mismatch_cooldown_secs: u64Cooldown applied after observing a fatal protocol mismatch on a
Nostr-adopted bootstrap transport (e.g. Unknown FMP version
from a peer running a different FMP-protocol version). Independent
of extended_cooldown_secs and much longer because the mismatch
is structural — re-traversing the peer is wasted effort until one
side upgrades. Default: 86400 (24 hours).
Trait Implementations§
Source§impl Clone for NostrDiscoveryConfig
impl Clone for NostrDiscoveryConfig
Source§fn clone(&self) -> NostrDiscoveryConfig
fn clone(&self) -> NostrDiscoveryConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for NostrDiscoveryConfig
impl Debug for NostrDiscoveryConfig
Source§impl Default for NostrDiscoveryConfig
impl Default for NostrDiscoveryConfig
Source§impl<'de> Deserialize<'de> for NostrDiscoveryConfig
impl<'de> Deserialize<'de> for NostrDiscoveryConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for NostrDiscoveryConfig
impl RefUnwindSafe for NostrDiscoveryConfig
impl Send for NostrDiscoveryConfig
impl Sync for NostrDiscoveryConfig
impl Unpin for NostrDiscoveryConfig
impl UnsafeUnpin for NostrDiscoveryConfig
impl UnwindSafe for NostrDiscoveryConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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