Skip to content

Conversation

@Frando
Copy link
Member

@Frando Frando commented Dec 9, 2025

Description

Adds Endpoint::remote_info which returns Option<RemoteInfo>. The RemoteInfo exposes an iterator over all transport addrs for this remote that we know about.

Fixes #3521

Breaking Changes

Notes & open questions

This basically copies the RemotePathInfo from the RemoteStateActor into a new struct RemoteInfo. So, this an async fn over the channel to the RemoteStateActor, and allocates. As this is a rather niche API, I think that's fine.

I wasn't entirely sure how much info we want to expose. Right now, the PR only includes the latest Source for the address, as I wasn't sure if we really want or need to expose the full list of sources.

Change checklist

  • Self-review.
  • Documentation updates following the style guide, if relevant.
  • Tests if relevant.
  • All breaking changes documented.
    • List all breaking changes in the above "Breaking Changes" section.
    • Open an issue or PR on any number0 repos that are affected by this breaking change. Give guidance on how the updates should be handled or do the actual updates themselves. The major ones are:

@github-actions
Copy link

github-actions bot commented Dec 9, 2025

Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3752/docs/iroh/

Last updated: 2025-12-10T12:26:50Z

use tracing::{debug, instrument, trace, warn};
use url::Url;

use self::hooks::EndpointHooksList;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The import ordering was off, and when I changed a line, cargo make format picked it up again. The only actual change here is that I added the re-exports from the new remote_info module.

@Frando Frando marked this pull request as ready for review December 9, 2025 15:38
@Frando Frando force-pushed the Frando/remote-addrs branch 2 times, most recently from 91b4756 to 4449690 Compare December 9, 2025 15:45
Copy link
Contributor

@dignifiedquire dignifiedquire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given how easy it is to implement this, and how useful this is for users, I would say, lets do this

&self.msock.metrics
}

/// Returns addressing information about a recently used remote endpoint.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe mention that this is a snapshot in time, or sth, to indicate that this can have already changed by the moment it is used

@n0bot n0bot bot added this to iroh Dec 9, 2025
@github-project-automation github-project-automation bot moved this to 🏗 In progress in iroh Dec 9, 2025
@Frando Frando force-pushed the Frando/remote-addrs branch from 93612f5 to 299d985 Compare December 10, 2025 12:17
Copy link
Contributor

@flub flub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As usual I'm anxious about creating any API surface and am arguing to make it smaller 😁 😅 😰

metrics,
}
}
pub(super) fn to_remote_addrs(&self) -> Vec<TransportAddrInfo> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing blank line? (how does rustfmt not handle this?)


use crate::endpoint::Source;

/// Information about a remote endpoint.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was already mentioned, but this should explain that this is a snapshot at the time it was created.

/// The address was used, but is not currently.
Inactive {
/// Time when this address was last used.
last_used: Instant,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is still problematic? I was hopeing to keep postponing having to figure this out to be fair.

last_used: Instant,
},
/// We tried to use this address, but failed.
Unusable,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not comfortable exposing this to be fair. It forces us to keep this status around and I don't think I want to do that.

I think for now I'm at most comfortable with exposing two items on this enum:

  • Active
  • Inactive

No timestamps, nothing else.

Comment on lines +78 to +80
pub fn most_recent_source(&self) -> &Source {
&self.most_recent_source
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also not comfortable exposing this yet. Source is a number of states that I don't know we'll always want to keep and want to keep around as such. Also, there is not a single source for an addr, certainly not the way it is used currently. Which makes this messy and indicates that it's not a great thing to expose.

Source is public right now, but only because of discovery methods. I had an issue originally to figure something out about that. This was solved in 50fdda3 in a way that seemed to solve the immediate issue. But I do now think it was probably the wrong approach, given the variants on that enum. I don't think this is suitable for a 1.0 API.

.expect("poisoned")
.get(&eid)
.and_then(|handle| handle.sender.get())
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think this is wroth having? The actor would be started and shut down again. I guess that's not ideal. I'm just sad whenever there are two functions like this, one that creates-on-demand and one that returns an Option. I can live with it I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🏗 In progress

Development

Successfully merging this pull request may close these issues.

4 participants