format typo fixed

This commit is contained in:
Christian Loew 2016-10-15 19:32:55 +02:00
parent 3c1e1f1182
commit da3a9230db
1 changed files with 7 additions and 5 deletions

View File

@ -5,12 +5,12 @@ package ping
import ( import (
"errors" "errors"
"os/exec" "os/exec"
"regexp"
"runtime" "runtime"
"strconv" "strconv"
"strings" "strings"
"sync" "sync"
"time" "time"
"regexp"
"github.com/influxdata/telegraf" "github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/internal" "github.com/influxdata/telegraf/internal"
@ -160,8 +160,10 @@ func (p *Ping) args(url string) []string {
} }
args = append(args, url) args = append(args, url)
switch p.IPVersion { switch p.IPVersion {
case 4: args = append(args, "-4") case 4:
case 6: args = append(args, "-6") args = append(args, "-4")
case 6:
args = append(args, "-6")
} }
return args return args
@ -191,7 +193,7 @@ func processPingOutput(out string) (int, int, float64, int, error) {
for _, line := range lines { for _, line := range lines {
str := re.FindStringSubmatch(line) str := re.FindStringSubmatch(line)
if len(str) != 0 { if len(str) != 0 {
if strings.Contains(str[1],":") { if strings.Contains(str[1], ":") {
ipversion = 6 ipversion = 6
} else { } else {
ipversion = 4 ipversion = 4