Skip to content

fix: deprecate DNS resolvers #426

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

Merged
merged 1 commit into from
Jun 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,8 @@ export function fromNodeAddress (addr: NodeAddress, transport: string): Multiadd
* console.info(ma2)
* // '/ip4/127.0.0.1'
* ```
*
* @deprecated Will be removed in a future release
*/
export function fromTuples (tuples: Tuple[]): Multiaddr {
return multiaddr(tuples.map(([code, value]) => {
Expand Down Expand Up @@ -706,6 +708,8 @@ export function fromTuples (tuples: Tuple[]): Multiaddr {
* console.info(ma2)
* // '/ip4/127.0.0.1'
* ```
*
* @deprecated Will be removed in a future release
*/
export function fromStringTuples (tuples: StringTuple[]): Multiaddr {
return multiaddr(tuples.map(([code, value]) => {
Expand Down Expand Up @@ -737,6 +741,8 @@ export function fromStringTuples (tuples: StringTuple[]): Multiaddr {
* isName(multiaddr('/dns/ipfs.io'))
* // true
* ```
*
* @deprecated DNS resolving will be removed in a future release
*/
export function isName (addr: Multiaddr): boolean {
if (!isMultiaddr(addr)) {
Expand Down
6 changes: 6 additions & 0 deletions src/resolvers/dnsaddr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ class RecursionLimitError extends Error {
}
}

/**
* @deprecated DNS resolving will be removed in a future release
*/
export interface DNSADDROptions extends AbortOptions {
/**
* An optional DNS resolver
Expand All @@ -30,6 +33,9 @@ export interface DNSADDROptions extends AbortOptions {
maxRecursiveDepth?: number
}

/**
* @deprecated DNS resolving will be removed in a future release
*/
export const dnsaddrResolver: Resolver<DNSADDROptions> = async function dnsaddrResolver (ma: Multiaddr, options: DNSADDROptions = {}): Promise<string[]> {
const recursionLimit = options.maxRecursiveDepth ?? MAX_RECURSIVE_DEPTH

Expand Down
3 changes: 3 additions & 0 deletions src/resolvers/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import type { AbortOptions, Multiaddr } from '../index.js'

/**
* @deprecated DNS resolving will be removed in a future release
*/
export interface Resolver<ResolveOptions extends AbortOptions = AbortOptions> {
(ma: Multiaddr, options?: ResolveOptions): Promise<string[]>
}
Expand Down