#[non_exhaustive]pub struct NostrServerTransportConfig {Show 17 fields
pub relay_urls: Vec<String>,
pub encryption_mode: EncryptionMode,
pub gift_wrap_mode: GiftWrapMode,
pub server_info: Option<ServerInfo>,
pub is_announced_server: bool,
pub allowed_public_keys: Vec<String>,
pub excluded_capabilities: Vec<CapabilityExclusion>,
pub max_sessions: usize,
pub cleanup_interval: Duration,
pub session_timeout: Duration,
pub request_timeout: Duration,
pub relay_list_urls: Option<Vec<String>>,
pub bootstrap_relay_urls: Option<Vec<String>>,
pub publish_relay_list: bool,
pub profile_metadata: Option<ProfileMetadata>,
pub oversized_transfer: OversizedTransferConfig,
pub open_stream: OpenStreamConfig,
}Expand description
Configuration for the server transport.
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.relay_urls: Vec<String>Relay URLs to connect to.
encryption_mode: EncryptionModeEncryption mode.
gift_wrap_mode: GiftWrapModeGift-wrap kind selection policy (CEP-19).
server_info: Option<ServerInfo>Server information for announcements.
is_announced_server: boolWhether this server publishes public announcements (CEP-6).
allowed_public_keys: Vec<String>Allowed client public keys (hex). Empty = allow all.
excluded_capabilities: Vec<CapabilityExclusion>Capabilities excluded from pubkey whitelisting.
max_sessions: usizeMaximum number of concurrent client sessions (LRU-bounded, default: 1000).
cleanup_interval: DurationSession cleanup interval (default: 60s).
session_timeout: DurationSession timeout (default: 300s).
request_timeout: DurationCorrelation-retention TTL for server-side event routes (default: 60s).
Stale route entries older than this are swept from the correlation store. This prevents leaks – rmcp owns actual request timeout and cancellation. Keep this value above your rmcp request timeout to avoid premature cleanup.
relay_list_urls: Option<Vec<String>>Explicit relay URLs to advertise in kind 10002 (NIP-65 relay list).
Falls back to the transport’s relay_urls when omitted.
bootstrap_relay_urls: Option<Vec<String>>Additional publication targets for discoverability events.
Merged with relay_list_urls when computing where to send events.
Defaults to DEFAULT_BOOTSTRAP_RELAY_URLS when omitted.
publish_relay_list: boolWhether to publish a relay list event (kind 10002). Default: true.
profile_metadata: Option<ProfileMetadata>Optional NIP-01 profile metadata (kind 0) to publish at startup.
oversized_transfer: OversizedTransferConfigCEP-22 oversized payload transfer configuration. Enabled by default.
open_stream: OpenStreamConfigCEP-41 open-stream configuration. Disabled by default (opt-in).
When enabled, drives capability advertisement/learning, server→client
writers, response deferral, and the keepalive sweep. Opt in with
OpenStreamConfig::enabled() / with_enabled(true).
Implementations§
Source§impl NostrServerTransportConfig
impl NostrServerTransportConfig
Sourcepub fn with_encryption_mode(self, mode: EncryptionMode) -> Self
pub fn with_encryption_mode(self, mode: EncryptionMode) -> Self
Set the encryption mode.
Sourcepub fn with_gift_wrap_mode(self, mode: GiftWrapMode) -> Self
pub fn with_gift_wrap_mode(self, mode: GiftWrapMode) -> Self
Set the gift-wrap mode (CEP-19).
Sourcepub fn with_server_info(self, info: ServerInfo) -> Self
pub fn with_server_info(self, info: ServerInfo) -> Self
Set server information for announcements.
Sourcepub fn with_announced_server(self, announced: bool) -> Self
pub fn with_announced_server(self, announced: bool) -> Self
Enable or disable public announcement publishing (CEP-6).
Sourcepub fn with_allowed_public_keys(self, keys: Vec<String>) -> Self
pub fn with_allowed_public_keys(self, keys: Vec<String>) -> Self
Set the allowed client public keys (hex). Empty = allow all.
Sourcepub fn with_excluded_capabilities(self, caps: Vec<CapabilityExclusion>) -> Self
pub fn with_excluded_capabilities(self, caps: Vec<CapabilityExclusion>) -> Self
Set capabilities excluded from pubkey whitelisting.
Sourcepub fn with_max_sessions(self, max: usize) -> Self
pub fn with_max_sessions(self, max: usize) -> Self
Set the maximum number of concurrent client sessions.
Sourcepub fn with_relay_urls(self, urls: Vec<String>) -> Self
pub fn with_relay_urls(self, urls: Vec<String>) -> Self
Set the relay URLs to connect to.
Sourcepub fn with_cleanup_interval(self, interval: Duration) -> Self
pub fn with_cleanup_interval(self, interval: Duration) -> Self
Set the session cleanup interval.
Sourcepub fn with_session_timeout(self, timeout: Duration) -> Self
pub fn with_session_timeout(self, timeout: Duration) -> Self
Set the session timeout.
Sourcepub fn with_request_timeout(self, timeout: Duration) -> Self
pub fn with_request_timeout(self, timeout: Duration) -> Self
Set the correlation-retention TTL for event routes.
Sourcepub fn with_relay_list_urls(self, urls: Vec<String>) -> Self
pub fn with_relay_list_urls(self, urls: Vec<String>) -> Self
Set explicit relay URLs to advertise in the relay list event (kind 10002).
Sourcepub fn with_bootstrap_relay_urls(self, urls: Vec<String>) -> Self
pub fn with_bootstrap_relay_urls(self, urls: Vec<String>) -> Self
Set additional bootstrap relay URLs for discoverability event publication.
Sourcepub fn with_publish_relay_list(self, publish: bool) -> Self
pub fn with_publish_relay_list(self, publish: bool) -> Self
Enable or disable relay list publication (kind 10002).
Sourcepub fn with_profile_metadata(self, metadata: ProfileMetadata) -> Self
pub fn with_profile_metadata(self, metadata: ProfileMetadata) -> Self
Set NIP-01 profile metadata (kind 0) for publication at startup.
Sourcepub fn with_oversized_transfer(self, config: OversizedTransferConfig) -> Self
pub fn with_oversized_transfer(self, config: OversizedTransferConfig) -> Self
Set the full CEP-22 oversized payload transfer configuration.
Sourcepub fn with_oversized_enabled(self, enabled: bool) -> Self
pub fn with_oversized_enabled(self, enabled: bool) -> Self
Enable or disable CEP-22 oversized payload transfer, leaving other knobs at default.
Sourcepub fn with_open_stream(self, config: OpenStreamConfig) -> Self
pub fn with_open_stream(self, config: OpenStreamConfig) -> Self
Set the full CEP-41 open-stream configuration (disabled by default; opt in
with OpenStreamConfig::enabled()).
Trait Implementations§
Source§impl Clone for NostrServerTransportConfig
impl Clone for NostrServerTransportConfig
Source§fn clone(&self) -> NostrServerTransportConfig
fn clone(&self) -> NostrServerTransportConfig
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 NostrServerTransportConfig
impl Debug for NostrServerTransportConfig
Auto Trait Implementations§
impl Freeze for NostrServerTransportConfig
impl RefUnwindSafe for NostrServerTransportConfig
impl Send for NostrServerTransportConfig
impl Sync for NostrServerTransportConfig
impl Unpin for NostrServerTransportConfig
impl UnsafeUnpin for NostrServerTransportConfig
impl UnwindSafe for NostrServerTransportConfig
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