#[non_exhaustive]pub enum PeerIdentity {
Network(SocketAddr),
Local(LocalPeer),
Unknown,
}Expand description
Who is on the other end of a connection.
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.
Network(SocketAddr)
A TCP/TLS network peer — the pre-2.0 behaviour.
Local(LocalPeer)
A same-machine peer reached over a local transport.
Unknown
Transport could not determine a peer (in-process tests, exotic transports).
Implementations§
Source§impl PeerIdentity
impl PeerIdentity
Sourcepub fn ip_addr(&self) -> IpAddr
pub fn ip_addr(&self) -> IpAddr
Best-effort IP for logging and for the pre-2.0 ip_addr field.
Local and unknown peers report loopback — they have no IP, and loopback is both truthful about locality and safe for code that only formats this value.
Sourcepub fn socket_addr(&self) -> SocketAddr
pub fn socket_addr(&self) -> SocketAddr
The socket address for network peers; a loopback placeholder otherwise.
Provided for the deprecated WsConnection::address accessor. Prefer matching
on the enum.
Sourcepub fn attestation(&self) -> Option<&Attestation>
pub fn attestation(&self) -> Option<&Attestation>
Attestation for local peers; None for network peers (TLS client certs are
not modelled here).
Trait Implementations§
Source§impl Clone for PeerIdentity
impl Clone for PeerIdentity
Source§fn clone(&self) -> PeerIdentity
fn clone(&self) -> PeerIdentity
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PeerIdentity
impl Debug for PeerIdentity
Source§impl Display for PeerIdentity
impl Display for PeerIdentity
Source§impl From<SocketAddr> for PeerIdentity
impl From<SocketAddr> for PeerIdentity
Source§fn from(addr: SocketAddr) -> Self
fn from(addr: SocketAddr) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for PeerIdentity
impl RefUnwindSafe for PeerIdentity
impl Send for PeerIdentity
impl Sync for PeerIdentity
impl Unpin for PeerIdentity
impl UnsafeUnpin for PeerIdentity
impl UnwindSafe for PeerIdentity
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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>
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 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>
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 moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.