|
|
@ -47,11 +47,11 @@ exports.tcping = function (hostname, port) {
|
|
|
|
|
|
|
|
|
|
|
|
exports.ping = async (hostname) => {
|
|
|
|
exports.ping = async (hostname) => {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
await exports.pingAsync(hostname);
|
|
|
|
return await exports.pingAsync(hostname);
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|
// If the host cannot be resolved, try again with ipv6
|
|
|
|
// If the host cannot be resolved, try again with ipv6
|
|
|
|
if (e.message.includes("service not known")) {
|
|
|
|
if (e.message.includes("service not known")) {
|
|
|
|
await exports.pingAsync(hostname, true);
|
|
|
|
return await exports.pingAsync(hostname, true);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
throw e;
|
|
|
|
throw e;
|
|
|
|
}
|
|
|
|
}
|
|
|
|