#[non_exhaustive]pub struct RouterConfig { /* private fields */ }Expand description
How this router participates in the wider I2P network – see
I2pRouter::start_with_config.
libi2pd normally reads all of this from an i2pd.conf, which the library entry point never
parses (only upstream’s daemon did), so these settings are the only way to reach them. They
apply between libi2pd’s init and start; nothing here can be changed on a running router.
Default mirrors i2pd-sys’s own: transit on, 256 KB/s, no share limit, libi2pd’s own
transit tunnel ceiling, floodfill off.
use tachyon_i2p::RouterConfig;
// Keep carrying transit (the anonymity-preserving default), but bound what it costs.
let config = RouterConfig::default()
.bandwidth_limit_kbps(512)
.transit_share_percent(25)
.max_transit_tunnels(500);Implementations§
Source§impl RouterConfig
impl RouterConfig
Sourcepub const fn accepts_transit(self, enabled: bool) -> Self
pub const fn accepts_transit(self, enabled: bool) -> Self
Whether to carry other users’ tunnels (default: true).
Transit is unrelated to your own destinations, which work either way. It defaults to on because a router that relays nothing gives an observer no cover traffic: every byte crossing the link is then yours, and the refusal is itself a fingerprint. Turn it off when bandwidth is metered, or when the risk you care about is a memory-safety bug in libi2pd rather than traffic analysis.
Building without the default transit feature is the stronger form of false: libi2pd’s
tunnel build-request path is compiled out, so true here is silently ignored and
I2pRouter::supports_transit reports false.
Sourcepub const fn bandwidth_limit_kbps(self, kbps: u32) -> Self
pub const fn bandwidth_limit_kbps(self, kbps: u32) -> Self
Whole-router bandwidth ceiling in KB/s (default: 256).
A limit is always in force, and 0 is not “unlimited” – it falls back to the same 256 KB/s default as never calling this. At a genuine 0 the router publishes itself as permanently congested and refuses transit outright, so i2pd-sys applies 256 KB/s at init, below upstream’s 2048 KB/s daemon default (which assumes a dedicated router, not a library sharing a server’s uplink).
What percentage of bandwidth_limit_kbps transit tunnels
may use (default: 100). Values above 100 are clamped.
Sourcepub const fn max_transit_tunnels(self, max: u32) -> Self
pub const fn max_transit_tunnels(self, max: u32) -> Self
Ceiling on concurrently-carried transit tunnels (default: libi2pd’s own 25000, a daemon-scale figure worth lowering for a library embedding).
Sourcepub const fn floodfill(self, enabled: bool) -> Self
pub const fn floodfill(self, enabled: bool) -> Self
Whether to serve the distributed netDb (default: false).
A floodfill router stores and answers lookups for the whole network’s lease sets: a lot of extra traffic, and a lot of extra attacker-supplied input parsed in-process. Leave it off unless running a floodfill is the point.
Trait Implementations§
Source§impl Clone for RouterConfig
impl Clone for RouterConfig
Source§fn clone(&self) -> RouterConfig
fn clone(&self) -> RouterConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more