-
Notifications
You must be signed in to change notification settings - Fork 219
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!: move IpMappedAddresses
to DnsResolver
#3220
base: main
Are you sure you want to change the base?
Conversation
564f1c9
to
d0be662
Compare
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3220/docs/iroh/ Last updated: 2025-03-14T02:38:27Z |
I had a look at this initially, but it didn't really feel right for me to review this, as I mainly wonder why we'd be doing this? 😬 In my mind, the There are probably good reasons for doing this though! I just need to be made aware 😅 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens when the relay URL is http://127.0.0.1:1234
? I mean, when it directly contains an IP address? Could we have a test for that?
I can see the elegance of wrapping it into the resolver. But I agree that it feels a bit weird as well. Additionally the iroh-net-report
crate didn't have to reach the 1.0 stability guarantees, while it living in iroh-relay
changes that completely and now this IP mapped address stuff lives in a place where we'll need to give it API stability. Which I don't like.
It's also tricky because... maybe it'll go away with multipath. I think we might end up in a world where all the IP addresses that Quinn sees are directly the real IP addresses and only the relay paths would be mapped addresses. I don't yet know exactly how this will look, but something like that.
timeout: Duration, | ||
delays_ms: &[u64], | ||
port: u16, | ||
) -> Result<SocketAddr> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mention these two points in the notes of the PR:
- For name I think "relay" doesn't say anything. Maybe
lookup_node_ipv4_and_map
would be better. - Definitely return an
IpMappedAddr
instead of aSocketAddr
.
d0be662
to
6ed071a
Compare
Description
In order to facilitate QUIC address discovery inside of
iroh
, we needed a way to map resolved URLs to anIpMappedAddr
. Previously, we did that by passing in an optionalIpMappedAddresses
struct into theiroh-net-report
.Now that we have an
iroh
DnsResolver
, we can do the mapping inside ofDnsResolver
, when we know we are resolving a URL that needs mapping.IpMappedAddr
,IpMappedAddresses
, etc, have been moved fromiroh-net-report
toiroh-relay
where theDnsResolver
is defined.DnsResolver
has an optionalIpMappedAddresses
field.Now, when
iroh-net-report
resolves a relay-url that we know will be used in QAD, we call the newDnsResolver::lookup_relay_node_ipv4
andDnsResolver::lookup_relay_node_ipv6
, and it will return the associated socket address for theIpMappedAddr
.Breaking Changes
iroh-net-report
iroh-net-report::Client::new
no longer contains themapped_addrs
parameterNotes & open questions
Small PR, but questions around naming.
Should
DnsResolver::lookup_relay_node_ipvX
be more explicit?DnsResolver::lookup_relay_node_ipvX_mapped
? Should it return aIpMappedAddr
instead of aSocketAddr
to be more explicit?Not sure, from a user perspective, what the cleanest/least confusing API would be.
Change checklist
iroh-doctor