mirror of
https://github.com/taigrr/go-fastping
synced 2025-01-18 05:03:15 -08:00
Fix documents
This commit is contained in:
parent
9bc45ffa9d
commit
f930d86dae
17
README.md
17
README.md
@ -24,13 +24,24 @@ if err != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
p.AddIPAddr(ra)
|
||||
p.AddHandler("receive", func(addr *net.IPAddr, rtt time.Duration) {
|
||||
err = p.AddHandler("receive", func(addr *net.IPAddr, rtt time.Duration) {
|
||||
fmt.Printf("IP Addr: %s receive, RTT: %v\n", addr.String(), rtt)
|
||||
})
|
||||
p.AddHandler("idle", func() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
err = p.AddHandler("idle", func() {
|
||||
fmt.Println("finish")
|
||||
})
|
||||
p.Run()
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
err = p.Run()
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
```
|
||||
|
||||
It sends an ICMP packet and wait a response. If it receives a response, it
|
||||
|
17
fastping.go
17
fastping.go
@ -15,13 +15,24 @@
|
||||
// os.Exit(1)
|
||||
// }
|
||||
// p.AddIPAddr(ra)
|
||||
// p.AddHandler("receive", func(addr *net.IPAddr, rtt time.Duration) {
|
||||
// err = p.AddHandler("receive", func(addr *net.IPAddr, rtt time.Duration) {
|
||||
// fmt.Printf("IP Addr: %s receive, RTT: %v\n", addr.String(), rtt)
|
||||
// })
|
||||
// p.AddHandler("idle", func() {
|
||||
// if err != nil {
|
||||
// fmt.Println(err)
|
||||
// os.Exit(1)
|
||||
// }
|
||||
// err = p.AddHandler("idle", func() {
|
||||
// fmt.Println("finish")
|
||||
// })
|
||||
// p.Run()
|
||||
// if err != nil {
|
||||
// fmt.Println(err)
|
||||
// os.Exit(1)
|
||||
// }
|
||||
// err = p.Run()
|
||||
// if err != nil {
|
||||
// fmt.Println(err)
|
||||
// }
|
||||
//
|
||||
// It sends an ICMP packet and wait a response. If it receives a response,
|
||||
// it calls "receive" callback. After that, MaxRTT time passed, it calls
|
||||
|
Loading…
x
Reference in New Issue
Block a user