blob: 756ba5f54c0fb7a827245462b6273bb1a7d0c86a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
//! Define configuration structures used for relay selection.
use std::collections::HashSet;
/// Configuration object for building relay restrictions.
///
/// This object can affect the interpretation of various usages and restrictions.
#[allow(clippy::exhaustive_structs)]
pub struct RelaySelectionConfig<'a> {
/// A set of ports that require Stable relays.
pub long_lived_ports: &'a HashSet<u16>,
/// Configuration for which addresses are considered "too close"
/// to share a circuit.
pub subnet_config: tor_netdir::SubnetConfig,
}
impl<'a> RelaySelectionConfig<'a> {
/// Return true if `port` requires us to use relays with the Stable flag.
pub(crate) fn port_requires_stable_flag(&self, port: u16) -> bool {
self.long_lived_ports.contains(&port)
}
}
|