Skip to main content

RouterDesc

Struct RouterDesc 

Source
#[non_exhaustive]
pub struct RouterDesc {
Show 25 fields pub router: RouterDescIntroItem, pub identity_ed25519: EmbeddedCert<Ed25519IdentityCert, KeyUnknownCert>, pub master_key_ed25519: Ed25519Public, pub bandwidth: Bandwidth, pub platform: Option<RelayPlatform>, pub published: Iso8601TimeSp, pub fingerprint: Option<SpFingerprint>, pub hibernating: NumericBoolean, pub uptime: Option<u64>, pub onion_key: Option<PublicKey>, pub ntor_onion_key: Curve25519Public, pub ntor_onion_key_crosscert: NtorOnionKeyCrossCert, pub signing_key: PublicKey, pub ipv4_policy: AddrPolicy, pub ipv6_policy: Intern<PortPolicy>, pub overload_general: Option<OverloadGeneral>, pub contact: Option<ContactInfo>, pub family: Intern<RelayFamily>, pub family_cert: RetainedOrderVec<EmbeddedCert<Ed25519FamilyCert, KeyUnknownCert>>, pub caches_extra_info: Option<ItemPresent<CachesExtraInfoToken>>, pub extra_info_digest: Option<ExtraInfoDigests>, pub hidden_service_dir: Option<ItemPresent<HiddenServiceDirToken>>, pub or_address: Vec<SocketAddr>, pub tunnelled_dir_server: Option<ItemPresent<TunnelledDirServerToken>>, pub proto: Protocols,
}
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().

§Specification

https://spec.torproject.org/dir-spec/server-descriptor-format.html

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.
§router: RouterDescIntroItem

router — Introduce a router descriptor.

  • router <nickname> <address> <orport> <socksport> <dirport>
  • At start, exactly once.
§identity_ed25519: EmbeddedCert<Ed25519IdentityCert, KeyUnknownCert>

identity-ed25519 — Specify the router’s ed25519 identity.

https://spec.torproject.org/dir-spec/server-descriptor-format.html#item:identity-ed25519

§master_key_ed25519: Ed25519Public

master-key-ed25519 — Redundantly specify the router’s ed25519 identity.

  • master-key-ed25519 <master key>
  • Exactly once.
§bandwidth: Bandwidth

bandwidth — Report router’s network bandwidth.

  • bandwidth <average> <burst> <observed>
  • Exactly once.
§platform: Option<RelayPlatform>

platform — Describe the platform on which this relay is running.

  • platform <rest of line>
  • At most once.
§published: Iso8601TimeSp

published — Time this descriptor (and extra-info) was generated.

  • published <date> <time>
  • Exactly once.
§fingerprint: Option<SpFingerprint>

fingerprint — Redundant hash of ASN-1 encoding of router identity key.

  • fingerprint <spaced fingerprint>
  • At most once.
§hibernating: NumericBoolean§uptime: Option<u64>

uptime — How long this relay has been continously running

  • uptime <number>
  • At most once.
§onion_key: Option<PublicKey>

onion-key — Relay’s obsolete RSA tap key.

  • onion-key\n<rsa public key>
  • At most once.
  • No extra arguments.
§ntor_onion_key: Curve25519Public

ntor-onion-key — The circuit extension key.

  • ntor-onion-key <base64 padded key>
  • Exactly once.
§ntor_onion_key_crosscert: NtorOnionKeyCrossCert

ntor-onion-key-crosscert — Reverse cert by K_ntor on KP_relayid_ed

https://spec.torproject.org/dir-spec/server-descriptor-format.html#item:ntor-onion-key-crosscert

§signing_key: PublicKey

signing-key — Obsolete RSA identity key.

  • signing-key\n<rsa public key>
§ipv4_policy: AddrPolicy

accept, reject — Exit policy.

  • accept exitpattern
  • reject exitpattern
  • Any number of times.
§ipv6_policy: Intern<PortPolicy>

ipv6-policy — Exit plicy summary for IPv6

  • ipv6-policy <accept/reject> PortList
  • At most once.
§overload_general: Option<OverloadGeneral>

overload-general — Relay is overloaded.

  • overload-general 1 <time>
  • At most once.
§contact: Option<ContactInfo>

contact — Server administrator contact information.

https://spec.torproject.org/dir-spec/server-descriptor-format.html#item:contact

§family: Intern<RelayFamily>

family — Group relays for the purpose of path selection.

  • family <LongIdent> ...
  • One or more LongIdent arguments.
  • At most once.
§family_cert: RetainedOrderVec<EmbeddedCert<Ed25519FamilyCert, KeyUnknownCert>>

family-cert — Prove membership in a relay family.

  • family-cert\n<object>
  • Any number of times.
§caches_extra_info: Option<ItemPresent<CachesExtraInfoToken>>

caches-extra-info — Router provides extra-info as a dirmirror.

  • caches-extra-info
  • At most once.
  • No extra arguments.
§extra_info_digest: Option<ExtraInfoDigests>§hidden_service_dir: Option<ItemPresent<HiddenServiceDirToken>>

hidden-service-dir — Declares this router to be a hidden service directory

https://spec.torproject.org/dir-spec/server-descriptor-format.html#item:hidden-service-dir

§or_address: Vec<SocketAddr>§tunnelled_dir_server: Option<ItemPresent<TunnelledDirServerToken>>

tunnelled-dir-server — Accepts a BEGIN_DIR relay message.

  • tunnelled-dir-server
  • At most once.
  • No extra arguments.
§proto: Protocols

proto — Subprotocol capabilities supported.

  • proto <entries>
  • Exactly once.

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 family(&self) -> Intern<RelayFamily>

Return the declared family of this descriptor.

Source

pub fn family_ids(&self) -> RelayFamilyIds

Return the authenticated family IDs of this descriptor.

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.

The following fields are not parsed with the legacy parser and their default value is used instead.

Trait Implementations§

Source§

impl Clone for RouterDesc

Source§

fn clone(&self) -> RouterDesc

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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
Source§

impl Eq for RouterDesc

Source§

impl From<RouterDesc> for RouterDescUnverifiedParsedBody

Source§

fn from(value: RouterDesc) -> Self

Converts to this type from the input type.
Source§

impl HasUnverifiedParsedBody for RouterDesc

Source§

type UnverifiedParsedBody = RouterDescUnverifiedParsedBody

The actual body payload.
Source§

fn unverified_into_inner_unchecked( unverified: Self::UnverifiedParsedBody, ) -> Self

Extract the payload Read more
Source§

impl PartialEq for RouterDesc

Source§

fn eq(&self, other: &RouterDesc) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for RouterDesc

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Sync + Send>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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 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> PossiblyOption<T> for T

Source§

fn to_option(self) -> Option<T>

Convert this object into an Option<T>
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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>,

Source§

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>,

Source§

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.
Source§

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

Source§

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