Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(iroh_net)!: Remove Endpoint::my_addr_with_endpoints #2359

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion iroh-gossip/src/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,11 @@ impl Actor {
new_endpoints = self.on_endpoints_rx.recv() => {
match new_endpoints {
Some(endpoints) => {
let addr = self.endpoint.my_addr_with_endpoints(endpoints)?;
let addr = NodeAddr::from_parts(
self.endpoint.node_id(),
self.endpoint.my_relay(),
endpoints.into_iter().map(|x| x.addr).collect(),
);
let peer_data = encode_peer_data(&addr.info)?;
self.handle_in_event(InEvent::UpdatePeerData(peer_data), Instant::now()).await?;
}
Expand Down
11 changes: 0 additions & 11 deletions iroh-net/src/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ use tracing::{debug, info_span, trace, warn};
use url::Url;

use crate::{
config,
defaults::default_relay_map,
discovery::{Discovery, DiscoveryTask},
dns::{default_resolver, DnsResolver},
Expand Down Expand Up @@ -580,16 +579,6 @@ impl Endpoint {
Ok(NodeAddr::from_parts(self.node_id(), relay, addrs))
}

/// Returns the [`NodeAddr`] for this endpoint with the provided endpoints.
///
/// Like [`Endpoint::my_addr`] but uses the provided IP endpoints rather than those from
/// [`Endpoint::local_endpoints`].
pub fn my_addr_with_endpoints(&self, eps: Vec<config::Endpoint>) -> Result<NodeAddr> {
let relay = self.my_relay();
let addrs = eps.into_iter().map(|x| x.addr).collect();
Ok(NodeAddr::from_parts(self.node_id(), relay, addrs))
}

/// Returns the [`RelayUrl`] of the Relay server used as home relay.
///
/// Every endpoint has a home Relay server which it chooses as the server with the
Expand Down
Loading