Use same flags for all bsd family ping varients (#4241)
This commit is contained in:
parent
a34d7b0754
commit
93269fa1c0
|
@ -175,7 +175,7 @@ func (p *Ping) args(url string) []string {
|
||||||
}
|
}
|
||||||
if p.Timeout > 0 {
|
if p.Timeout > 0 {
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case "darwin":
|
case "darwin", "freebsd", "netbsd", "openbsd":
|
||||||
args = append(args, "-W", strconv.FormatFloat(p.Timeout*1000, 'f', -1, 64))
|
args = append(args, "-W", strconv.FormatFloat(p.Timeout*1000, 'f', -1, 64))
|
||||||
case "linux":
|
case "linux":
|
||||||
args = append(args, "-W", strconv.FormatFloat(p.Timeout, 'f', -1, 64))
|
args = append(args, "-W", strconv.FormatFloat(p.Timeout, 'f', -1, 64))
|
||||||
|
@ -186,7 +186,7 @@ func (p *Ping) args(url string) []string {
|
||||||
}
|
}
|
||||||
if p.Deadline > 0 {
|
if p.Deadline > 0 {
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case "darwin":
|
case "darwin", "freebsd", "netbsd", "openbsd":
|
||||||
args = append(args, "-t", strconv.Itoa(p.Deadline))
|
args = append(args, "-t", strconv.Itoa(p.Deadline))
|
||||||
case "linux":
|
case "linux":
|
||||||
args = append(args, "-w", strconv.Itoa(p.Deadline))
|
args = append(args, "-w", strconv.Itoa(p.Deadline))
|
||||||
|
@ -197,10 +197,10 @@ func (p *Ping) args(url string) []string {
|
||||||
}
|
}
|
||||||
if p.Interface != "" {
|
if p.Interface != "" {
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
|
case "darwin", "freebsd", "netbsd", "openbsd":
|
||||||
|
args = append(args, "-S", p.Interface)
|
||||||
case "linux":
|
case "linux":
|
||||||
args = append(args, "-I", p.Interface)
|
args = append(args, "-I", p.Interface)
|
||||||
case "freebsd", "darwin":
|
|
||||||
args = append(args, "-S", p.Interface)
|
|
||||||
default:
|
default:
|
||||||
// Not sure the best option here, just assume GNU ping?
|
// Not sure the best option here, just assume GNU ping?
|
||||||
args = append(args, "-I", p.Interface)
|
args = append(args, "-I", p.Interface)
|
||||||
|
|
Loading…
Reference in New Issue