mirror of
https://github.com/gamedig/node-gamedig.git
synced 2024-11-17 17:25:19 +01:00
Support dnsLookupAsync returning a string for some reason, Fixes #135
This commit is contained in:
parent
7a143002fc
commit
1b47fd2096
1 changed files with 9 additions and 1 deletions
|
@ -62,7 +62,15 @@ class DnsResolver {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logger.debug("Standard Resolve: " + host);
|
this.logger.debug("Standard Resolve: " + host);
|
||||||
const {address,family} = await dnsLookupAsync(host);
|
const dnsResult = await dnsLookupAsync(host);
|
||||||
|
// 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;
|
||||||
|
if (typeof dnsResult === 'string') {
|
||||||
|
address = dnsResult;
|
||||||
|
} else {
|
||||||
|
address = dnsResult.address;
|
||||||
|
}
|
||||||
this.logger.debug("Found address: " + address);
|
this.logger.debug("Found address: " + address);
|
||||||
return {address: address};
|
return {address: address};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue