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) -> Self
pub fn from_record(record: ServiceRecord) -> Self
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<Duration>
pub fn expires_in(&self, now: DateTime<Utc>) -> Option<Duration>
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().