|
|
|
@ -21,15 +21,17 @@ function Ping(host, options) {
|
|
|
|
|
|
|
|
|
|
events.EventEmitter.call(this);
|
|
|
|
|
|
|
|
|
|
const timeout = 10;
|
|
|
|
|
|
|
|
|
|
if (WIN) {
|
|
|
|
|
this._bin = "c:/windows/system32/ping.exe";
|
|
|
|
|
this._args = (options.args) ? options.args : [ "-n", "1", "-w", "5000", host ];
|
|
|
|
|
this._args = (options.args) ? options.args : [ "-n", "1", "-w", timeout * 1000, host ];
|
|
|
|
|
this._regmatch = /[><=]([0-9.]+?)ms/;
|
|
|
|
|
|
|
|
|
|
} else if (LIN) {
|
|
|
|
|
this._bin = "/bin/ping";
|
|
|
|
|
|
|
|
|
|
const defaultArgs = [ "-n", "-w", "2", "-c", "1", host ];
|
|
|
|
|
const defaultArgs = [ "-n", "-w", timeout, "-c", "1", host ];
|
|
|
|
|
|
|
|
|
|
if (net.isIPv6(host) || options.ipv6) {
|
|
|
|
|
defaultArgs.unshift("-6");
|
|
|
|
@ -46,13 +48,13 @@ function Ping(host, options) {
|
|
|
|
|
this._bin = "/sbin/ping";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this._args = (options.args) ? options.args : [ "-n", "-t", "2", "-c", "1", host ];
|
|
|
|
|
this._args = (options.args) ? options.args : [ "-n", "-t", timeout, "-c", "1", host ];
|
|
|
|
|
this._regmatch = /=([0-9.]+?) ms/;
|
|
|
|
|
|
|
|
|
|
} else if (FBSD) {
|
|
|
|
|
this._bin = "/sbin/ping";
|
|
|
|
|
|
|
|
|
|
const defaultArgs = [ "-n", "-t", "2", "-c", "1", host ];
|
|
|
|
|
const defaultArgs = [ "-n", "-t", timeout, "-c", "1", host ];
|
|
|
|
|
|
|
|
|
|
if (net.isIPv6(host) || options.ipv6) {
|
|
|
|
|
defaultArgs.unshift("-6");
|
|
|
|
|