Expand description
Parsing implementation for networkstatus documents.
In Tor, a networkstatus documents describes a complete view of the relays in the network: how many there are, how to contact them, and so forth.
A networkstatus document can either be a “votes” – an authority’s view of the network, used as input to the voting process – or a “consensus” – a combined view of the network based on multiple authorities’ votes, and signed by multiple authorities.
A consensus document can itself come in two different flavors: a plain (unflavoured) consensus has references to router descriptors, and a “microdesc”-flavored consensus (“md”) has references to microdescriptors.
To keep an up-to-date view of the network, clients download microdescriptor-flavored consensuses periodically, and then download whatever microdescriptors the consensus lists that the client doesn’t already have.
For full information about the network status format, see dir-spec.txt.
§Limitations
NOTE: The consensus format has changes time, using a “consensus-method” mechanism. This module is does not yet handle all all historical consensus-methods.
NOTE: This module does parse some fields that are not in current use, like relay nicknames, and the “published” times on microdescriptors. We should probably decide whether we actually want to do this.
TODO: This module doesn’t implement vote parsing at all yet.
TODO: This module doesn’t implement plain consensuses.
TODO: We need an object safe trait that combines the common operations found
on netstatus documents, so we can store one in a Box<dyn CommonNs> or
something similar; otherwise interfacing applications have a hard time to
process netstatus documents in a flavor agnostic fashion.
TODO: More testing is needed!
TODO: There should be accessor functions for most of the fields here. As with the other tor-netdoc types, I’m deferring those till I know what they should be.
Re-exports§
pub use plain::RouterStatusBuilder as PlainRouterStatusBuilder;pub use md::RouterStatusBuilder as MdRouterStatusBuilder;pub use plain::RouterStatus as PlainRouterStatus;pub use md::RouterStatus as MdRouterStatus;pub use vote::RouterStatus as VoteRouterStatus;pub use plain::Preamble as PlainPreamble;pub use md::Preamble as MdPreamble;pub use vote::Preamble as VotePreamble;pub use PlainConsensus as NsConsensus;pub use PlainRouterStatus as NsRouterStatus;pub use UncheckedPlainConsensus as UncheckedNsConsensus;pub use UnvalidatedPlainConsensus as UnvalidatedNsConsensus;
Modules§
- build 🔒
- Facilities to construct Consensus objects.
- consensus_
methods_ comma_ separated - Module for use with parse2’s
with, to parse one argument of comma-separated consensus methods - dir_
source 🔒 dir-sourceitems, including the mutant-legacyversion- encode_
impls 🔒 encodeimpls for types in this modulea- md
- Implementation for microdesc consensus documents.
- parse2_
impls 🔒 parse2impls for types in this modulea- plain
- Implementation for plain consensus documents.
- proto_
statuses_ 🔒parse2_ encode ProtoStatusesparsing and encoding- rs 🔒
- Routerstatus-specific parts of networkstatus parsing.
- vote
- Implementation for plain consensus documents.
Macros§
- derive_
deftly_ 🔒template_ Directory Signatures Hashes Accu - Bespoke derives applied to
DirectorySignatureHashAlgo - derive_
deftly_ 🔒template_ Lifetime - Bespoke derive for
Lifetime, fornewand accessors - derive_
deftly_ 🔒template_ Vote Authority Section - Ad-hoc derive,
impl NetdocParseable for VoteAuthoritySection
Structs§
- Consensus
Authority Entry - An authority entry as found in a consensus
- Consensus
Authority Entry Constructor - Constructor (required fields) for
ConsensusAuthorityEntry - Consensus
Authority Section - Authority section as found in a consensus
- Consensus
Footer Fields - Fields in the footer of a consensus
- Consensus
Footer Fields Constructor - Constructor (required fields) for
ConsensusFooterFields - Consensus
Footer Fields Netdoc Parse Accumulator - Partially parsed
ConsensusFooterFields - Consensus
Method - A single consensus method
- Consensus
Methods - A set of consensus methods
- Consensus
Signature 🔒ToVerify - Signature information in a consensus, to be verified
- Digest
Algo InSignature algorithmfield in adirectory-signatureitem- DirSource
- Description of an authority’s identity and address.
- Directory
Signatures Hashes Accu directory-signaturea hash algorithm argument- Ignored
Publication Time Sp publiscationfield in routerstatus entry intro item other than in votes- Lifetime
- The lifetime of a networkstatus document.
- Lifetime
Constructor - Constructor (required fields) for
Lifetime - Lifetime
Netdoc Parse Accumulator - Partially parsed
Lifetime - MdConsensus
Builder - A builder object used to construct a consensus.
- NetParams
- A set of named network parameters.
- Network
Status Version network-status-versionversion value- Plain
Consensus Builder - A builder object used to construct a consensus.
- Proto
Status - A list of subprotocol versions that implementors should/must provide.
- Proto
Statuses - A set of recommended and required protocols when running in various scenarios.
- Proto
Statuses Netdoc Parse Accumulator - Partially parsed
ProtoStatusesPartially parsedProtoStatusesParseHelper - Recommended
TorVersions - List of recommended Tor versions
- Relay
Weights Item - Relay weight information -
witem in routerstatus - Router
Status MdDigests Vote mitem in votes- Shared
Rand Commit V1 shared-rand-commitin a vote authority entry- Shared
Rand Commit V1Constructor - Constructor (required fields) for
SharedRandCommitV1 - Shared
Rand Participate shared-rand-participatein a vote authority entry- Shared
Rand Participate Constructor - Constructor (required fields) for
SharedRandParticipate - Shared
Rand Status - A shared-random value produced by the directory authorities, along with meta-information about that value.
- Shared
Rand Statuses - The two shared random values,
shared-rand-*-value - Shared
Rand Statuses Constructor - Constructor (required fields) for
SharedRandStatuses - Shared
Rand Statuses Netdoc Parse Accumulator - Partially parsed
SharedRandStatuses - Shared
Rand Val - A shared random value produced by the directory authorities.
- Signature
- The signature of a single directory authority on a networkstatus document.
- Signature
Group - A collection of signatures that can be checked on a networkstatus document
- Signature
Verified 🔒IfIntended - Token indicating that signature verification has been done, if required
- Superseded
Authority Key - A
dir-sourceline that is a “superseded authority key entry” - Vote
Authority Entry - An authority entry as found in a vote
- Vote
Authority Entry Constructor - Constructor (required fields) for
VoteAuthorityEntry - Vote
Authority Section - An authority section in a vote
- Vote
Authority Section Constructor - Constructor (required fields) for
VoteAuthoritySection - Vote
Status Consensus - The
statusvalue in avote-statusline in a consensus - Vote
Status Vote - The
votevalue in avote-statusline in a vote
Enums§
- Consensus
Flavor - A recognized ‘flavor’ of consensus document.
- Consensus
Verifiability Error - Error which will prevent us from attempting to verify signatures on a consensus
- Consensus
Verify Failed - Error encountered while verifying a consensus
- Directory
Signature Hash Algo directory-signaturehash algorithm argument- Invalid
Recommended TorVersions - Erroneous “recommended Tor versions” information
- Invalid
Relay Weights - Error processing a
wline’s netparams into an effective relay weight - Netstatus
Kwd - Keywords that can be used in votes and consensuses.
- Protocol
Support Error - A subprotocol that is recommended or required in the consensus was not present.
- Relay
Weight - Recognized weight fields on a single relay in a consensus
- Shared
Rand Commit shared-rand-commitin a vote authority entry- Software
Version - A version as presented in a router status.
- Verify
General 🔒Trusted Authorities - How
verify_generalshould decide who is a trusted authority - Vote
Verify Failed - Error encountered while verifying a vote
Statics§
- NS_
FOOTER_ 🔒RULES - Rules for parsing consensus fields from a footer.
- NS_
HEADER_ 🔒RULES_ COMMON_ - Shared parts of rules for all kinds of netstatus headers
- NS_
HEADER_ 🔒RULES_ CONSENSUS - Rules for parsing the header of a consensus.
- NS_
ROUTERSTATUS_ 🔒RULES_ COMMON_ - Shared rules for parsing a single routerstatus
- NS_
ROUTERSTATUS_ 🔒RULES_ MDCON - Rules for parsing a single routerstatus in a microdesc consensus
- NS_
ROUTERSTATUS_ 🔒RULES_ PLAIN - Rules for parsing a single routerstatus in an NS consensus
- NS_
VOTERINFO_ 🔒RULES_ CONSENSUS - Rules for parsing a single voter’s information in a consensus
Functions§
- consensus_
threshold - Return the minimum number of authorities that we need signatures from
Type Aliases§
- Consensus
Voter Info Deprecated - Authority entry in a consensus - deprecated compatibility type alias
- MdAuthority
Entry - Authority entry in an md consensus - type alias provided for consistency
- MdConsensus
- A consensus document that lists relays along with their microdescriptor documents.
- Plain
Authority Entry - Authority entry in a plain consensus - type alias provided for consistency
- Plain
Consensus - A consensus document that lists relays along with their router descriptor documents.
- Unchecked
MdConsensus - An MdConsensus that has been parsed but not checked for signatures and timeliness.
- Unchecked
Plain Consensus - An PlainConsensus that has been parsed but not checked for signatures and timeliness.
- Unvalidated
MdConsensus - An MdConsensus that has been parsed and checked for timeliness, but not for signatures.
- Unvalidated
Plain Consensus - An PlainConsensus that has been parsed and checked for timeliness, but not for signatures.