You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Prepare traceroute-caller for supporting hop annotations (#119)
* Prepare traceroute-caller for supporting hop annotations
Although this commit seems big, it does not change the behavior
of traceroute-caller (hence this work was done in feature branch
sandbox-saied-noop). Here's a summary of the changes:
- Remove poll mode because it's not used and its package
testing was intermittently failing due to race conditions.
- Remove legacy debug code for scamper-daemon-with-scamper-backup.
- Make changes to comply with Go style guidelines with respect
to comments, error messages, etc.
- Improve package testing code and coverage.
- Introduce a no-op hopannotation code to be followed with
an actual implementation in the next commit.
The changes were tested with "go test ./... -race" and
"docker-compose up" on my local workstation.
* Make changes based on code review comments
// TODO: scamper and its commands (e.g., tracelb) support a
45
-
// relatively large number of flags. Instead of adding these
46
-
// flags one by one to traceroute-caller flags, going forward
47
-
// it's much better to have traceroute-caller read a configuration
48
-
// file in textproto format that would support all scamper and
49
-
// its command flags.
50
-
scamperBin=flag.String("scamper.bin", "scamper", "The path to the scamper binary.")
51
-
scattachBin=flag.String("scamper.sc_attach", "sc_attach", "The path to the sc_attach binary.")
52
-
scwarts2jsonBin=flag.String("scamper.sc_warts2json", "sc_warts2json", "The path to the sc_warts2json binary.")
53
-
scamperCtrlSocket=flag.String("scamper.unixsocket", "/tmp/scamperctrl", "The name of the UNIX-domain socket that the scamper daemon should listen on.")
54
-
scamperTimeout=flag.Duration("scamper.timeout", 900*time.Second, "How long to wait to complete a scamper trace.")
55
-
scamperPTR=flag.Bool("scamper.tracelb-ptr", true, "Look up DNS pointer records for IP addresses.")
56
-
scamperWaitProbe=flag.Int("scamper.tracelb-W", 25, "How long to wait between probes in 1/100ths of seconds (min 15, max 200).")
57
-
outputPath=flag.String("outputPath", "/var/spool/scamper", "The path of output.")
58
-
waitTime=flag.Duration("waitTime", 5*time.Second, "How long to wait between subsequent listings of open connections.")
59
-
poll=flag.Bool("poll", true, "Whether the polling method should be used to see new connections.")
// TODO(SaiedKazemi): scamper and its commands (e.g., tracelb)
34
+
// support a large number of flags. Instead of adding
35
+
// these flags one by one to traceroute-caller flags, it
36
+
// will be much better to have traceroute-caller read a
37
+
// configuration file in textproto format that would support
38
+
// all scamper and its command flags.
39
+
scamperBin=flag.String("scamper.bin", "scamper", "The path to the scamper binary.")
40
+
scattachBin=flag.String("scamper.sc_attach", "sc_attach", "The path to the sc_attach binary.")
41
+
scwarts2jsonBin=flag.String("scamper.sc_warts2json", "sc_warts2json", "The path to the sc_warts2json binary.")
42
+
scamperCtrlSocket=flag.String("scamper.unixsocket", "/tmp/scamperctrl", "The name of the UNIX-domain socket that the scamper daemon should listen on.")
43
+
scamperTimeout=flag.Duration("scamper.timeout", 900*time.Second, "How long to wait to complete a scamper trace.")
44
+
scamperPTR=flag.Bool("scamper.tracelb-ptr", true, "Look up DNS pointer records for IP addresses.")
45
+
scamperWaitProbe=flag.Int("scamper.tracelb-W", 25, "How long to wait between probes in 1/100ths of seconds (min 15, max 200).")
46
+
tracerouteOutput=flag.String("traceroute-output", "/var/spool/scamper", "The path to store traceroute output.")
47
+
hopAnnotationOutput=flag.String("hopannotation-output", "/var/spool/hopannotation1", "The path to store hop annotations.")
48
+
tracerType= flagx.Enum{
49
+
Options: []string{"scamper", "scamper-daemon"},
62
50
Value: "scamper",
63
51
}
64
52
@@ -75,18 +63,26 @@ func main() {
75
63
log.SetFlags(log.LstdFlags|log.Lshortfile)
76
64
77
65
flag.Parse()
78
-
rtx.Must(flagx.ArgsFromEnv(flag.CommandLine), "Could not get args from environment")
79
-
rtx.Must(os.MkdirAll(*outputPath, 0777), "Could not create data directory")
66
+
rtx.Must(flagx.ArgsFromEnv(flag.CommandLine), "failed to get args from environment")
67
+
if*eventsocket.Filename=="" {
68
+
logFatal("tcpinfo.eventsocket was set to \"\"")
69
+
}
70
+
rtx.Must(os.MkdirAll(*tracerouteOutput, 0777), "failed to create directory for traceroute results")
71
+
rtx.Must(os.MkdirAll(*hopAnnotationOutput, 0777), "failed to create directory for hop annotation results")
0 commit comments