mirror of
https://github.com/tribufu/node-gamedig
synced 2026-05-18 09:35:50 +00:00
feat: remove punycode package (#630)
* feat: remove punycode package * fix(deno): specify node scope in import
This commit is contained in:
parent
ba2f373986
commit
54f51ebc73
3 changed files with 9 additions and 5 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import dns from 'node:dns'
|
||||
import { isIP } from 'node:net'
|
||||
import punycode from 'punycode/punycode.js'
|
||||
import { domainToASCII } from 'node:url'
|
||||
|
||||
export default class DnsResolver {
|
||||
/**
|
||||
|
|
@ -30,7 +30,11 @@ export default class DnsResolver {
|
|||
return { address: host }
|
||||
}
|
||||
|
||||
const asciiForm = punycode.toASCII(host)
|
||||
const asciiForm = domainToASCII(host)
|
||||
if (!asciiForm) {
|
||||
throw new Error('Invalid domain')
|
||||
}
|
||||
|
||||
if (asciiForm !== host) {
|
||||
this.logger.debug('Encoded punycode: ' + host + ' -> ' + asciiForm)
|
||||
host = asciiForm
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue