Skip to content
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

fix: remove unused dep #374

Merged
merged 1 commit into from
Mar 13, 2024
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
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,8 @@
"@chainsafe/is-ip": "^2.0.1",
"@chainsafe/netmask": "^2.0.0",
"@libp2p/interface": "^1.0.0",
"@multiformats/dns": "^1.0.1",
"@multiformats/dns": "^1.0.3",
"multiformats": "^13.0.0",
"race-signal": "^1.0.2",
"uint8-varint": "^2.0.1",
"uint8arrays": "^5.0.0"
},
Expand Down
7 changes: 3 additions & 4 deletions src/resolvers/dnsaddr.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { CodeError } from '@libp2p/interface'
import { dns, RecordType } from '@multiformats/dns'
import { raceSignal } from 'race-signal'
import { multiaddr } from '../index.js'
import { getProtocol } from '../protocols-table.js'
import type { Resolver } from './index.js'
Expand All @@ -25,7 +24,7 @@ export interface DNSADDROptions extends AbortOptions {
maxRecursiveDepth?: number
}

export const dnsaddrResolver: Resolver<DNSADDROptions> = async function dnsaddr (ma: Multiaddr, options: DNSADDROptions = {}): Promise<string[]> {
export const dnsaddrResolver: Resolver<DNSADDROptions> = async function dnsaddrResolver (ma: Multiaddr, options: DNSADDROptions = {}): Promise<string[]> {
const recursionLimit = options.maxRecursiveDepth ?? MAX_RECURSIVE_DEPTH

if (recursionLimit === 0) {
Expand All @@ -35,12 +34,12 @@ export const dnsaddrResolver: Resolver<DNSADDROptions> = async function dnsaddr
const [, hostname] = ma.stringTuples().find(([proto]) => proto === dnsaddrCode) ?? []

const resolver = options?.dns ?? dns()
const result = await raceSignal(resolver.query(`_dnsaddr.${hostname}`, {
const result = await resolver.query(`_dnsaddr.${hostname}`, {
signal: options?.signal,
types: [
RecordType.TXT
]
}), options.signal)
})

const peerId = ma.getPeerId()
const output: string[] = []
Expand Down
2 changes: 1 addition & 1 deletion test/resolvers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ describe('multiaddr resolve', () => {

controller.abort()

await expect(resolvePromise).to.eventually.be.rejected().with.property('code', 'ABORT_ERR')
await expect(resolvePromise).to.eventually.be.rejected()
})

it('should abort resolving deeply nested records', async () => {
Expand Down
Loading