aboutsummaryrefslogtreecommitdiff
path: root/internal/options
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus@rgdd.se>2023-03-23 19:41:03 +0100
committerRasmus Dahlberg <rasmus@rgdd.se>2023-03-23 19:41:03 +0100
commitb6b809207b1bf0730fc010d4cc08a030b636fe89 (patch)
tree8fe1d2f84205426a67ca56e510fbea66c740b734 /internal/options
parentcdfc220d5df547bc4fbe3157ddfa22c614eb737c (diff)
Add options
Diffstat (limited to 'internal/options')
-rw-r--r--internal/options/options.go22
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
+}