File: README.md

package info (click to toggle)
golang-github-xiang90-probing 0.0~git20150806.0.6a0cc1a-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 68 kB
  • ctags: 34
  • sloc: makefile: 3
file content (39 lines) | stat: -rw-r--r-- 1,001 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
## Getting Started

### Install the handler

We first need to serve the probing HTTP handler.

```go
    http.HandleFunc("/health", probing.NewHandler())
    err := http.ListenAndServe(":12345", nil)
	if err != nil {
		log.Fatal("ListenAndServe: ", err)
	}
```

### Start to probe

Now we can start to probe the endpoint.

``` go
    id := "example"
    probingInterval = 5 * time.Second
    url := "http://example.com:12345/health"
    p.AddHTTP(id, probingInterval, url)

	time.Sleep(13 * time.Second)
	status, err := p.Status(id)
 	fmt.Printf("Total Probing: %d, Total Loss: %d, Estimated RTT: %v, Estimated Clock Difference: %v\n",
		status.Total(), status.Loss(), status.SRTT(), status.ClockDiff())
	// Total Probing: 2, Total Loss: 0, Estimated RTT: 320.771µs, Estimated Clock Difference: -35.869µs
```

### TODOs:

- TCP probing
- UDP probing
- Gossip based probing
- More accurate RTT estimation
- More accurate Clock difference estimation
- Use a clock interface rather than the real clock