package options import ( "flag" "time" ) type Options struct { // Input file InputFile string MaxFileBuffer int NextLine int64 // Website visits NumWorkers int Timeout time.Duration MaxResponse int64 // Health and metrics MetricsInterval time.Duration } func Parse() (opts Options) { flag.StringVar(&opts.InputFile, "i", "lists/small.lst", "input file, one domain name per line") flag.IntVar(&opts.MaxFileBuffer, "b", 512, "max bytes to read from input file at once in MiB") flag.Int64Var(&opts.NextLine, "n", 0, "next line to start reading the input file from") flag.IntVar(&opts.NumWorkers, "w", 2, "number of parallel workers") flag.DurationVar(&opts.Timeout, "t", 10*time.Second, "timeout for each website visit") flag.Int64Var(&opts.MaxResponse, "r", 128, "max response body size to accept in MiB") flag.DurationVar(&opts.MetricsInterval, "m", 5*time.Second, "how often to emit metrics") flag.Parse() return }