Expand description
The transport meta-glue: one egress decision for every TCP connection Vector opens, and one process bridge that any anonymity network plugs into.
Clearnet is Egress::Direct. Every other kind (Tor, I2P, …) is a Transport installed in
the host slot, reached through the authenticated SOCKS5 bridge. A chosen kind that is
not ready refuses in process: nothing ever falls back to a direct socket.
Inside community/ refer to this module as crate::transport::…: the name collides with
community::transport.
Re-exports§
pub use runtime::runtime;pub use runtime::spawn_on;pub use budget::budget;pub use budget::Budgets;pub use budget::Op;pub use route::nip11_url;pub use route::validate_relay_url;pub use route::Dest;pub use route::Refusal;pub use route::Route;
Modules§
- aliases
- Twins: a server’s address inside another network, used as a transport alias. The relay URL, SNI, Host header and NIP-42 relay tag all stay clearnet, so only TLS on 443 may ride a twin: a wrong twin can then only fail.
- bridge
- The process bridge: a loopback SOCKS5 server every proxied connection passes through, bound once and never closed, so no client ever holds a port someone else can later take.
- budget
- Time budgets: a caller’s clearnet value, raised to the floor of the chosen kind.
- cycle
- Moving relay sockets onto the network now in use. Runs on the embedding app’s runtime, never the transport runtime: nostr-sdk spawns a relay’s tasks on the runtime that connects it.
- guard
- A socket that dies with the decision that opened it: the next read or write after the epoch moves, or after its session stops being live, fails. A switch closes every relay socket of every client without a registry.
- host
- The process-wide slot for the one active transport instance, its events, and the dial the bridge runs for every proxied connection.
- i2p_
config - The I2P kind’s settings. Compiled in every build so Settings reads and writes them anywhere.
- kinds
- The registry: a config codec for every kind (compiled always) and a factory for every compiled kind. One line per kind.
- prefs
- The account’s network choice and routing settings. One source of truth: the session’s
SessionPrefs; instances never hold a copy. - prelogin
- The welcome screen’s network choice: remembered per install, carried into the first account that commits, and only ever raising an account’s own choice.
- realtime
- Calls and Mini App realtime ride iroh, which never goes through the chosen network. Under any kind but Clearnet they need the user’s consent, recorded on the session for the kind in use.
- route
- Host classification and the routing rules: one pre-router shared by every kind, then each kind’s own pure rules.
- runtime
- The transport runtime: the bridge, its connections and every long-lived transport socket live here, so a short-lived caller runtime (Android background sync) can’t take them down with it.
- status
- Serde views shared by every shell (Tauri and Vector Web), with the reason codes and texts.
- tor_
config - The Tor kind’s settings: Vector’s own Tor, or a Tor already running on this device. Compiled in every build so Settings reads and writes them anywhere.
- twins
- Twin checks and NIP-11 lookups, through the network in use. A twin is checked by a full TLS handshake for the server’s own name through that network: one that can’t present the certificate is never used. Both run only while the network is ready, so neither ever leaves on another one.
- ws
- Relay egress: every relay socket Vector opens goes through
VectorWs, which askssuper::egressper connect and guards the socket it opens.
Structs§
- Dialed
- Route
Ctx - The live session’s routing inputs, read per dial so an instance never holds a stale copy.
- Start
Ctx - Ticket
- What a proxied connection proves to the bridge: the session that built the client, the epoch it was decided in, and the lane it speaks for.
Enums§
- Connect
Error - Egress
- Exit
Policy - Kind
- Lane
- Which identity a connection speaks for. I2P gives each lane its own destination, so a host a stranger names only ever learns the Shared one.
- Transport
State
Traits§
Functions§
- blocked_
reason - Why nothing can leave right now, while the chosen network isn’t usable.
- changed
- Resolves once
epoch() != since. - egress
- The one decision every TCP egress makes.
owneris the session the client was built under. - epoch
- Bumped only when the egress decision can change: preference, live session, an instance installed or removed, or its readiness.
- policy_
gen - Bumped when a routing input of the live session changes: exit policy, outproxies, aliases.
- preference
- The live session’s chosen kind.
None= Unknown. - refusal
- The rule behind
refuses. - refuses
- The refusal text when the live account’s route can never reach this URL or host (relay lists, community targets). Transient blocks are not refusals.
- route_
view - set_
preference - Set the live session’s kind. Bumps the epoch when it changes; a kind change also drops that session’s realtime consent.
- state
- strict_
boot - First-party binaries that hold accounts call this once at startup: every session from here on starts Unknown (blocked) until its stored network is loaded.
- supported
- Compiled kinds, in
Kindorder. - wait_
ready - Hold until the chosen kind is ready or
maxpasses. A block only the user can lift (a failed start, a router that turned Vector down) ends the wait at once with its reason.
Type Aliases§
- Boxed
Stream - Kind
Config - A kind’s parsed config, opaque to shared code; each kind downcasts its own type.