Share events with own family by default, instead of all known peers. Relates to #5

This commit is contained in:
Philip (a-0) 2024-02-13 16:34:53 +01:00
parent 6581c3b9c6
commit 4381cc82cb
5 changed files with 121 additions and 24 deletions

View file

@ -1,4 +1,4 @@
use anyhow::bail;
use anyhow::{anyhow, bail};
use i2p::net::{I2pAddr, I2pSocketAddr, ToI2pSocketAddrs};
use serde::{Deserialize, Serialize};
@ -11,6 +11,12 @@ impl PeerId {
pub fn addr(&self) -> I2pSocketAddr {
self.i2p_addr.to_owned()
}
pub fn addr_ref(&self) -> &I2pSocketAddr {
&self.i2p_addr
}
pub fn b32_addr(&self) -> anyhow::Result<I2pAddr> {
I2pAddr::from_b64(&self.i2p_addr.dest().string()).map_err(|e| anyhow!(e))
}
}
impl ToString for PeerId {