Remove the unused `published` field from GenericRouterStatus.
This field isn't used in modern Tor, and has never been used in Arti. If tor!489 is merged, then it will no longer contain a useful value in future consensuses. We shouldn't store it, or else somebody else will get the smart idea of using it for something. This commit breaks API compatibility for tor-netdoc with the `build_docs` feature enabled. I haven't entered that into the semver_status.md file, since we already have a pending tor-netdoc API breaker in !129.
This commit is contained in:
parent
e422d9f82f
commit
69bb6313fd
|
@ -432,7 +432,6 @@ mod test {
|
|||
.rs()
|
||||
.nickname("Fred".into())
|
||||
.identity([155; 20].into())
|
||||
.published(now - one_hour * 6)
|
||||
.add_or_port(SocketAddr::from(([10, 0, 0, 60], 9100)))
|
||||
.add_or_port("[f00f::1]:9200".parse().unwrap())
|
||||
.dir_port(66)
|
||||
|
|
|
@ -63,13 +63,6 @@ struct GenericRouterStatus<D> {
|
|||
nickname: String,
|
||||
/// Fingerprint of the old-style RSA identity for this relay.
|
||||
identity: RsaIdentity,
|
||||
/// Declared time at which the router descriptor for this relay
|
||||
/// was published.
|
||||
///
|
||||
/// This value should be ignored for all purposes; see
|
||||
/// [proposal 275](https://gitlab.torproject.org/tpo/core/torspec/-/blob/master/proposals/275-md-published-time-is-silly.txt).
|
||||
#[allow(dead_code)] // TODO: remove this some day?
|
||||
published: time::SystemTime,
|
||||
/// A list of address:port values where this relay can be reached.
|
||||
addrs: Vec<net::SocketAddr>,
|
||||
/// Declared OR port for this relay.
|
||||
|
@ -266,7 +259,9 @@ where
|
|||
let identity = RsaIdentity::from_bytes(ident.as_bytes())
|
||||
.ok_or_else(|| Error::BadArgument(r_item.pos(), "Wrong identity length".to_string()))?;
|
||||
let skip = if microdesc_format { 0 } else { 1 };
|
||||
let published: time::SystemTime = {
|
||||
// We check that the published time is well-formed, but we never use it
|
||||
// for anything in a consensus document.
|
||||
let _ignore_published: time::SystemTime = {
|
||||
// TODO: It's annoying to have to do this allocation, since we
|
||||
// already have a slice that contains both of these arguments.
|
||||
// Instead, we could get a slice of arguments: we'd have to add
|
||||
|
@ -326,7 +321,6 @@ where
|
|||
Ok(GenericRouterStatus {
|
||||
nickname,
|
||||
identity,
|
||||
published,
|
||||
addrs,
|
||||
or_port,
|
||||
dir_port,
|
||||
|
|
|
@ -9,7 +9,6 @@ use tor_llcrypto::pk::rsa::RsaIdentity;
|
|||
use tor_protover::Protocols;
|
||||
|
||||
use std::net::SocketAddr;
|
||||
use std::time::SystemTime;
|
||||
|
||||
/// A Builder object for creating a RouterStatus and adding it to a
|
||||
/// consensus.
|
||||
|
@ -19,8 +18,6 @@ pub struct RouterStatusBuilder<D> {
|
|||
nickname: Option<String>,
|
||||
/// See [`GenericRouterStatus::identity`].
|
||||
identity: Option<RsaIdentity>,
|
||||
/// See [`GenericRouterStatus::published`].
|
||||
published: Option<SystemTime>,
|
||||
/// See [`GenericRouterStatus::addrs`].
|
||||
addrs: Vec<SocketAddr>,
|
||||
/// See [`GenericRouterStatus::dir_port`].
|
||||
|
@ -43,7 +40,6 @@ impl<D: Clone> RouterStatusBuilder<D> {
|
|||
RouterStatusBuilder {
|
||||
nickname: None,
|
||||
identity: None,
|
||||
published: None,
|
||||
addrs: Vec::new(),
|
||||
dir_port: 0,
|
||||
doc_digest: None,
|
||||
|
@ -71,13 +67,6 @@ impl<D: Clone> RouterStatusBuilder<D> {
|
|||
self.identity = Some(identity);
|
||||
self
|
||||
}
|
||||
/// Set the publication time for this routerstatus.
|
||||
///
|
||||
/// This value is optional, and does nothing (TODO).
|
||||
pub fn published(&mut self, published: SystemTime) -> &mut Self {
|
||||
self.published = Some(published);
|
||||
self
|
||||
}
|
||||
/// Add an OrPort at `addr` to this routerstatus.
|
||||
///
|
||||
/// At least one value here is required.
|
||||
|
@ -138,7 +127,6 @@ impl<D: Clone> RouterStatusBuilder<D> {
|
|||
let identity = self
|
||||
.identity
|
||||
.ok_or(Error::CannotBuild("Missing RSA identity"))?;
|
||||
let published = self.published.unwrap_or_else(SystemTime::now);
|
||||
if self.addrs.is_empty() {
|
||||
return Err(Error::CannotBuild("No addresses"));
|
||||
}
|
||||
|
@ -158,7 +146,6 @@ impl<D: Clone> RouterStatusBuilder<D> {
|
|||
Ok(GenericRouterStatus {
|
||||
nickname,
|
||||
identity,
|
||||
published,
|
||||
addrs: self.addrs.clone(),
|
||||
or_port,
|
||||
dir_port: self.dir_port,
|
||||
|
|
Loading…
Reference in New Issue