mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-28 01:04:05 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
86826fb826
1 changed files with 13 additions and 0 deletions
|
@ -7,6 +7,7 @@ const spawn = require("child_process").spawn,
|
||||||
WIN = /^win/.test(process.platform),
|
WIN = /^win/.test(process.platform),
|
||||||
LIN = /^linux/.test(process.platform),
|
LIN = /^linux/.test(process.platform),
|
||||||
MAC = /^darwin/.test(process.platform);
|
MAC = /^darwin/.test(process.platform);
|
||||||
|
FBSD = /^freebsd/.test(process.platform);
|
||||||
const { debug } = require("../src/util");
|
const { debug } = require("../src/util");
|
||||||
|
|
||||||
module.exports = Ping;
|
module.exports = Ping;
|
||||||
|
@ -49,6 +50,18 @@ function Ping(host, options) {
|
||||||
this._args = (options.args) ? options.args : [ "-n", "-t", "2", "-c", "1", host ];
|
this._args = (options.args) ? options.args : [ "-n", "-t", "2", "-c", "1", host ];
|
||||||
this._regmatch = /=([0-9.]+?) ms/;
|
this._regmatch = /=([0-9.]+?) ms/;
|
||||||
|
|
||||||
|
} else if (FBSD) {
|
||||||
|
this._bin = "/sbin/ping";
|
||||||
|
|
||||||
|
const defaultArgs = [ "-n", "-t", "2", "-c", "1", host ];
|
||||||
|
|
||||||
|
if (net.isIPv6(host) || options.ipv6) {
|
||||||
|
defaultArgs.unshift("-6");
|
||||||
|
}
|
||||||
|
|
||||||
|
this._args = (options.args) ? options.args : defaultArgs;
|
||||||
|
this._regmatch = /=([0-9.]+?) ms/;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new Error("Could not detect your ping binary.");
|
throw new Error("Could not detect your ping binary.");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue