Struct tor_netdoc::doc::routerdesc::RouterDesc

source ·
#[non_exhaustive]
pub struct RouterDesc {
Show 19 fields pub nickname: Nickname, pub ipv4addr: Option<Ipv4Addr>, pub orport: u16, pub ipv6addr: Option<(Ipv6Addr, u16)>, pub dirport: u16, pub uptime: Option<u64>, pub published: SystemTime, pub identity_cert: Ed25519Cert, pub rsa_identity_key: PublicKey, pub rsa_identity: RsaIdentity, pub ntor_onion_key: PublicKey, pub tap_onion_key: PublicKey, pub proto: Arc<Protocols>, pub is_dircache: bool, pub is_extrainfo_cache: bool, pub family: Arc<RelayFamily>, pub platform: Option<RelayPlatform>, pub ipv4_policy: AddrPolicy, pub ipv6_policy: Arc<PortPolicy>,
}
Available on crate feature routerdesc only.
Expand description

Information about a relay, parsed from a router descriptor.

This type does not hold all the information in the router descriptor

§Limitations

See module documentation.

Additionally, some fields that from router descriptors are not yet parsed: see the comments in ROUTER_BODY_RULES for information about those.

Before using this type to connect to a relay, you MUST check that it is valid, using is_expired_at().

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§nickname: Nickname
Available on crate feature dangerous-expose-struct-fields only.

Human-readable nickname for this relay.

This is not secure, and not guaranteed to be unique.

§ipv4addr: Option<Ipv4Addr>
Available on crate feature dangerous-expose-struct-fields only.

IPv4 address for this relay.

§orport: u16
Available on crate feature dangerous-expose-struct-fields only.

IPv4 ORPort for this relay.

§ipv6addr: Option<(Ipv6Addr, u16)>
Available on crate feature dangerous-expose-struct-fields only.

IPv6 address and port for this relay.

§dirport: u16
Available on crate feature dangerous-expose-struct-fields only.

Directory port for contacting this relay for direct HTTP directory downloads.

§uptime: Option<u64>
Available on crate feature dangerous-expose-struct-fields only.

Declared uptime for this relay, in seconds.

§published: SystemTime
Available on crate feature dangerous-expose-struct-fields only.

Time when this router descriptor was published.

§identity_cert: Ed25519Cert
Available on crate feature dangerous-expose-struct-fields only.

Ed25519 identity certificate (identity key authenticating a signing key)

§rsa_identity_key: PublicKey
Available on crate feature dangerous-expose-struct-fields only.

RSA identity key for this relay. (Deprecated; never use this without the ed25519 identity as well).

§rsa_identity: RsaIdentity
Available on crate feature dangerous-expose-struct-fields only.

RSA identity key for this relay. (Deprecated; never use this without the ed25519 identity as well).

§ntor_onion_key: PublicKey
Available on crate feature dangerous-expose-struct-fields only.

Key for extending a circuit to this relay using the ntor protocol.

§tap_onion_key: PublicKey
Available on crate feature dangerous-expose-struct-fields only.

Key for extending a circuit to this relay using the (deprecated) TAP protocol.

§proto: Arc<Protocols>
Available on crate feature dangerous-expose-struct-fields only.

List of subprotocol versions supported by this relay.

§is_dircache: bool
Available on crate feature dangerous-expose-struct-fields only.

True if this relay says it’s a directory cache.

§is_extrainfo_cache: bool
Available on crate feature dangerous-expose-struct-fields only.

True if this relay says that it caches extrainfo documents.

§family: Arc<RelayFamily>
Available on crate feature dangerous-expose-struct-fields only.

Declared family members for this relay. If two relays are in the same family, they shouldn’t be used in the same circuit.

§platform: Option<RelayPlatform>
Available on crate feature dangerous-expose-struct-fields only.

Software and version that this relay says it’s running.

§ipv4_policy: AddrPolicy
Available on crate feature dangerous-expose-struct-fields only.

A complete address-level policy for which IPv4 addresses this relay says it supports.

§ipv6_policy: Arc<PortPolicy>
Available on crate feature dangerous-expose-struct-fields only.

A summary of which ports this relay is willing to connect to on IPv6.

Implementations§

source§

impl RouterDesc

source

pub fn rsa_identity(&self) -> &RsaIdentity

Return a reference to this relay’s RSA identity.

source

pub fn ed_identity(&self) -> &Ed25519Identity

Return a reference to this relay’s Ed25519 identity.

source

pub fn protocols(&self) -> &Protocols

Return a reference to the list of subprotocol versions supported by this relay.

source

pub fn ntor_onion_key(&self) -> &PublicKey

Return a reference to this relay’s Ntor onion key.

source

pub fn published(&self) -> SystemTime

Return the publication

source

pub fn or_ports(&self) -> impl Iterator<Item = SocketAddr> + '_

Return an iterator of every SocketAddr at which this descriptor says its relay can be reached.

source

pub fn parse(s: &str) -> Result<UncheckedRouterDesc>

Try to parse s as a router descriptor.

Does not actually check liveness or signatures; you need to do that yourself before you can do the output.

Trait Implementations§

source§

impl Clone for RouterDesc

source§

fn clone(&self) -> RouterDesc

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 Debug for RouterDesc

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where 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.

§

impl<T> Instrument for T

§

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

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

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 T
where 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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where 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 T
where 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 T
where 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 T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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