Struct tor_netdoc::doc::netstatus::UnvalidatedConsensus
source · #[non_exhaustive]pub struct UnvalidatedConsensus<RS> {
pub consensus: Consensus<RS>,
pub siggroup: SignatureGroup,
pub n_authorities: Option<u16>,
}
Expand description
A Microdesc consensus whose signatures have not yet been checked.
To validate this object, call set_n_authorities() on it, then call check_signature() on that result with the set of certs that you have. Make sure only to provide authority certificates representing real authorities!
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.consensus: Consensus<RS>
dangerous-expose-struct-fields
only.The consensus object. We don’t want to expose this until it’s validated.
siggroup: SignatureGroup
dangerous-expose-struct-fields
only.The signatures that need to be validated before we can call this consensus valid.
dangerous-expose-struct-fields
only.The total number of authorities that we believe in. We need
this information in order to validate the signatures, since it
determines how many signatures we need to find valid in siggroup
.
Implementations§
source§impl<RS> UnvalidatedConsensus<RS>
impl<RS> UnvalidatedConsensus<RS>
Tell the unvalidated consensus how many authorities we believe in.
Without knowing this number, we can’t validate the signature.
sourcepub fn signing_cert_ids(&self) -> impl Iterator<Item = AuthCertKeyIds>
pub fn signing_cert_ids(&self) -> impl Iterator<Item = AuthCertKeyIds>
Return an iterator of all the certificate IDs that we might use to validate this consensus.
sourcepub fn peek_lifetime(&self) -> &Lifetime
pub fn peek_lifetime(&self) -> &Lifetime
Return the lifetime of this unvalidated consensus
Return true if a client who believes in exactly the provided set of authority IDs might might consider this consensus to be well-signed.
(This is the case if the consensus claims to be signed by more than half of the authorities in the list.)
sourcepub fn n_relays(&self) -> usize
Available on crate feature experimental-api
only.
pub fn n_relays(&self) -> usize
experimental-api
only.Return the number of relays in this unvalidated consensus.
This function is unstable. It is only enabled if the crate was
built with the experimental-api
feature.
sourcepub fn modify_relays<F>(&mut self, func: F)
Available on crate feature experimental-api
only.
pub fn modify_relays<F>(&mut self, func: F)
experimental-api
only.Modify the list of relays in this unvalidated consensus.
A use case for this is long-lasting custom directories. To ensure Arti can still quickly build circuits when the directory gets old, a tiny churn file can be regularly obtained, listing no longer available Tor nodes, which can then be removed from the consensus.
This function is unstable. It is only enabled if the crate was
built with the experimental-api
feature.
Trait Implementations§
source§impl<RS: Clone> Clone for UnvalidatedConsensus<RS>
impl<RS: Clone> Clone for UnvalidatedConsensus<RS>
source§fn clone(&self) -> UnvalidatedConsensus<RS>
fn clone(&self) -> UnvalidatedConsensus<RS>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<RS: Debug> Debug for UnvalidatedConsensus<RS>
impl<RS: Debug> Debug for UnvalidatedConsensus<RS>
source§impl<RS> ExternallySigned<Consensus<RS>> for UnvalidatedConsensus<RS>
impl<RS> ExternallySigned<Consensus<RS>> for UnvalidatedConsensus<RS>
§type KeyHint = Vec<AuthCertKeyIds>
type KeyHint = Vec<AuthCertKeyIds>
source§fn key_is_correct(&self, k: &Self::Key) -> Result<(), Self::KeyHint>
fn key_is_correct(&self, k: &Self::Key) -> Result<(), Self::KeyHint>
source§fn is_well_signed(&self, k: &Self::Key) -> Result<(), Self::Error>
fn is_well_signed(&self, k: &Self::Key) -> Result<(), Self::Error>
source§fn dangerously_assume_wellsigned(self) -> Consensus<RS>
fn dangerously_assume_wellsigned(self) -> Consensus<RS>
Auto Trait Implementations§
impl<RS> Freeze for UnvalidatedConsensus<RS>
impl<RS> RefUnwindSafe for UnvalidatedConsensus<RS>where
RS: RefUnwindSafe,
impl<RS> Send for UnvalidatedConsensus<RS>where
RS: Send,
impl<RS> Sync for UnvalidatedConsensus<RS>where
RS: Sync,
impl<RS> Unpin for UnvalidatedConsensus<RS>where
RS: Unpin,
impl<RS> UnwindSafe for UnvalidatedConsensus<RS>where
RS: UnwindSafe,
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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