Skip to main content

RouterConfig

Struct RouterConfig 

Source
#[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

Source

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.

Source

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).

Source

pub const fn transit_share_percent(self, percent: u8) -> Self

What percentage of bandwidth_limit_kbps transit tunnels may use (default: 100). Values above 100 are clamped.

Source

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).

Source

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

Source§

fn clone(&self) -> RouterConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RouterConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RouterConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for RouterConfig

Source§

impl PartialEq for RouterConfig

Source§

fn eq(&self, other: &RouterConfig) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RouterConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.