Skip to main content

RelayFlag

Enum RelayFlag 

Source
#[non_exhaustive]
pub enum RelayFlag {
Show 13 variants Authority, BadExit, Exit, Fast, Guard, HSDir, MiddleOnly, NoEdConsensus, Stable, StaleDesc, Running, Valid, V2Dir,
}
Expand description

Router status flags - one recognized directory flag on a single relay.

https://spec.torproject.org/dir-spec/consensus-formats.html#item:s

These flags come from a consensus directory document, and are used to describe what the authorities believe about the relay. If the document contained any flags that we didn’t recognize, they are not listed in this type.

TODO SPEC: Make the terminology the same everywhere.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Authority

Is this a directory authority?

§

BadExit

Is this relay marked as a bad exit?

Bad exits can be used as intermediate relays, but not to deliver traffic.

§

Exit

Is this relay marked as an exit for weighting purposes?

§

Fast

Is this relay considered “fast” above a certain threshold?

§

Guard

Is this relay suitable for use as a guard relay?

Clients choose their their initial relays from among the set of Guard relays.

§

HSDir

Does this relay participate on the onion service directory ring?

§

MiddleOnly

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.

§

NoEdConsensus

If set, there is no consensus for the ed25519 key for this relay.

§

Stable

Is this relay considered “stable” enough for long-lived circuits?

§

StaleDesc

Set if the authorities are requesting a fresh descriptor for this relay.

§

Running

Set if this relay is currently running.

This flag can appear in votes, but in consensuses, every relay is assumed to be running.

§

Valid

Set if this relay is considered “valid” – allowed to be on the network.

This flag can appear in votes, but in consensuses, every relay is assumed to be valid.

§

V2Dir

Set if this relay supports a currently recognized version of the directory protocol.

Trait Implementations§

Source§

impl<O: Into<EnumSet<RelayFlag>>> BitAnd<O> for RelayFlag

Source§

type Output = EnumSet<RelayFlag>

The resulting type after applying the & operator.
Source§

fn bitand(self, other: O) -> Self::Output

Performs the & operation. Read more
Source§

impl<O: Into<EnumSet<RelayFlag>>> BitOr<O> for RelayFlag

Source§

type Output = EnumSet<RelayFlag>

The resulting type after applying the | operator.
Source§

fn bitor(self, other: O) -> Self::Output

Performs the | operation. Read more
Source§

impl<O: Into<EnumSet<RelayFlag>>> BitXor<O> for RelayFlag

Source§

type Output = EnumSet<RelayFlag>

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, other: O) -> Self::Output

Performs the ^ operation. Read more
Source§

impl Clone for RelayFlag

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RelayFlag

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for RelayFlag

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl EnumSetConstHelper for RelayFlag

Source§

const CONST_INIT_HELPER: __EnumSetInitHelper = __EnumSetInitHelper

The instance of the ConstInitHelper.
Source§

const CONST_OP_HELPER: __EnumSetOpHelper = __EnumSetOpHelper

The instance of the ConstOpHelper.
Source§

type ConstInitHelper = __EnumSetInitHelper

A helper type used to convert values to EnumSets at compile-time.
Source§

type ConstOpHelper = __EnumSetOpHelper

A helper type used to implement compile-time operations on enums.
Source§

impl EnumSetTypePrivate for RelayFlag

Source§

const ALL_BITS: Self::Repr = 8191

A mask of bits that are valid in the bitset.
Source§

const BIT_WIDTH: u32 = 13u32

The largest bit used in the bitset.
Source§

const VARIANT_COUNT: u32 = 13u32

The number of variants in the bitset.
Source§

type Repr = u16

The underlying type used to store the bitset.
Source§

fn enum_into_u32(self) -> u32

Converts an enum of this type into its bit position.
Source§

unsafe fn enum_from_u32(val: u32) -> Self

Converts a bit position into an enum value.
Source§

unsafe fn enum_from_u32_checked(val: u32) -> Self

Converts a bit position into an enum value, with an debug_assert.
Source§

impl EnumSetTypeWithRepr for RelayFlag

Source§

type Repr = u16

The guaranteed representation.
Source§

impl<'_derivative_strum> From<&'_derivative_strum RelayFlag> for &'static str

Source§

fn from(x: &'_derivative_strum RelayFlag) -> &'static str

Converts to this type from the input type.
Source§

impl From<RelayFlag> for &'static str

Source§

fn from(x: RelayFlag) -> &'static str

Converts to this type from the input type.
Source§

impl FromStr for RelayFlag

Source§

type Err = ParseError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<RelayFlag, <Self as FromStr>::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Not for RelayFlag

Source§

type Output = EnumSet<RelayFlag>

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl PartialEq<EnumSet<RelayFlag>> for RelayFlag

Source§

fn eq(&self, other: &EnumSet<RelayFlag>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for RelayFlag

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<O: Into<EnumSet<RelayFlag>>> Sub<O> for RelayFlag

Source§

type Output = EnumSet<RelayFlag>

The resulting type after applying the - operator.
Source§

fn sub(self, other: O) -> Self::Output

Performs the - operation. Read more
Source§

impl TryFrom<&str> for RelayFlag

Source§

type Error = ParseError

The type returned in the event of a conversion error.
Source§

fn try_from(s: &str) -> Result<RelayFlag, <Self as TryFrom<&str>>::Error>

Performs the conversion.
Source§

impl Copy for RelayFlag

Source§

impl EnumSetType for RelayFlag

Source§

impl Eq for RelayFlag

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Sync + Send>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DynClone for T
where T: Clone,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> PossiblyOption<T> for T

Source§

fn to_option(self) -> Option<T>

Convert this object into an Option<T>
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more