pub struct Peer {
pub record: ServiceRecord,
pub posture: Posture,
pub fp: Option<String>,
pub cn: Option<String>,
pub expires_at: Option<DateTime<Utc>>,
}Expand description
A discovered peer enriched with its advertised trust state (ADR-020 §8).
Built from a ServiceRecord via Peer::from_record; the trust fields are
parsed from the record’s TXT map. All trust fields are hints — see the module
docs.
Fields§
§record: ServiceRecordThe underlying mDNS service record (name, type, host/ip, port, full TXT).
posture: PostureThe peer’s advertised posture (a hint; verify adjudicates).
fp: Option<String>The CA fingerprint the peer anchors to (fp=), if advertised.
cn: Option<String>The peer’s identity CN (cn=), if it chose to advertise one. The trusted
CN comes from verify/mTLS, not this field.
expires_at: Option<DateTime<Utc>>When the peer’s identity expires (expires=, absolute), if advertised.
Implementations§
Source§impl Peer
impl Peer
Sourcepub fn from_record(record: ServiceRecord) -> Peer
pub fn from_record(record: ServiceRecord) -> Peer
Build a typed peer from a discovered ServiceRecord, parsing the trust
hints from its TXT map.
Posture resolution: an explicit posture= wins; otherwise a record that
carries a CA fingerprint (fp=) is treated as authenticated (a node only
advertises an anchor it holds an identity for); otherwise open.
Sourcepub fn level(&self) -> PostureLevel
pub fn level(&self) -> PostureLevel
The peer’s named posture level (Open / Authenticated / Confidential).
Sourcepub fn is_secure(&self) -> bool
pub fn is_secure(&self) -> bool
Whether the peer advertises a usable cryptographic identity (signed).
Sourcepub fn addr(&self) -> Option<(String, u16)>
pub fn addr(&self) -> Option<(String, u16)>
The peer’s dialable (host, port): its IP if known, else its hostname,
paired with its advertised port. None if either is missing.
Sourcepub fn expires_in(&self, now: DateTime<Utc>) -> Option<TimeDelta>
pub fn expires_in(&self, now: DateTime<Utc>) -> Option<TimeDelta>
Time remaining until the peer’s identity expires, computed against now.
Negative once expired. None if the peer advertised no expiry.
Takes now explicitly so callers control the clock (and tests stay
deterministic); for the wall clock pass chrono::Utc::now().
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Peer
impl<'de> Deserialize<'de> for Peer
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Peer, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Peer, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for Peer
impl Serialize for Peer
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for Peer
Auto Trait Implementations§
impl Freeze for Peer
impl RefUnwindSafe for Peer
impl Send for Peer
impl Sync for Peer
impl Unpin for Peer
impl UnsafeUnpin for Peer
impl UnwindSafe for Peer
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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