From 39857002168cfc206a6c136ac92cad4d10f3d255 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 17 Apr 2023 16:44:38 -0400 Subject: [PATCH] netdir: more documentation on MIDDLE_ONLY flag. Clarify that it isn't anything that most users will need to check. --- crates/tor-netdoc/src/doc/netstatus.rs | 4 ++++ crates/tor-netdoc/src/doc/netstatus/rs.rs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/crates/tor-netdoc/src/doc/netstatus.rs b/crates/tor-netdoc/src/doc/netstatus.rs index 577af5f6e..ad67069ea 100644 --- a/crates/tor-netdoc/src/doc/netstatus.rs +++ b/crates/tor-netdoc/src/doc/netstatus.rs @@ -467,6 +467,10 @@ bitflags! { const HSDIR = (1<<5); /// Set if this relay is considered "middle only", not suitable to run /// as an exit or guard relay. + /// + /// Note that this flag is only used by authorities as part of + /// the voting process; clients do not and should not act + /// based on whether it is set. const MIDDLE_ONLY = (1<<12); /// If set, there is no consensus for the ed25519 key for this relay. const NO_ED_CONSENSUS = (1<<6); diff --git a/crates/tor-netdoc/src/doc/netstatus/rs.rs b/crates/tor-netdoc/src/doc/netstatus/rs.rs index dfc7f159d..ad0e1f950 100644 --- a/crates/tor-netdoc/src/doc/netstatus/rs.rs +++ b/crates/tor-netdoc/src/doc/netstatus/rs.rs @@ -160,6 +160,10 @@ macro_rules! implement_accessors { self.rs.flags.contains(RelayFlags::HSDIR) } /// Return true if this routerstatus is listed with the MiddleOnly flag. + /// + /// Note that this flag is only used by authorities as part of + /// the voting process; clients do not and should not act + /// based on whether it is set. pub fn is_flagged_middle_only(&self) -> bool { self.rs.flags.contains(RelayFlags::MIDDLE_ONLY) }