-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.go
38 lines (36 loc) · 812 Bytes
/
main.go
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
package main
import (
"github.com/mgranderath/traceroute/methods"
"github.com/mgranderath/traceroute/methods/tcp"
"github.com/mgranderath/traceroute/methods/udp"
"log"
"net"
"time"
)
func main() {
ip := net.ParseIP("94.140.14.14")
tcpTraceroute := tcp.New(ip, methods.TracerouteConfig{
MaxHops: 20,
NumMeasurements: 3,
ParallelRequests: 18,
Port: 53,
Timeout: time.Second / 2,
})
res, err := tcpTraceroute.Start()
if err != nil {
log.Fatal(err)
}
log.Println(res)
udpTraceroute := udp.New(ip, true, methods.TracerouteConfig{
MaxHops: 20,
NumMeasurements: 3,
ParallelRequests: 24,
Port: 784,
Timeout: 2 * time.Second,
})
res, err = udpTraceroute.Start()
if err != nil {
log.Fatal(err)
}
log.Println(res)
}