Skip to main content

Crate tor_protover

Crate tor_protover 

Source
Expand description

§tor-protover

Implementation of Tor’s “subprotocol versioning” feature.

§Overview

The Tor system is built out of numerous “subprotocols” that are versioned more or less independently. The tor-protover crate implements parsing and handling for these subprotocol versions, so that different Tor instances know which parts of the protocol they support.

Subprotocol versions are also used to determine which versions of the protocol are required to connect to the network (or just recommended).

For more details, see tor-spec.txt section 9.

This crate is part of Arti, a project to implement Tor in Rust. It’s unlikely to be of general interest unless you are writing a Tor implementation, or a program that needs to examine fine-grained details of the Tor network.

§Design notes

We’re giving tor-protover its own crate within arti because it needs to be used to multiple higher level crates that do not themselves depend on one another. (For example, tor-proto needs to know which variant of a subprotocol can be used with a given relay, whereas tor-netdoc needs to parse lists of subprotocol versions from directory documents. Eventually, arti-client will need to check its own list of supported protocols against the required list in the consensus.)

License: MIT OR Apache-2.0

Re-exports§

pub(crate) use tor_basic_utils::intern::GloballyInternable as _; 🔒
pub(crate) use tor_basic_utils::intern::Intern; 🔒
pub(crate) use caret::caret_int; 🔒
pub(crate) use derive_deftly::Deftly; 🔒
pub(crate) use itertools::chain; 🔒
pub(crate) use itertools::chain; 🔒
pub(crate) use std::borrow::Cow; 🔒
pub(crate) use std::collections::BTreeMap; 🔒
pub(crate) use thiserror::Error; 🔒
pub(crate) use Intern; 🔒
pub use value::*;

Modules§

doc_changing
Documentation about changing lists of supported versions.
doc_supported
Documentation: when is a protocol “supported”?
named
Define protocol versions by name.
value
Value, the numerical part of a protocol capability

Macros§

subprotocol_restricted_set
Define a restricted set of subprotocol versions.

Structs§

NamedSubver
A specific, named subversion of a protocol.
NumberedSubver
A subprotocol capability as represented by a (kind, version) tuple.
ProtoKind
A subprotocol.
Protocol
A single recognized or unrecognized protocol.
Protocols
A set of supported or required subprotocol versions.
ProtocolsInner 🔒
Inner representation of Protocols.
SubprotocolEntry 🔒
Representation of a set of versions supported by a protocol.

Enums§

ParseError
An error representing a failure to parse a set of protocol versions.
ParseStrictness 🔒
A degree of strictness with which to parse a Protocols (or one of its components).
ProtocolInner 🔒
Representation for a known or unknown protocol.

Constants§

N_RECOGNIZED 🔒
How many recognized protocols are there?

Functions§

bitrange 🔒
Helper: return a new u64 in which bits lo through hi inclusive are set to 1, and all the other bits are set to 0.
dumpmask 🔒
Given a bitmask, return a list of the bits set in the mask, as a String in the format expected by Tor consensus documents.
is_good_number 🔒
Helper: return true if the provided string is a valid “integer” in the form accepted by the protover spec. This may be stricter than rust’s integer parsing format.
is_valid_proto_name 🔒
Return true if s is a valid protocol name.
parse_version_mask 🔒
Parse a version-list in versions into a bitmask.