aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus@rgdd.se>2023-03-25 17:58:45 +0100
committerRasmus Dahlberg <rasmus@rgdd.se>2023-03-25 17:58:45 +0100
commit12a8f863db1cfafb9f4b45d705518a662623f684 (patch)
treefa236df23922cc37e2e4db6c3c14e8ae651c91c3 /main.go
parentb0a9fe6d718947863058d2a3acb884cabd831381 (diff)
Fix a few nits
Diffstat (limited to 'main.go')
-rw-r--r--main.go29
1 files changed, 15 insertions, 14 deletions
diff --git a/main.go b/main.go
index 146a62e..6fcdd00 100644
--- a/main.go
+++ b/main.go
@@ -1,5 +1,5 @@
-// Package main provides onion-grab, a tool that visits a list of domains
-// concurrently over HTTPS to see if they have Onion-Location configured.
+// Package main provides onion-grab, a tool that visits a list of domains over
+// HTTPS to see if they have Onion-Location configured.
//
// Install:
//
@@ -94,7 +94,7 @@ func main() {
if opts.NextLine != 0 {
warn += fmt.Sprintf(" (line %d relative to start)", nextLine-opts.NextLine)
}
- log.Printf("WARNING: %s\n", warn)
+ log.Printf("NOTICE: %s\n", warn)
}
}
@@ -217,18 +217,19 @@ func workGenerator(ctx context.Context, opts options.Options, fp *os.File, quest
scanner.Buffer(buf, opts.MaxFileBuffer*1024*1024)
nextLine := int64(0)
- for scanner.Scan() {
- select {
- case <-ctx.Done():
- return nextLine, false
- default:
- }
+ if opts.NextLine > nextLine {
+ for scanner.Scan() {
+ select {
+ case <-ctx.Done():
+ return nextLine, false
+ default:
+ }
- if nextLine == opts.NextLine {
- break
+ if nextLine+1 == opts.NextLine {
+ break
+ }
+ nextLine++
}
- scanner.Text()
- nextLine++
}
ticker := time.NewTicker(opts.MetricsInterval)
@@ -244,8 +245,8 @@ func workGenerator(ctx context.Context, opts options.Options, fp *os.File, quest
case <-ticker.C:
now := time.Now().Unix()
log.Printf("INFO: currently %.1f sites/s, %.1f sites/s since start\n",
- float64(nextLine-opts.NextLine)/float64(now-startTime),
float64(nextLine-latestCount)/float64(now-latestTime),
+ float64(nextLine-opts.NextLine)/float64(now-startTime),
)
latestCount = nextLine