tor_netdoc/doc/netstatus/each_variety.rs
1//! network status documents - items for all varieties, that vary
2//!
3//! **This file is reincluded multiple times**,
4//! by the macros in [`crate::doc::ns_variety_definition_macros`],
5//! once for votes, and once for each consensus flavour.
6//! It is *not* a module `crate::doc::netstatus::rs::each_variety`.
7//!
8//! Each time this file is included by one of the macros mentioned above,
9//! the `ns_***` macros (such as `ns_const_name!`) may expand to different values.
10//!
11//! See [`crate::doc::ns_variety_definition_macros`].
12
13use super::*;
14
15ns_use_this_variety! {
16 pub use [crate::doc::netstatus::rs]::?::{RouterStatus};
17}
18
19/// The header of a networkstatus.
20#[allow(dead_code)]
21#[cfg_attr(
22 feature = "dangerous-expose-struct-fields",
23 visible::StructFields(pub),
24 visibility::make(pub),
25 non_exhaustive
26)]
27#[derive(Debug, Clone)]
28pub(crate) struct Header {
29 /// What kind of consensus document is this? Absent in votes and
30 /// in ns-flavored consensuses.
31 #[cfg_attr(docsrs, doc(cfg(feature = "dangerous-expose-struct-fields")))]
32 pub(crate) flavor: ConsensusFlavor,
33 /// Over what time is this consensus valid? (For votes, this is
34 /// the time over which the voted-upon consensus should be valid.)
35 #[cfg_attr(docsrs, doc(cfg(feature = "dangerous-expose-struct-fields")))]
36 pub(crate) lifetime: Lifetime,
37 /// List of recommended Tor client versions.
38 #[cfg_attr(docsrs, doc(cfg(feature = "dangerous-expose-struct-fields")))]
39 pub(crate) client_versions: Vec<String>,
40 /// List of recommended Tor relay versions.
41 #[cfg_attr(docsrs, doc(cfg(feature = "dangerous-expose-struct-fields")))]
42 pub(crate) relay_versions: Vec<String>,
43 /// Lists of recommended and required subprotocols.
44 #[cfg_attr(docsrs, doc(cfg(feature = "dangerous-expose-struct-fields")))]
45 pub(crate) proto_statuses: Arc<ProtoStatuses>,
46 /// Declared parameters for tunable settings about how to the
47 /// network should operator. Some of these adjust timeouts and
48 /// whatnot; some features things on and off.
49 #[cfg_attr(docsrs, doc(cfg(feature = "dangerous-expose-struct-fields")))]
50 pub(crate) params: NetParams<i32>,
51 /// How long in seconds should voters wait for votes and
52 /// signatures (respectively) to propagate?
53 #[cfg_attr(docsrs, doc(cfg(feature = "dangerous-expose-struct-fields")))]
54 pub(crate) voting_delay: Option<(u32, u32)>,
55 /// What "method" was used to produce this consensus? (A
56 /// consensus method is a version number used by authorities to
57 /// upgrade the consensus algorithm.)
58 #[cfg_attr(docsrs, doc(cfg(feature = "dangerous-expose-struct-fields")))]
59 pub(crate) consensus_method: u32,
60 /// Global shared-random value for the previous shared-random period.
61 #[cfg_attr(docsrs, doc(cfg(feature = "dangerous-expose-struct-fields")))]
62 pub(crate) shared_rand_prev: Option<SharedRandStatus>,
63 /// Global shared-random value for the current shared-random period.
64 #[cfg_attr(docsrs, doc(cfg(feature = "dangerous-expose-struct-fields")))]
65 pub(crate) shared_rand_cur: Option<SharedRandStatus>,
66}