...
1## Getting Started
2
3### Install the handler
4
5We first need to serve the probing HTTP handler.
6
7```go
8 http.HandleFunc("/health", probing.NewHandler())
9 err := http.ListenAndServe(":12345", nil)
10 if err != nil {
11 log.Fatal("ListenAndServe: ", err)
12 }
13```
14
15### Start to probe
16
17Now we can start to probe the endpoint.
18
19``` go
20 id := "example"
21 probingInterval = 5 * time.Second
22 url := "http://example.com:12345/health"
23 p.AddHTTP(id, probingInterval, url)
24
25 time.Sleep(13 * time.Second)
26 status, err := p.Status(id)
27 fmt.Printf("Total Probing: %d, Total Loss: %d, Estimated RTT: %v, Estimated Clock Difference: %v\n",
28 status.Total(), status.Loss(), status.SRTT(), status.ClockDiff())
29 // Total Probing: 2, Total Loss: 0, Estimated RTT: 320.771µs, Estimated Clock Difference: -35.869µs
30```
31
32### TODOs:
33
34- TCP probing
35- UDP probing
36- Gossip based probing
37- More accurate RTT estimation
38- More accurate Clock difference estimation
39- Use a clock interface rather than the real clock
View as plain text