ITADN

Make libp2p-dns custom resolver construction fallible

#6420Opendiegomrsantos 创建于 2026-05-05
D
diegomrsantoscommented
This follow-up comes from PR #6418. Hickory 0.26 changed resolver construction so `ResolverBuilder::build()` returns `Result<Resolver<_>, NetError>`. `libp2p_dns::tokio::Transport::custom` is currently infallible, so PR #6418 keeps the existing public API and unwraps the Hickory result. That is defensible for the current feature set because `libp2p-dns` enables `hickory-resolver` with `system-config` and `tokio`; on that path, `build()` does not validate caller-provided `ResolverConfig` or `ResolverOpts`. The fallible part is used by Hickory feature combinations that construct TLS config, which `libp2p-dns` does not enable. For a future breaking release, `libp2p-dns` should expose the fallible construction path instead of hiding Hickory's `Result`. That could mean changing `Transport::custom` to return `Result`, or adding a fallible constructor first and moving callers over before the breaking change.
0 条评论