Struct tor_netdoc::doc::netstatus::Consensus
source · #[non_exhaustive]pub struct Consensus<RS> {
pub header: ConsensusHeader,
pub voters: Vec<ConsensusVoterInfo>,
pub relays: Vec<RS>,
pub footer: Footer,
}
Expand description
A single microdescriptor consensus netstatus
TODO: This should possibly turn into a parameterized type, to represent votes and ns consensuses.
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.header: ConsensusHeader
dangerous-expose-struct-fields
only.Part of the header shared by all consensus types.
voters: Vec<ConsensusVoterInfo>
dangerous-expose-struct-fields
only.List of voters whose votes contributed to this consensus.
relays: Vec<RS>
dangerous-expose-struct-fields
only.A list of routerstatus entries for the relays on the network, with one entry per relay.
These are currently ordered by the router’s RSA identity, but this is not to be relied on, since we may want to even abolish RSA at some point!
dangerous-expose-struct-fields
only.Footer for the consensus object.
Implementations§
source§impl<RS> Consensus<RS>
impl<RS> Consensus<RS>
sourcepub fn relays(&self) -> &[RS]
pub fn relays(&self) -> &[RS]
Return a slice of all the routerstatus entries in this consensus.
sourcepub fn bandwidth_weights(&self) -> &NetParams<i32>
pub fn bandwidth_weights(&self) -> &NetParams<i32>
Return a mapping from keywords to integers representing how to weight different kinds of relays in different path positions.
sourcepub fn params(&self) -> &NetParams<i32>
pub fn params(&self) -> &NetParams<i32>
Return the map of network parameters that this consensus advertises.
Return the latest shared random value, if the consensus contains one.
Return the previous shared random value, if the consensus contains one.
sourcepub fn relay_protocol_status(&self) -> &ProtoStatus
pub fn relay_protocol_status(&self) -> &ProtoStatus
Return a ProtoStatus
that lists the network’s current requirements and
recommendations for the list of protocols that every relay must implement.
sourcepub fn client_protocol_status(&self) -> &ProtoStatus
pub fn client_protocol_status(&self) -> &ProtoStatus
Return a ProtoStatus
that lists the network’s current requirements and
recommendations for the list of protocols that every client must implement.
source§impl<RS: RouterStatus + ParseRouterStatus> Consensus<RS>
impl<RS: RouterStatus + ParseRouterStatus> Consensus<RS>
sourcepub fn builder() -> ConsensusBuilder<RS>
Available on crate feature build_docs
only.
pub fn builder() -> ConsensusBuilder<RS>
build_docs
only.Return a new ConsensusBuilder for building test consensus objects.
This function is only available when the build_docs
feature has
been enabled.
Trait Implementations§
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 Consensus<RS>
impl<RS> RefUnwindSafe for Consensus<RS>where
RS: RefUnwindSafe,
impl<RS> Send for Consensus<RS>where
RS: Send,
impl<RS> Sync for Consensus<RS>where
RS: Sync,
impl<RS> Unpin for Consensus<RS>where
RS: Unpin,
impl<RS> UnwindSafe for Consensus<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