#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Peer {
pub ip: String,
pub hostname: String,
pub endpoint_id: String,
pub tags: Vec<String>,
}
impl Peer {
pub(crate) fn from_peer_info(p: &tunnet_core::PeerInfo) -> Self {
Self {
ip: p.ip.to_string(),
hostname: p.hostname.clone(),
endpoint_id: p.endpoint_hex.clone(),
tags: p.tags.clone(),
}
}
pub(crate) fn from_peer_lite(p: tunnet_core::coordinator::PeerLite) -> Self {
Self {
ip: p.ip,
hostname: p.hostname,
endpoint_id: p.endpoint_id,
tags: p.tags,
}
}
pub(crate) fn from_endpoint_hex(endpoint_id: String) -> Self {
Self {
ip: String::new(),
hostname: String::new(),
endpoint_id,
tags: Vec::new(),
}
}
}