use crate::Ingress; use commonware_cryptography::PublicKey; /// Metadata for a peer connection. #[derive(Clone, Debug)] pub enum Metadata { /// We are the Dialer. /// /// Contains: /// - The public key of the peer. /// - The ingress address of the peer. Dialer(P, Ingress), /// We are the Listener. /// /// Contains: /// - The public key of the peer. Listener(P), } impl Metadata

{ /// Get the public key of the peer associated with this metadata. pub const fn public_key(&self) -> &P { match self { Self::Dialer(public_key, _) => public_key, Self::Listener(public_key) => public_key, } } }