#[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
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.router: RouterDescIntroItemrouter — 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: Ed25519Publicmaster-key-ed25519 — Redundantly specify the router’s ed25519 identity.
master-key-ed25519 <master key>- Exactly once.
bandwidth: Bandwidthbandwidth — 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: Iso8601TimeSppublished — 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: NumericBooleanhibernating — Whether the relay is hibernating.
https://spec.torproject.org/dir-spec/server-descriptor-format.html#item:hibernating
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: Curve25519Publicntor-onion-key — The circuit extension key.
ntor-onion-key <base64 padded key>- Exactly once.
ntor_onion_key_crosscert: NtorOnionKeyCrossCertntor-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: PublicKeysigning-key — Obsolete RSA identity key.
signing-key\n<rsa public key>
ipv4_policy: AddrPolicyaccept, reject — Exit policy.
accept exitpatternreject 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
LongIdentarguments. - 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>extra-info-digest — Hash of the extra-info document.
https://spec.torproject.org/dir-spec/server-descriptor-format.html#item:extra-info-digest
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>or-address — Alternative ORport address and port
https://spec.torproject.org/dir-spec/server-descriptor-format.html#item:or-address
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: Protocolsproto — Subprotocol capabilities supported.
proto <entries>- Exactly once.
Implementations§
Source§impl RouterDesc
impl RouterDesc
Sourcepub fn rsa_identity(&self) -> RsaIdentity
pub fn rsa_identity(&self) -> RsaIdentity
Return a reference to this relay’s RSA identity.
Sourcepub fn ed_identity(&self) -> &Ed25519Identity
pub fn ed_identity(&self) -> &Ed25519Identity
Return a reference to this relay’s Ed25519 identity.
Sourcepub fn protocols(&self) -> &Protocols
pub fn protocols(&self) -> &Protocols
Return a reference to the list of subprotocol versions supported by this relay.
Sourcepub fn ntor_onion_key(&self) -> &PublicKey
pub fn ntor_onion_key(&self) -> &PublicKey
Return a reference to this relay’s Ntor onion key.
Sourcepub fn published(&self) -> SystemTime
pub fn published(&self) -> SystemTime
Return the publication
Sourcepub fn or_ports(&self) -> impl Iterator<Item = SocketAddr> + '_
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.
Sourcepub fn family(&self) -> Intern<RelayFamily>
pub fn family(&self) -> Intern<RelayFamily>
Return the declared family of this descriptor.
Sourcepub fn family_ids(&self) -> RelayFamilyIds
pub fn family_ids(&self) -> RelayFamilyIds
Return the authenticated family IDs of this descriptor.
Sourcepub fn parse(s: &str) -> Result<UncheckedRouterDesc>
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
impl Clone for RouterDesc
Source§fn clone(&self) -> RouterDesc
fn clone(&self) -> RouterDesc
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RouterDesc
impl Debug for RouterDesc
impl Eq for RouterDesc
Source§impl From<RouterDesc> for RouterDescUnverifiedParsedBody
impl From<RouterDesc> for RouterDescUnverifiedParsedBody
Source§fn from(value: RouterDesc) -> Self
fn from(value: RouterDesc) -> Self
Source§impl HasUnverifiedParsedBody for RouterDesc
impl HasUnverifiedParsedBody for RouterDesc
Source§type UnverifiedParsedBody = RouterDescUnverifiedParsedBody
type UnverifiedParsedBody = RouterDescUnverifiedParsedBody
Source§fn unverified_into_inner_unchecked(
unverified: Self::UnverifiedParsedBody,
) -> Self
fn unverified_into_inner_unchecked( unverified: Self::UnverifiedParsedBody, ) -> Self
Source§impl PartialEq for RouterDesc
impl PartialEq for RouterDesc
Source§fn eq(&self, other: &RouterDesc) -> bool
fn eq(&self, other: &RouterDesc) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for RouterDesc
Auto Trait Implementations§
impl Freeze for RouterDesc
impl RefUnwindSafe for RouterDesc
impl Send for RouterDesc
impl Sync for RouterDesc
impl Unpin for RouterDesc
impl UnsafeUnpin for RouterDesc
impl UnwindSafe for RouterDesc
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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