Skip to main content

NostrDiscoveryConfig

Struct NostrDiscoveryConfig 

Source
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: bool

Enable Nostr-signaled traversal bootstrap.

§advertise: bool

Publish 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.

§share_local_candidates: bool

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: String

Traversal application namespace and advert identifier suffix.

§signal_ttl_secs: u64

Signaling TTL in seconds.

§policy: NostrDiscoveryPolicy

Policy for advert-derived endpoint discovery.

§open_discovery_max_pending: usize

Max number of open-discovery peers queued for outbound retry/connection at once. Prevents unbounded queue growth from ambient advert traffic.

§max_concurrent_incoming_offers: usize

Max concurrent inbound traversal offers processed at once. Acts as a rate limit against offer spam from relays.

§advert_cache_max_entries: usize

Max cached overlay adverts retained from relay traffic. Bounds memory under ambient advert volume.

§seen_sessions_max_entries: usize

Max seen-session IDs retained for replay detection. Oldest entries are evicted when the cap is exceeded.

§attempt_timeout_secs: u64

Overall punch attempt timeout in seconds.

§replay_window_secs: u64

Replay tracking retention window in seconds.

§punch_start_delay_ms: u64

Delay before punch traffic starts.

§punch_interval_ms: u64

Interval between punch packets.

§punch_duration_ms: u64

How long to keep punching before failure.

§advert_ttl_secs: u64

Advert TTL in seconds.

§advert_refresh_secs: u64

How often adverts are refreshed in seconds.

§startup_sweep_delay_secs: u64

Settle 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: u64

Maximum 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: u32

Number 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: u64

Cooldown 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: u64

Minimum 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: usize

Maximum 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: u64

Cooldown 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

Source§

fn clone(&self) -> NostrDiscoveryConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NostrDiscoveryConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for NostrDiscoveryConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for NostrDiscoveryConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for NostrDiscoveryConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,