mirror of
https://github.com/go-ping/ping.git
synced 2025-08-08 08:27:40 +00:00
parent
28a88d0810
commit
9db3df4bca
5
ping.go
5
ping.go
@ -83,17 +83,18 @@ func NewPinger(addr string) (*Pinger, error) {
|
|||||||
ipv4 = false
|
ipv4 = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||||
return &Pinger{
|
return &Pinger{
|
||||||
ipaddr: ipaddr,
|
ipaddr: ipaddr,
|
||||||
addr: addr,
|
addr: addr,
|
||||||
Interval: time.Second,
|
Interval: time.Second,
|
||||||
Timeout: time.Second * 100000,
|
Timeout: time.Second * 100000,
|
||||||
Count: -1,
|
Count: -1,
|
||||||
id: rand.Intn(math.MaxInt16),
|
id: r.Intn(math.MaxInt16),
|
||||||
network: "udp",
|
network: "udp",
|
||||||
ipv4: ipv4,
|
ipv4: ipv4,
|
||||||
Size: timeSliceLength,
|
Size: timeSliceLength,
|
||||||
Tracker: rand.Int63n(math.MaxInt64),
|
Tracker: r.Int63n(math.MaxInt64),
|
||||||
done: make(chan bool),
|
done: make(chan bool),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user