pub struct Iroh {
pub(crate) endpoint: Endpoint,
pub(crate) gossip: Gossip,
pub(crate) sequence_numbers: Mutex<HashMap<TopicId, i32>>,
pub(crate) iroh_channels: RwLock<HashMap<TopicId, ChannelState>>,
pub(crate) public_key: PublicKey,
}
Expand description
Store iroh peer channels for the context.
Fields§
§endpoint: Endpoint
[Endpoint] needed for iroh peer channels.
gossip: Gossip
[Gossip] needed for iroh peer channels.
sequence_numbers: Mutex<HashMap<TopicId, i32>>
Sequence numbers for gossip channels.
iroh_channels: RwLock<HashMap<TopicId, ChannelState>>
Topics for which an advertisement has already been sent.
public_key: PublicKey
Currently used Iroh public key.
This is attached to every message to work around iroh_gossip
deduplication.
Implementations§
source§impl Iroh
impl Iroh
sourcepub(crate) async fn network_change(&self)
pub(crate) async fn network_change(&self)
Notify the endpoint that the network has changed.
sourceasync fn join_and_subscribe_gossip(
&self,
ctx: &Context,
msg_id: MsgId,
) -> Result<Option<Receiver<()>>>
async fn join_and_subscribe_gossip( &self, ctx: &Context, msg_id: MsgId, ) -> Result<Option<Receiver<()>>>
Join a topic and create the subscriber loop for it.
If there is no gossip, create it.
The returned future resolves when the swarm becomes operational.
sourcepub async fn maybe_add_gossip_peers(
&self,
topic: TopicId,
peers: Vec<NodeAddr>,
) -> Result<()>
pub async fn maybe_add_gossip_peers( &self, topic: TopicId, peers: Vec<NodeAddr>, ) -> Result<()>
Add gossip peers to realtime channel if it is already active.
sourcepub async fn send_webxdc_realtime_data(
&self,
ctx: &Context,
msg_id: MsgId,
data: Vec<u8>,
) -> Result<()>
pub async fn send_webxdc_realtime_data( &self, ctx: &Context, msg_id: MsgId, data: Vec<u8>, ) -> Result<()>
Send realtime data to the gossip swarm.
fn get_and_incr(&self, topic: &TopicId) -> i32
sourcepub(crate) async fn get_node_addr(&self) -> Result<NodeAddr>
pub(crate) async fn get_node_addr(&self) -> Result<NodeAddr>
Get the iroh [NodeAddr] without direct IP addresses.
sourcepub(crate) async fn leave_realtime(&self, topic: TopicId) -> Result<()>
pub(crate) async fn leave_realtime(&self, topic: TopicId) -> Result<()>
Leave the realtime channel for a given topic.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Iroh
impl !RefUnwindSafe for Iroh
impl Send for Iroh
impl Sync for Iroh
impl Unpin for Iroh
impl !UnwindSafe for Iroh
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§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
Mutably borrows from an owned value. Read more