Struct libp2p_autonat::Config

source ·
pub struct Config {
    pub timeout: Duration,
    pub boot_delay: Duration,
    pub refresh_interval: Duration,
    pub retry_interval: Duration,
    pub throttle_server_period: Duration,
    pub use_connected: bool,
    pub confidence_max: usize,
    pub max_peer_addresses: usize,
    pub throttle_clients_global_max: usize,
    pub throttle_clients_peer_max: usize,
    pub throttle_clients_period: Duration,
    pub only_global_ips: bool,
}
Expand description

Config for the Behaviour.

Fields§

§timeout: Duration

Timeout for requests.

§boot_delay: Duration

Delay on init before starting the fist probe.

§refresh_interval: Duration

Interval in which the NAT should be tested again if max confidence was reached in a status.

§retry_interval: Duration

Interval in which the NAT status should be re-tried if it is currently unknown or max confidence was not reached yet.

§throttle_server_period: Duration

Throttle period for re-using a peer as server for a dial-request.

§use_connected: bool

Use connected peers as servers for probes.

§confidence_max: usize

Max confidence that can be reached in a public / private NAT status. Note: for NatStatus::Unknown the confidence is always 0.

§max_peer_addresses: usize

Max addresses that are tried per peer.

§throttle_clients_global_max: usize

Max total dial requests done in [Config::throttle_clients_period].

§throttle_clients_peer_max: usize

Max dial requests done in [Config::throttle_clients_period] for a peer.

§throttle_clients_period: Duration

Period for throttling clients requests.

§only_global_ips: bool

As a server reject probes for clients that are observed at a non-global ip address. Correspondingly as a client only pick peers as server that are not observed at a private ip address. Note that this does not apply for servers that are added via Behaviour::add_server.

Trait Implementations§

source§

impl Clone for Config

source§

fn clone(&self) -> Config

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for Config

source§

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

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

impl Default for Config

source§

fn default() -> Self

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

impl PartialEq for Config

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Config

source§

impl StructuralEq for Config

source§

impl StructuralPartialEq for Config

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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>,

§

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more