diff --git a/lib/DnsResolver.js b/lib/DnsResolver.js index e880aa6..0d24cb0 100644 --- a/lib/DnsResolver.js +++ b/lib/DnsResolver.js @@ -1,9 +1,5 @@ -import * as dns from 'node:dns' +import dns from 'node:dns' import punycode from 'punycode/punycode.js' -import { promisify } from 'node:util' - -const dnsLookupAsync = promisify(dns.lookup) -const dnsResolveAsync = promisify(dns.resolve) export default class DnsResolver { /** @@ -42,7 +38,7 @@ export default class DnsResolver { this.logger.debug('SRV Resolve: ' + srvRecordPrefix + '.' + host) let records try { - records = await dnsResolveAsync(srvRecordPrefix + '.' + host, 'SRV') + records = await dns.promises.resolve(srvRecordPrefix + '.' + host, 'SRV') if (records.length >= 1) { this.logger.debug('Found SRV Records: ', records) const record = records[0] @@ -63,7 +59,7 @@ export default class DnsResolver { } this.logger.debug('Standard Resolve: ' + host) - const dnsResult = await dnsLookupAsync(host, ipFamily) + const dnsResult = await dns.promises.lookup(host, ipFamily) // For some reason, this sometimes returns a string address rather than an object. // I haven't been able to reproduce, but it's been reported on the issue tracker. let address