Conversation
we use mainline directly for the optional address-lookup-pkarr-dht feature.
And some more simplifications
|
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/4026/docs/iroh/ Last updated: 2026-04-14T11:55:04Z |
d4fbe07 to
6929e64
Compare
This allows us to not depend on iroh-relay in iroh-dns-server
## Description This allows us to not depend on iroh-relay in iroh-dns-server ## Breaking Changes <!-- Optional, if there are any breaking changes document them, including how to migrate older code. --> ## Notes & open questions <!-- Any notes, remarks or open questions you have to make about the PR. --> ## Change checklist <!-- Remove any that are not relevant. --> - [ ] Self-review. - [ ] 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. - [ ] 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: - [ ] [`quic-rpc`](https://github.com/n0-computer/quic-rpc) - [ ] [`iroh-gossip`](https://github.com/n0-computer/iroh-gossip) - [ ] [`iroh-blobs`](https://github.com/n0-computer/iroh-blobs) - [ ] [`dumbpipe`](https://github.com/n0-computer/dumbpipe) - [ ] [`sendme`](https://github.com/n0-computer/sendme)
|
I would suggest to move the entire |
Good idea. That would make the crate a little less lightweight. This is a major change though. Edit: I think it would be best to do this in a separate PR. See #4094 |
| let res = this | ||
| .0 | ||
| .pkarr | ||
| .resolve_most_recent(&public_key) |
There was a problem hiding this comment.
so this is not needed anymore?
There was a problem hiding this comment.
To be completely honest I don't understand the reason for this. It basically looks up the record and then republishes it with the previous timestamp before then immediately after overwriting it with the new timestamp.
Doing a lookup first might be useful to warm up the DHT cache, but why publish with the previous timestamp if we do all this effort to keep the timestamps monotonic?
There was a problem hiding this comment.
I didn't understand it before either, which is where my confusion came from 😅
There was a problem hiding this comment.
I tried this out manually without, and it works. Let's just keep it like this and then re-add it if it turns out necessary?
Note that I can see the lookup being useful - if your addr is quickly changing you basically warm up the DHT while adding a little delay before you spam the DHT with soon to be obsolete data. Sort of like debounce but more useful.
But not the publish with the previous timestamp.
- Use derive_more and n0_error - remove useless rename - add README.md (not much in there yet)
Description
On main we use the pkarr dependency, which comes with an entire tree of dependencies and is not under our control. But we do not use the reqwest based client at all in the dns discovery, instead we have our own. So what we use is just the encoding and decoding of DNS records.
It seems less than optimal to have a big dependency for just that. So this PR removes the pkarr dependency, inlines the DNS record encoding with the help of simple-dns, and implements the dht part manually, directly using the mainline crate.
Note for reviewers: just do cargo doc -p iroh_dns --open to see the API of the new crate. Almost everything is just copied, with the exception of using mainline directly to publish to the DHT.
(In a subsequent PR I might also try to get rid of the mainline dep)
Breaking Changes
A lot of stuff moves into iroh-dns
Notes & open questions
Note: I am using simple-dns for en/decoding. We could even inline this, but it is very lightweight compared to hickory or even hickory-proto. I was originally planning to use hickory-proto, but it has a lot of deps even with default features disabled. Simple-dns is not a new dependency - we used to have it via pkarr.
Note: this adds a dep to iroh-relay to iroh-dns-server, just for the pkarr SignedPacket impl. We could alternatively let iroh-relay-server depend on pkarr (it's not so critical regarding deps), or have a tiny iroh-pkarr crate.Note: we are no longer using pkarr client (which has relay and dht built in) for the dht lookup. So there is a functionality change: the dht lookup can now only look up via the DHT. Before you could configure it with relays.
But I think that is fine, we already have a way to look up via relays.
Note: I also added a few comments and tests regarding storage on iroh-dns-server. These are unrelated but should do no harm.
Change checklist
quic-rpciroh-gossipiroh-blobsdumbpipesendme