From e7cc5340e5d874215a484c7b3e9a5e67b8bf8300 Mon Sep 17 00:00:00 2001 From: LouisLam Date: Tue, 10 Aug 2021 21:07:11 +0800 Subject: [PATCH] ping ipv6 for macos --- server/ping-lite.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/ping-lite.js b/server/ping-lite.js index 9f350cac7..6d03e1607 100644 --- a/server/ping-lite.js +++ b/server/ping-lite.js @@ -38,7 +38,13 @@ function Ping(host, options) { this._regmatch = /=([0-9.]+?) ms/; } else if (MAC) { - this._bin = "/sbin/ping"; + + if (net.isIPv6(host) || options.ipv6) { + this._bin = "/sbin/ping6"; + } else { + this._bin = "/sbin/ping"; + } + this._args = (options.args) ? options.args : [ "-n", "-t", "2", "-c", "1", host ]; this._regmatch = /=([0-9.]+?) ms/;