You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Description
I'm working on a project where we want to have a list of peers that can
be connected to without actually establishing a connection to each of
them. The user can then later select a peer and we will establish a
connection to the ones that are required.
For this to work we need to be able to tell our frontend about the
available peers on the network. Right now Iroh emits events when peers
are discovered but it doesn't provide a mechanism to detect when those
peers are no longer online so they remain in the frontend UI until the
application is restarted.
This PR implements a system for Iroh's discovery system to emit events
when a peer is no-longer aviable. This is implemented into the core
discovery system, however the only discovery mechanism that currently
emits these are mDNS.
This PR solves #3040.
## Breaking Changes
All methods that previously retruned `DiscoveryItem` now return
`DiscoveryEvent`. This includes the `Discovery` trait,
`Endpoint::discovery_stream`, etc.
## Change checklist
<!-- Remove any that are not relevant. -->
- [x] Self-review.
- [x] Documentation updates following the [style
guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text),
if relevant.
- [x] Tests if relevant.
- [x] All breaking changes documented.
- [x] List all breaking changes in the above "Breaking Changes" section.
Copy file name to clipboardExpand all lines: iroh/examples/locally-discovered-nodes.rs
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@
5
5
//! This is an async, non-determinate process, so the number of NodeIDs discovered each time may be different. If you have other iroh endpoints or iroh nodes with [`MdnsDiscovery`] enabled, it may discover those nodes as well.
6
6
use std::time::Duration;
7
7
8
-
use iroh::{Endpoint,NodeId, node_info::UserData};
8
+
use iroh::{Endpoint,NodeId,discovery::DiscoveryEvent,node_info::UserData};
0 commit comments