aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus@rgdd.se>2023-03-25 14:11:29 +0100
committerRasmus Dahlberg <rasmus@rgdd.se>2023-03-25 14:13:23 +0100
commitaf5be4fbd0c3824478b9cfc261b7a34e98a36e0f (patch)
treea26d8d2c226827f0ccc7db54be3a70f99f420c59 /internal
parent388caec0b6ed6b9cccb15de7ee2f093361772764 (diff)
Clean-up skeleton
Diffstat (limited to 'internal')
-rw-r--r--internal/options/options.go24
-rw-r--r--internal/qna/qna.go6
2 files changed, 20 insertions, 10 deletions
diff --git a/internal/options/options.go b/internal/options/options.go
index 8e10686..c988713 100644
--- a/internal/options/options.go
+++ b/internal/options/options.go
@@ -6,19 +6,31 @@ import (
)
type Options struct {
- InputFile string
- NumWorkers int
+ // Input file
+ InputFile string
+ MaxFileBuffer int
+ NextLine int64
+
+ // Website visits
+ NumWorkers int
+ Timeout time.Duration
+ MaxResponse int64
+
+ // Health and metrics
MetricsInterval time.Duration
- Timeout time.Duration
- MaxResponse int64
}
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.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.Int64Var(&opts.MaxResponse, "r", 128*1024*1024, "max response body size to accept")
+
flag.Parse()
return
}
diff --git a/internal/qna/qna.go b/internal/qna/qna.go
index 5336811..bd2078d 100644
--- a/internal/qna/qna.go
+++ b/internal/qna/qna.go
@@ -7,8 +7,6 @@ type Question struct {
type Answer struct {
Domain string // domain name of the visited HTTPS site
OK bool // true if HTTP GET request succeeded
-
- HTTP bool // true if onion location was found via HTTP header
- HTML bool // true if onion location was found via HTML attribute
- Onion string // the site's onion location URL (if any)
+ HTTP string // value set in the Onion-Location HTTP header (if any)
+ HTML string // value set in the Onion-Location HTML attribute (if any)
}