Skip to content

Commit e3759a6

Browse files
ramfoxKasey Huizingadivagant-martianflub
authored
feat(iroh-net)!: add subscribe method to Discovery trait (#2656)
## Description Adds a `subscribe` method to the `Discovery` trait that returns an `Option<BoxStream>`. The `subscribe` method will send `DiscoveryItems` each time the discovery service discovers a remote node. The magicsock is now subscribed to the discovery service and updates the internal address book each time it receives a `DiscoveryItem`. The source is marked as `Source::Discovery{ service: String }` and the `Instant` that the magicsock received the information. Users can now filter their list of `RemoteInfo`s for sources. ## Breaking Changes - struct `RemoteInfo` now has field `sources`, which is a `Vec` of `(iroh::net::endpoint::Source, Duration)`. The `Source` is how we heard about the remote, and the `Duration` is how long ago we heard about it. The `sources` field is ordered from the first time we heard about the remote node to the most recent time we learned about the remote node, in this session. ## Change checklist - [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. --------- Co-authored-by: Kasey Huizinga <ramfox@Kaseys-MBP.lan> Co-authored-by: Divma <26765164+divagant-martian@users.noreply.github.com> Co-authored-by: Floris Bruynooghe <flub@n0.computer>
1 parent 43dd3d6 commit e3759a6

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Cargo.lock

Lines changed: 9 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)