refactor(iroh-gossip): make use of Endpoint::direct_addresses in iroh_gossip::net #2731
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
iroh_gossip::net::Gossip
had a method to update the direct addresses of the iroh_net::Endpoint. IIRC that dates back when the Endpoint only exposed a single, non-cloneable stream of endpoint events, which was handled in the iroh Node and thus had to be forwarded to consumers like Gossip. This was long ago and by now the Endpoint provides a capable API for this. Therefore there is no need to expose this as a method (because Gossip always contains an Endpoint).Breaking Changes
Gossip::update_direct_addresses
is removed. Updating the direct addresses is now handled byGossip
automatically.Notes & open questions
To react to all updates to the endpoint's
NodeAddr
, I am watching bothEndpoint::direct_addresses
andEndpoint::watch_home_relay
. A simpler API for this usecase would beEndpoint::watch_node_addr
.Change checklist