Struct tor_netdir::SubnetConfig
source · pub struct SubnetConfig { /* private fields */ }
Expand description
Configuration for determining when two relays have addresses “too close” in the network.
Used by Relay::in_same_subnet()
.
Implementations§
source§impl SubnetConfig
impl SubnetConfig
sourcepub fn new(subnets_family_v4: u8, subnets_family_v6: u8) -> Self
pub fn new(subnets_family_v4: u8, subnets_family_v6: u8) -> Self
Construct a new SubnetConfig from a pair of bit prefix lengths.
The values are clamped to the appropriate ranges if they are out-of-bounds.
sourcepub fn addrs_in_same_subnet(&self, a: &IpAddr, b: &IpAddr) -> bool
pub fn addrs_in_same_subnet(&self, a: &IpAddr, b: &IpAddr) -> bool
Return true if the two addresses in the same subnet, according to this configuration.
Trait Implementations§
source§impl Clone for SubnetConfig
impl Clone for SubnetConfig
source§fn clone(&self) -> SubnetConfig
fn clone(&self) -> SubnetConfig
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for SubnetConfig
impl Debug for SubnetConfig
source§impl Default for SubnetConfig
impl Default for SubnetConfig
source§impl<'de> Deserialize<'de> for SubnetConfig
impl<'de> Deserialize<'de> for SubnetConfig
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Copy for SubnetConfig
Auto Trait Implementations§
impl RefUnwindSafe for SubnetConfig
impl Send for SubnetConfig
impl Sync for SubnetConfig
impl Unpin for SubnetConfig
impl UnwindSafe for SubnetConfig
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more