aboutsummaryrefslogtreecommitdiff
path: root/internal/options/options.go
blob: f7510babf8a9a208650709cfa541cfb5df34679d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
}