diff options
Diffstat (limited to 'internal/options')
-rw-r--r-- | internal/options/options.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/internal/options/options.go b/internal/options/options.go new file mode 100644 index 0000000..f7510ba --- /dev/null +++ b/internal/options/options.go @@ -0,0 +1,22 @@ +package options + +import ( + "flag" + "time" +) + +type Options struct { + InputFile string + NumWorkers int + MetricsInterval time.Duration + Timeout time.Duration +} + +func Parse() (opts Options) { + flag.StringVar(&opts.InputFile, "i", "lists/small.lst", "input file, one domain name per line") + flag.IntVar(&opts.NumWorkers, "w", 10, "number of parallel workers") + flag.DurationVar(&opts.Timeout, "t", 10*time.Second, "timeout for each website visit") + flag.DurationVar(&opts.MetricsInterval, "m", 5*time.Second, "how often to emit metrics") + flag.Parse() + return +} |