|
|
|
|
@ -124,18 +124,18 @@ func Ping(domain string, PS int) {
|
|
|
|
|
*/
|
|
|
|
|
index, err := conn.Write(buffer.Bytes())
|
|
|
|
|
if err != nil {
|
|
|
|
|
fmt.Printf("%s\n", red("timeout"))
|
|
|
|
|
//这种判断其实不必要 发包一定可以 error返回一定是nil
|
|
|
|
|
fmt.Printf("%s\n", red("timeout", index))
|
|
|
|
|
dropPack++
|
|
|
|
|
time.Sleep(time.Second)
|
|
|
|
|
fmt.Println("666666666666666666666666666")
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
fmt.Println(index, "index")
|
|
|
|
|
|
|
|
|
|
// 否则记录当前得时间
|
|
|
|
|
t_start := time.Now()
|
|
|
|
|
conn.SetReadDeadline((time.Now().Add(time.Second * 3)))
|
|
|
|
|
len, err := conn.Read(recv)
|
|
|
|
|
fmt.Println(len, err)
|
|
|
|
|
/*
|
|
|
|
|
查目标地址是否返回失败
|
|
|
|
|
如果返回失败则丢包 ++
|
|
|
|
|
|