#[non_exhaustive]pub enum RelayId {
Ed25519(Ed25519Identity),
Rsa(RsaIdentity),
}Expand description
A single relay identity.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Ed25519(Ed25519Identity)
An Ed25519 identity.
Every relay (currently) has one of these identities. It is the same as the encoding of the relay’s public Ed25519 identity key.
Rsa(RsaIdentity)
An RSA identity.
Every relay (currently) has one of these identities. It is computed as a SHA-1 digest of the DER encoding of the relay’s public RSA 1024-bit identity key. Because of short key length, this type of identity should not be considered secure on its own.
Implementations§
Source§impl RelayId
impl RelayId
Sourcepub fn as_ref(&self) -> RelayIdRef<'_>
pub fn as_ref(&self) -> RelayIdRef<'_>
Return a RelayIdRef pointing to the contents of this identity.
Sourcepub fn from_type_and_bytes(
id_type: RelayIdType,
id: &[u8],
) -> Result<Self, RelayIdError>
pub fn from_type_and_bytes( id_type: RelayIdType, id: &[u8], ) -> Result<Self, RelayIdError>
Try to construct a RelayId of a provided id_type from a byte-slice.
Return RelayIdError::BadLength if the slice is not the correct length for the key.
Sourcepub fn id_type(&self) -> RelayIdType
pub fn id_type(&self) -> RelayIdType
Return the type of this relay identity.
Trait Implementations§
impl Copy for RelayId
Source§impl<'de> Deserialize<'de> for RelayId
impl<'de> Deserialize<'de> for RelayId
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
impl Eq for RelayId
Source§impl<'a> From<&'a RelayId> for RelayIdRef<'a>
impl<'a> From<&'a RelayId> for RelayIdRef<'a>
Source§impl From<Ed25519Identity> for RelayId
impl From<Ed25519Identity> for RelayId
Source§fn from(value: Ed25519Identity) -> Self
fn from(value: Ed25519Identity) -> Self
Source§impl From<RsaIdentity> for RelayId
impl From<RsaIdentity> for RelayId
Source§fn from(value: RsaIdentity) -> Self
fn from(value: RsaIdentity) -> Self
Source§impl FromIterator<RelayId> for RelayIdSet
impl FromIterator<RelayId> for RelayIdSet
Source§impl FromStr for RelayId
impl FromStr for RelayId
Source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Try to parse s as a RelayId.
We use the following format, based on the one used by C tor.
- An optional
$followed by a 40 byte hex string is always an RSA key. - A 43 character un-padded base-64 string is always an Ed25519 key.
- The name of an algorithm (“rsa” or “ed25519”), followed by a colon and and an un-padded base-64 string is a key of that type.
Source§type Err = RelayIdError
type Err = RelayIdError
Source§impl Ord for RelayId
impl Ord for RelayId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq<Ed25519Identity> for RelayId
impl PartialEq<Ed25519Identity> for RelayId
Source§impl PartialEq<RsaIdentity> for RelayId
impl PartialEq<RsaIdentity> for RelayId
Source§impl PartialOrd for RelayId
impl PartialOrd for RelayId
Source§impl Redactable for RelayId
impl Redactable for RelayId
Source§fn display_redacted(&self, f: &mut Formatter<'_>) -> Result
fn display_redacted(&self, f: &mut Formatter<'_>) -> Result
Display::fmt, but produce a redacted representation.Source§fn debug_redacted(&self, f: &mut Formatter<'_>) -> Result
fn debug_redacted(&self, f: &mut Formatter<'_>) -> Result
Debug::fmt, but produce a redacted representation.Source§fn redacted(&self) -> Redacted<&Self>
fn redacted(&self) -> Redacted<&Self>
Source§fn maybe_redacted(&self, redact: bool) -> MaybeRedacted<&Self>
fn maybe_redacted(&self, redact: bool) -> MaybeRedacted<&Self>
redact is true.impl StructuralPartialEq for RelayId
Auto Trait Implementations§
impl Freeze for RelayId
impl RefUnwindSafe for RelayId
impl Send for RelayId
impl Sync for RelayId
impl Unpin for RelayId
impl UnsafeUnpin for RelayId
impl UnwindSafe for RelayId
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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