pub struct TransportConfig {
pub ble_enabled: bool,
pub wifi_direct_enabled: bool,
pub internet_enabled: bool,
pub reticulum_enabled: bool,
pub nostr_enabled: bool,
pub nostr_sealing_enabled: bool,
pub nostr_cold_contact_enabled: bool,
pub nostr_username_discovery_enabled: bool,
pub binary_wire_enabled: bool,
}Expand description
Transport-specific configuration.
Fields§
§ble_enabled: boolWhether BLE transport is enabled.
wifi_direct_enabled: boolWhether Wi-Fi Direct transport is enabled.
internet_enabled: boolWhether Internet transport is enabled.
reticulum_enabled: boolWhether Reticulum mesh transport is enabled.
Defaults to false because Reticulum requires external infrastructure
(a running Reticulum daemon or RNode hardware).
nostr_enabled: boolWhether Nostr relay transport is enabled.
Defaults to false because Nostr requires relay configuration
and a secp256k1 keypair.
nostr_sealing_enabled: boolWhether outgoing Nostr frames are sealed into NIP-59 gift wraps.
Defaults to true. With it off, the transport publishes the legacy
kind-4 event whose content is the whole protocol envelope in cleartext —
both usernames, the app id, the metadata map, the content type and a
millisecond timestamp, readable by every relay, permanently. Turn it off
only to interoperate with a relay that rejects kind 1059 outright.
Send-side only, and never negotiated: inbound gift wraps are always unsealed and inbound legacy frames always parsed, so whatever this is set to, anything a peer sends us stays readable.
It does still affect outbound reachability, in the one direction the
receive path cannot cover. A peer on a build that predates sealing
subscribes with kinds: [4] only, so it is never handed our kind-1059
events and has no NIP-44 layer to open one with — leaving it on makes
such a peer unreachable over Nostr (visibly: no ACK returns, so the
send fails through the retry ladder rather than vanishing). That is the
second reason to turn this off, alongside a relay that rejects
kind 1059.
nostr_cold_contact_enabled: boolWhether this install publishes MLS key packages to the relays and resolves peers’ published packages.
Defaults to true, and takes effect only when nostr_enabled is on —
which is itself off by default, so nothing is published unless an app
deliberately turns Nostr on.
Buys cold first contact: a peer known only by username becomes reachable over Nostr with no prior key-package exchange over some other transport, which is otherwise impossible. It also bounds the sealing downgrade that follows a peer-key eviction, since a forgotten key is re-resolved on the next send instead of waiting for a fresh exchange.
What it costs is worth stating plainly. Publication is the first thing this SDK emits to a relay unprompted: a small set of addressable records sits at this install’s routing tag and is refreshed as slots are consumed, whether or not any message is ever sent. Their content is sealed — a scraper filtering on the kind alone reads nothing, which matters because an MLS key package carries its owner’s username in the leaf credential and cannot be stripped of it — but the existence of a record at a given tag, and the timing of its refreshes, are visible to every relay published to. Turn this off to keep the transport silent until it has traffic, at the price of cold contact.
nostr_username_discovery_enabled: boolWhether this install publishes a username discovery record and can resolve usernames to the devices claiming them.
Defaults to false, unlike nostr_cold_contact_enabled, and gates
publication and resolution together. It also requires cold contact:
a discovery record points at an address whose key packages are what a
resolver fetches next, so with cold contact off the claim resolves and
then dead-ends one hop later. The two are hard-coupled in the transport
rather than merely documented.
Buys back reach by username, which the addressing migration removed:
a stranger who knows only a name can find the addresses claiming it and
open a session. The name is published as the app’s configured profile,
normalized to NFC and lowercase.
Default-off is the deliberate choice, and the reason is disclosure. Publishing binds a human-readable name to an address in a public place. That is materially more than the key-package record’s “an install with this tag exists”: the mapping is the payload. The record is sealed to a key derived from the username, so a relay scraping by kind alone reads nothing, but anyone who guesses the name can compute the tag, confirm a claim exists, and read it. That is the same class of exposure a public user directory has, and it is a decision an app should make explicitly.
What the directory is not: authoritative. Anyone may publish any
claim at any name. Every record is a claim that some key asserts a
name, and a resolution returns the whole set of claimants with their
verification status. An app that silently picks the first result has
converted a non-authoritative directory into an authoritative-looking
one; the user must confirm out of band. See
docs/spec/username-discovery.md.
binary_wire_enabled: boolWhether to negotiate and emit the compact binary wire codec.
Defaults to true. It only takes effect between two peers that both
advertise support (via their signed key package), so a mixed fleet
automatically stays on JSON. Decoding of binary frames is always on,
independent of this flag; this gates only advertising and emitting.
Trait Implementations§
Source§impl Clone for TransportConfig
impl Clone for TransportConfig
Source§impl Debug for TransportConfig
impl Debug for TransportConfig
Source§impl Default for TransportConfig
impl Default for TransportConfig
Source§impl<'de> Deserialize<'de> for TransportConfig
impl<'de> Deserialize<'de> for TransportConfig
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 TransportConfig
impl RefUnwindSafe for TransportConfig
impl Send for TransportConfig
impl Sync for TransportConfig
impl Unpin for TransportConfig
impl UnsafeUnpin for TransportConfig
impl UnwindSafe for TransportConfig
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> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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 moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);