Files
iroh/Cargo.toml
T
Rüdiger Klaehn 3ab6222bc2 feat: vendor pkarr implementation (#4026)
## 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

- new crate: iroh-dns — published as a separate crate containing
SignedPacket, Timestamp, EndpointIdExt, TxtAttrs, IrohAttr,
IROH_TXT_NAME, ParseError, EncodingError. iroh and iroh-relay no longer
depend on the third-party pkarr crate directly.
- removed: iroh_relay::endpoint_info::DecodingError — no longer exists.
Callers that matched on it should now handle iroh_base::KeyParsingError
instead.
- changed: iroh_relay::endpoint_info::EndpointIdExt::from_z32 — return
type changed from Result<EndpointId, DecodingError> to
Result<EndpointId, iroh_base::KeyParsingError>.
- changed: iroh_relay::endpoint_info::EncodingError — the
InvalidTxtEntry { source: pkarr::dns::SimpleDnsError } variant is
removed. Only FailedBuildingPacket remains, and its source type is now
iroh_dns::pkarr::SignedPacketBuildError (no longer the third-party
pkarr::errors::SignedPacketBuildError).
- changed: iroh_relay::endpoint_info::ParseError::DecodingError — the
source field type changed from DecodingError to
iroh_base::KeyParsingError.
- changed: iroh_relay::endpoint_info::EndpointInfo::from_txt_lookup —
signature relaxed from impl Iterator<Item = crate::dns::TxtRecordData>
to impl Iterator<Item = impl Display>. Also no longer
#[cfg(not(wasm_browser))]-gated.
- changed:
iroh_relay::endpoint_info::EndpointInfo::{from_pkarr_signed_packet,
to_pkarr_signed_packet} — the SignedPacket parameter/return type is now
iroh_dns::pkarr::SignedPacket instead of the third-party
pkarr::SignedPacket.
- changed: iroh::address_lookup::pkarr::PkarrError::PublicKey — source
field type changed from pkarr::errors::PublicKeyError to
iroh_base::KeyParsingError.
- changed: iroh::address_lookup::pkarr::PkarrError::Verify — source
field type is now iroh_dns::pkarr::SignedPacketVerifyError (not
pkarr::errors::SignedPacketVerifyError).
- removed:
iroh::address_lookup::pkarr::dht::Builder::client(pkarr::Client) —
replaced by dht_builder(mainline::DhtBuilder). The DHT is now driven by
mainline directly rather than via pkarr::Client.
- removed: iroh::address_lookup::pkarr::dht::Builder::pkarr_relay(Url) —
the DHT address lookup no longer publishes to pkarr relays; it only uses
the Mainline DHT. Use PkarrPublisher for relay publishing.
- removed:
iroh::address_lookup::pkarr::dht::Builder::n0_dns_pkarr_relay() — same
reason as above.
- removed: iroh::address_lookup::pkarr::dht::Builder::dht(bool) — DHT is
always enabled for DhtAddressLookup; the toggle is gone.
- changed: cargo feature address-lookup-pkarr-dht — now pulls in
mainline instead of pkarr/dht + pkarr/relays.
- removed (internal crate deps): z32 and pkarr are no longer direct
dependencies of iroh, iroh-relay, or iroh-dns-server. Downstream users
who pulled those through iroh's dependency tree must depend on them
explicitly (or use the re-exports from 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
<!-- Remove any that are not relevant. -->
- [x] 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)
2026-04-16 14:16:46 +02:00

44 lines
1.1 KiB
TOML

[workspace]
members = [
"iroh-base",
"iroh-dns",
"iroh-dns-server",
"iroh",
"iroh/bench",
"iroh-relay",
]
resolver = "2"
[profile.release]
debug = true
[profile.dev-ci]
inherits = 'dev'
opt-level = 1
[profile.optimized-release]
inherits = 'release'
debug = false
lto = true
debug-assertions = false
opt-level = 3
panic = 'abort'
incremental = false
[workspace.lints.rust]
missing_debug_implementations = "warn"
# We use this --cfg for documenting the cargo features on which an API
# is available. To preview this locally use: RUSTDOCFLAGS="--cfg
# iroh_docsrs" cargo +nightly doc --all-features. We use our own
# iroh_docsrs instead of the common docsrs to avoid also enabling this
# feature in any dependencies, because some indirect dependencies
# require a feature enabled when using `--cfg docsrs` which we can not
# do. To enable for a crate set `#![cfg_attr(iroh_docsrs,
# feature(doc_cfg))]` in the crate.
# We also have our own `iroh_loom` cfg to enable tokio-rs/loom testing.
unexpected_cfgs = { level = "warn", check-cfg = ["cfg(iroh_docsrs)", "cfg(iroh_loom)", "cfg(skip_patchbay)"] }
[workspace.lints.clippy]
unused-async = "warn"