fix: number before failed
This commit is contained in:
8
main.go
8
main.go
@@ -1,13 +1,14 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
flag "github.com/spf13/pflag"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
flag "github.com/spf13/pflag"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -78,7 +79,7 @@ func main() {
|
|||||||
record = "AAAA"
|
record = "AAAA"
|
||||||
}
|
}
|
||||||
ip, err = filterIP(ips, ipv6)
|
ip, err = filterIP(ips, ipv6)
|
||||||
if (err != nil) {
|
if err != nil {
|
||||||
fmt.Printf("找不到 %s 的 %s 记录\n", hostname, record)
|
fmt.Printf("找不到 %s 的 %s 记录\n", hostname, record)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
@@ -101,11 +102,12 @@ func main() {
|
|||||||
duration := time.Since(start)
|
duration := time.Since(start)
|
||||||
attemptCount++
|
attemptCount++
|
||||||
|
|
||||||
|
fmt.Printf("[%d] ", i+1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("测试到 %s 的连接失败: %s\n", address, "连接超时")
|
fmt.Printf("测试到 %s 的连接失败: %s\n", address, "连接超时")
|
||||||
} else {
|
} else {
|
||||||
successCount++
|
successCount++
|
||||||
fmt.Printf("[%d] 来自 %s 的响应: 时间=%s\n",i+1, address, fmt.Sprintf("%.3fms", float64(duration)/float64(time.Millisecond)))
|
fmt.Printf("来自 %s 的响应: 时间=%s\n", address, fmt.Sprintf("%.3fms", float64(duration)/float64(time.Millisecond)))
|
||||||
conn.Close()
|
conn.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user