Struct tor_netdir::Relay
source · pub struct Relay<'a> { /* private fields */ }Expand description
A view of a relay on the Tor network, suitable for building circuits.
Implementations§
source§impl<'a> Relay<'a>
impl<'a> Relay<'a>
sourcepub fn id(&self) -> &Ed25519Identity
pub fn id(&self) -> &Ed25519Identity
Return the Ed25519 ID for this relay.
sourcepub fn rsa_id(&self) -> &RsaIdentity
pub fn rsa_id(&self) -> &RsaIdentity
Return the RsaIdentity for this relay.
sourcepub fn same_relay(&self, other: &Relay<'_>) -> bool
pub fn same_relay(&self, other: &Relay<'_>) -> bool
Return true if this relay and other seem to be the same relay.
(Two relays are the same if they have the same identity.)
sourcepub fn supports_exit_port_ipv4(&self, port: u16) -> bool
pub fn supports_exit_port_ipv4(&self, port: u16) -> bool
Return true if this relay allows exiting to port on IPv4.
sourcepub fn supports_exit_port_ipv6(&self, port: u16) -> bool
pub fn supports_exit_port_ipv6(&self, port: u16) -> bool
Return true if this relay allows exiting to port on IPv6.
sourcepub fn is_dir_cache(&self) -> bool
pub fn is_dir_cache(&self) -> bool
Return true if this relay is suitable for use as a directory cache.
sourcepub fn is_flagged_guard(&self) -> bool
pub fn is_flagged_guard(&self) -> bool
Return true if this relay is marked as a potential Guard node.
sourcepub fn in_same_subnet(
&self,
other: &Relay<'_>,
subnet_config: &SubnetConfig
) -> bool
pub fn in_same_subnet( &self, other: &Relay<'_>, subnet_config: &SubnetConfig ) -> bool
Return true if both relays are in the same subnet, as configured by
subnet_config.
Two relays are considered to be in the same subnet if they
have IPv4 addresses with the same subnets_family_v4-bit
prefix, or if they have IPv6 addresses with the same
subnets_family_v6-bit prefix.
sourcepub fn in_same_family(&self, other: &Relay<'_>) -> bool
pub fn in_same_family(&self, other: &Relay<'_>) -> bool
Return true if both relays are in the same family.
(Every relay is considered to be in the same family as itself.)
sourcepub fn policies_allow_some_port(&self) -> bool
pub fn policies_allow_some_port(&self) -> bool
Return true if there are any ports for which this Relay can be used for exit traffic.
(Returns false if this relay doesn’t allow exit traffic, or if it has been flagged as a bad exit.)
sourcepub fn ipv4_policy(&self) -> Arc<PortPolicy>
pub fn ipv4_policy(&self) -> Arc<PortPolicy>
Return the IPv4 exit policy for this relay. If the relay has been marked BadExit, return an empty policy
sourcepub fn ipv6_policy(&self) -> Arc<PortPolicy>
pub fn ipv6_policy(&self) -> Arc<PortPolicy>
Return the IPv6 exit policy for this relay. If the relay has been marked BadExit, return an empty policy
sourcepub fn ipv4_declared_policy(&self) -> &Arc<PortPolicy>
pub fn ipv4_declared_policy(&self) -> &Arc<PortPolicy>
Return the IPv4 exit policy declared by this relay. Contrary to Relay::ipv4_policy,
this does not verify if the relay is marked BadExit.
sourcepub fn ipv6_declared_policy(&self) -> &Arc<PortPolicy>
pub fn ipv6_declared_policy(&self) -> &Arc<PortPolicy>
Return the IPv6 exit policy declared by this relay. Contrary to Relay::ipv6_policy,
this does not verify if the relay is marked BadExit.
sourcepub fn rs(&self) -> &MdConsensusRouterStatus
Available on crate feature experimental-api only.
pub fn rs(&self) -> &MdConsensusRouterStatus
experimental-api only.Return a reference to this relay’s “router status” entry in the consensus.
The router status entry contains information about the relay that the authorities voted on directly. For most use cases, you shouldn’t need them.
This function is only available if the crate was built with
its experimental-api feature.
sourcepub fn md(&self) -> &Microdesc
Available on crate feature experimental-api only.
pub fn md(&self) -> &Microdesc
experimental-api only.Return a reference to this relay’s “microdescriptor” entry in the consensus.
A “microdescriptor” is a synopsis of the information about a relay, used to determine its capabilities and route traffic through it. For most use cases, you shouldn’t need it.
This function is only available if the crate was built with
its experimental-api feature.
Trait Implementations§
source§impl<'a> ChanTarget for Relay<'a>
impl<'a> ChanTarget for Relay<'a>
source§fn display_chan_target(&self) -> DisplayChanTarget<'_, Self>where
Self: Sized,
fn display_chan_target(&self) -> DisplayChanTarget<'_, Self>where Self: Sized,
ChanTarget-specific members. Read moresource§impl<'a> CircTarget for Relay<'a>
impl<'a> CircTarget for Relay<'a>
source§fn ntor_onion_key(&self) -> &PublicKey
fn ntor_onion_key(&self) -> &PublicKey
source§impl<'a> HasAddrs for Relay<'a>
impl<'a> HasAddrs for Relay<'a>
source§fn addrs(&self) -> &[SocketAddr]
fn addrs(&self) -> &[SocketAddr]
source§impl<'a> HasRelayIdsLegacy for Relay<'a>
impl<'a> HasRelayIdsLegacy for Relay<'a>
source§fn ed_identity(&self) -> &Ed25519Identity
fn ed_identity(&self) -> &Ed25519Identity
source§fn rsa_identity(&self) -> &RsaIdentity
fn rsa_identity(&self) -> &RsaIdentity
impl<'a> DirectChanMethodsHelper for Relay<'a>
Auto Trait Implementations§
impl<'a> RefUnwindSafe for Relay<'a>
impl<'a> Send for Relay<'a>
impl<'a> Sync for Relay<'a>
impl<'a> Unpin for Relay<'a>
impl<'a> UnwindSafe for Relay<'a>
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
source§impl<D> HasChanMethod for Dwhere
D: DirectChanMethodsHelper,
impl<D> HasChanMethod for Dwhere D: DirectChanMethodsHelper,
source§fn chan_method(&self) -> ChannelMethod
fn chan_method(&self) -> ChannelMethod
source§impl<T> HasRelayIds for Twhere
T: HasRelayIdsLegacy,
impl<T> HasRelayIds for Twhere T: HasRelayIdsLegacy,
source§fn identity(&self, key_type: RelayIdType) -> Option<RelayIdRef<'_>>
fn identity(&self, key_type: RelayIdType) -> Option<RelayIdRef<'_>>
key_type, or None if
the relay has no such identity. Read moresource§fn identities(&self) -> RelayIdIter<'_, Self>
fn identities(&self) -> RelayIdIter<'_, Self>
source§fn ed_identity(&self) -> Option<&Ed25519Identity>
fn ed_identity(&self) -> Option<&Ed25519Identity>
source§fn rsa_identity(&self) -> Option<&RsaIdentity>
fn rsa_identity(&self) -> Option<&RsaIdentity>
source§fn has_identity(&self, id: RelayIdRef<'_>) -> bool
fn has_identity(&self, id: RelayIdRef<'_>) -> bool
source§fn has_any_identity(&self) -> bool
fn has_any_identity(&self) -> bool
source§fn same_relay_ids<T>(&self, other: &T) -> boolwhere
T: HasRelayIds + ?Sized,
fn same_relay_ids<T>(&self, other: &T) -> boolwhere T: HasRelayIds + ?Sized,
other.source§fn has_all_relay_ids_from<T>(&self, other: &T) -> boolwhere
T: HasRelayIds + ?Sized,
fn has_all_relay_ids_from<T>(&self, other: &T) -> boolwhere T: HasRelayIds + ?Sized,
other does. Read moresource§fn cmp_by_relay_ids<T>(&self, other: &T) -> Orderingwhere
T: HasRelayIds + ?Sized,
fn cmp_by_relay_ids<T>(&self, other: &T) -> Orderingwhere T: HasRelayIds + ?Sized,
source§fn display_relay_ids(&self) -> DisplayRelayIds<'_, Self>
fn display_relay_ids(&self) -> DisplayRelayIds<'_, Self>
HasRelayIds members.