Skip to content

Commit

Permalink
fix: cloudflare dns only supports string type (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
SgtPooki authored Apr 6, 2024
1 parent 1ab3fc7 commit a49bb37
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/resolvers/dns-json-over-https.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import PQueue from 'p-queue'
import { CustomProgressEvent } from 'progress-events'
import { RecordType, type DNSResponse } from '../index.js'
import { getTypes } from '../utils/get-types.js'
import { toDNSResponse } from '../utils/to-dns-response.js'
import type { DNSResolver } from './index.js'
import type { DNSResponse } from '../index.js'

/**
* Browsers limit concurrent connections per host (~6), we don't want to exhaust
Expand Down Expand Up @@ -43,7 +43,8 @@ export function dnsJsonOverHttps (url: string, init: DNSJSONOverHTTPSOptions = {
searchParams.set('name', fqdn)

getTypes(options.types).forEach(type => {
searchParams.append('type', type.toString())
// We pass record type as a string to the server because cloudflare DNS bug. see https://github.com/ipfs/helia/issues/474
searchParams.append('type', RecordType[type])
})

options.onProgress?.(new CustomProgressEvent<string>('dns:query', { detail: fqdn }))
Expand Down

0 comments on commit a49bb37

Please sign in to comment.