Skip to main content

nostr_client_options

Function nostr_client_options 

Source
pub fn nostr_client_options() -> ClientOptions
Expand description

Build a nostr_sdk::ClientOptions with the embedded-Tor SOCKS proxy applied if (and only if) the tor feature is on AND tor::TorService is currently active. When Tor is off, returns the default options unchanged.

Note: nostr-sdk’s proxy() lives on Connection, not ClientOptions directly — we build a Connection with the proxy mode and pass it via ClientOptions::connection(...). The connection() method itself is #[cfg(not(target_arch = "wasm32"))], but Vector targets are all native.

Callers should use this rather than ClientOptions::new() directly so the Tor toggle automatically covers their relay traffic.