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>

source

pub fn id(&self) -> &Ed25519Identity

Return the Ed25519 ID for this relay.

source

pub fn rsa_id(&self) -> &RsaIdentity

Return the RsaIdentity for this relay.

source

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.)

source

pub fn supports_exit_port_ipv4(&self, port: u16) -> bool

Return true if this relay allows exiting to port on IPv4.

source

pub fn supports_exit_port_ipv6(&self, port: u16) -> bool

Return true if this relay allows exiting to port on IPv6.

source

pub fn is_dir_cache(&self) -> bool

Return true if this relay is suitable for use as a directory cache.

source

pub fn is_flagged_guard(&self) -> bool

Return true if this relay is marked as a potential Guard node.

source

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.

source

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.)

source

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.)

source

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

source

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

source

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.

source

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.

source

pub fn rs(&self) -> &MdConsensusRouterStatus

Available on crate feature 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.

source

pub fn md(&self) -> &Microdesc

Available on crate feature 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>

source§

fn display_chan_target(&self) -> DisplayChanTarget<'_, Self>where Self: Sized,

Return a reference to this object suitable for formatting its ChanTarget-specific members. Read more
source§

impl<'a> CircTarget for Relay<'a>

source§

fn ntor_onion_key(&self) -> &PublicKey

Return the ntor onion key for this relay
source§

fn protovers(&self) -> &Protocols

Return the subprotocols implemented by this relay.
source§

fn linkspecs(&self) -> Result<Vec<EncodedLinkSpec, Global>, EncodeError>

Return a new vector of encoded link specifiers for this relay. Read more
source§

impl<'a> Clone for Relay<'a>

source§

fn clone(&self) -> Relay<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a> HasAddrs for Relay<'a>

source§

fn addrs(&self) -> &[SocketAddr]

Return the addresses listed for this server. Read more
source§

impl<'a> HasRelayIdsLegacy for Relay<'a>

source§

fn ed_identity(&self) -> &Ed25519Identity

Return the ed25519 identity for this relay.
source§

fn rsa_identity(&self) -> &RsaIdentity

Return the RSA identity for this relay.
source§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<D> HasChanMethod for Dwhere D: DirectChanMethodsHelper,

source§

fn chan_method(&self) -> ChannelMethod

Return the known ways to contact this
source§

impl<T> HasRelayIds for Twhere T: HasRelayIdsLegacy,

source§

fn identity(&self, key_type: RelayIdType) -> Option<RelayIdRef<'_>>

Return the identity of this relay whose type is key_type, or None if the relay has no such identity. Read more
source§

fn identities(&self) -> RelayIdIter<'_, Self>

Return an iterator over all of the identities held by this object.
source§

fn ed_identity(&self) -> Option<&Ed25519Identity>

Return the ed25519 identity for this relay if it has one.
source§

fn rsa_identity(&self) -> Option<&RsaIdentity>

Return the RSA identity for this relay if it has one.
source§

fn has_identity(&self, id: RelayIdRef<'_>) -> bool

Check whether the provided Id is a known identity of this relay. Read more
source§

fn has_any_identity(&self) -> bool

Return true if this object has any known identity.
source§

fn same_relay_ids<T>(&self, other: &T) -> boolwhere T: HasRelayIds + ?Sized,

Return true if this object has exactly the same relay IDs as other.
source§

fn has_all_relay_ids_from<T>(&self, other: &T) -> boolwhere T: HasRelayIds + ?Sized,

Return true if this object has every relay ID that other does. Read more
source§

fn cmp_by_relay_ids<T>(&self, other: &T) -> Orderingwhere T: HasRelayIds + ?Sized,

Compare this object to another HasRelayIds. Read more
source§

fn display_relay_ids(&self) -> DisplayRelayIds<'_, Self>

Return a reference to this object suitable for formatting its HasRelayIds members.
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more