#[non_exhaustive]pub struct DHTSettings {Show 22 fields
pub token_secret_size: usize,
pub max_peers_response: usize,
pub max_sample_response: usize,
pub min_sample_interval_secs: i32,
pub router_ping_interval_secs: u64,
pub reverify_interval_secs: u64,
pub reverify_grace_period_secs: u64,
pub verify_grace_period_secs: u64,
pub get_peers_freshness_secs: u64,
pub find_nodes_interval_secs: u64,
pub find_nodes_skip_count: usize,
pub max_torrents: usize,
pub max_peers_per_torrent: usize,
pub ping_check_interval_secs: u64,
pub outgoing_request_prune_secs: u64,
pub outgoing_reqiest_check_interval_secs: u64,
pub read_only: bool,
pub routers: Vec<String>,
pub throttle_packet_count: usize,
pub throttle_period_secs: u64,
pub throttle_naughty_timeout_secs: u64,
pub throttle_max_tracking_secs: u64,
}
Expand description
Struct that represents configuration for DHT that, in general, does not change after the DHT is started.
You may need one of these to pass into DHTBuilder.
Use DHTSettings::default() to create an instance with the ‘recommended’ defaults (which can be customized). Or use DHTSettingsBuilder to construct a customized one. DHTSettings has the non_exhaustive attribute and can’t be constructed directly.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.token_secret_size: usize
Number of bytes for token secrets for get_peers responses
max_peers_response: usize
Max number of peers to provide in response to a get_peers. Shouldn’t be much higher than this as the entire response packet needs to be less than 1500
max_sample_response: usize
Max number of info hashes to provide in response to a sample_infohashes request
min_sample_interval_secs: i32
How often we claim to rotate our sample_infohashes response
router_ping_interval_secs: u64
We’ll ping the “routers” at least this often (we may ping more frequently if needed)
reverify_interval_secs: u64
We’ll ping previously-verified nodes at least this often to re-verify them
reverify_grace_period_secs: u64
Verified nodes that we don’t reverify within this amount of time are dropped
verify_grace_period_secs: u64
New nodes have this long to respond to a ping before we drop them
get_peers_freshness_secs: u64
When asked to provide peers, we’ll only provide ones that announced within this time
find_nodes_interval_secs: u64
We’ll think about sending a find_nodes request at least this often. If we have enough nodes already we might not do it.
find_nodes_skip_count: usize
We won’t send a periodic find_nodes request if we have at least this many unverified nodes
max_torrents: usize
Max number of torrents to store peers for
max_peers_per_torrent: usize
Max number of peers per torrent to store
ping_check_interval_secs: u64
We’ll think about pinging and pruning nodes at this interval
outgoing_request_prune_secs: u64
Outgoing requests may be pruned after this many seconds
outgoing_reqiest_check_interval_secs: u64
We’ll think about pruning outgoing requests at this interval
read_only: bool
If true, we will set the read only flag in outgoing requests to prevent other nodes from adding us to their routing tables. This is useful if we’re behind a restrictive NAT/firewall and can’t accept incoming packets from IPs that we haven’t sent anything to.
routers: Vec<String>
Vector of hostnames/ports that the DHT will use as DHT routers for bootstrapping purposes.
E.g., “router.example.org:6881”
throttle_packet_count: usize
The maximum number of packets that will be accepted from an IP (during a period) before packets from that IP will be temporarily ignored.
throttle_period_secs: u64
The number of seconds that the throttler keeps a packet count record for an IP. If the IP sends more than throttle_packet_count packets during this period then packets from it will be blocked.
throttle_naughty_timeout_secs: u64
If the throttler blocks an IP, it will be blocked for at least this amount of time. Every time the blocked IP sends another packet, the counter is reset again (up to a limit of throttle_max_tracking_secs).
throttle_max_tracking_secs: u64
The maximum amount of time that the throttler will keep any record, even if the IP on the record is still sending traffic.
Trait Implementations§
Source§impl Clone for DHTSettings
impl Clone for DHTSettings
Source§fn clone(&self) -> DHTSettings
fn clone(&self) -> DHTSettings
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more