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-10T07:00:23Z |
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)
and remove the reexport.
|
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 |
| @@ -0,0 +1,21 @@ | |||
| [package] | |||
There was a problem hiding this comment.
please make sure to add a readme file, and anything else we might have in other crates for this one
| } | ||
| } | ||
|
|
||
| impl Debug for SignedPacket { |
There was a problem hiding this comment.
why not derive-more?
| // Ensure strictly monotonic: if the clock went backward or two calls | ||
| // land in the same microsecond, we increment from the last value. | ||
| let mut last = LAST_TIMESTAMP.load(Ordering::Relaxed); | ||
| loop { |
There was a problem hiding this comment.
this makes me a bit uneasy, do we really have to do this?
| } | ||
| } | ||
|
|
||
| impl fmt::Debug for Timestamp { |
There was a problem hiding this comment.
why not derive-more?
| DnsError(String), | ||
| } | ||
|
|
||
| impl fmt::Display for SignedPacketBuildError { |
There was a problem hiding this comment.
can we use n0-error for this error type?
| /// Error verifying a signed packet. | ||
| #[derive(Debug)] | ||
| #[allow(missing_docs)] | ||
| pub enum SignedPacketVerifyError { |
There was a problem hiding this comment.
same, lets use n0-error
| } | ||
|
|
||
| #[derive(Debug, Clone)] | ||
| enum PkarrRelay { |
There was a problem hiding this comment.
are all these options gone now or why did you remove them?
| let res = this | ||
| .0 | ||
| .pkarr | ||
| .resolve_most_recent(&public_key) |
There was a problem hiding this comment.
so this is not needed anymore?
| // We map the error to string, as in browsers the error is !Send | ||
| let public_key = pkarr::PublicKey::try_from(endpoint_id.as_bytes()) | ||
| .map_err(|err| e!(PkarrError::PublicKey, err))?; | ||
| let public_key = endpoint_id; |
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