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§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.