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>
The consensus object. We don’t want to expose this until it’s validated.
siggroup: SignatureGroup
The signatures that need to be validated before we can call this consensus valid.
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
sourceimpl<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
pub fn n_relays(&self) -> usize
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) where
F: FnOnce(&mut Vec<RS>),
pub fn modify_relays<F>(&mut self, func: F) where
F: FnOnce(&mut Vec<RS>),
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
sourceimpl<RS: Clone> Clone for UnvalidatedConsensus<RS>
impl<RS: Clone> Clone for UnvalidatedConsensus<RS>
sourcefn clone(&self) -> UnvalidatedConsensus<RS>
fn clone(&self) -> UnvalidatedConsensus<RS>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<RS: Debug> Debug for UnvalidatedConsensus<RS>
impl<RS: Debug> Debug for UnvalidatedConsensus<RS>
sourceimpl<RS> ExternallySigned<Consensus<RS>> for UnvalidatedConsensus<RS>
impl<RS> ExternallySigned<Consensus<RS>> for UnvalidatedConsensus<RS>
type KeyHint = Vec<AuthCertKeyIds, Global>
type KeyHint = Vec<AuthCertKeyIds, Global>
A type that describes what keys are missing for this object.
sourcefn key_is_correct(&self, k: &Self::Key) -> Result<(), Self::KeyHint>
fn key_is_correct(&self, k: &Self::Key) -> Result<(), Self::KeyHint>
Check whether k is the right key for this object. If not, return an error describing what key would be right. Read more
sourcefn is_well_signed(&self, k: &Self::Key) -> Result<(), Self::Error>
fn is_well_signed(&self, k: &Self::Key) -> Result<(), Self::Error>
Check the signature on this object
sourcefn dangerously_assume_wellsigned(self) -> Consensus<RS>
fn dangerously_assume_wellsigned(self) -> Consensus<RS>
Unwrap this object without checking any signatures on it.
sourcefn check_signature(self, k: &Self::Key) -> Result<T, Self::Error>
fn check_signature(self, k: &Self::Key) -> Result<T, Self::Error>
Unwrap this object if it’s correctly signed by a provided key.
Auto Trait Implementations
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more