diff options
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 29 |
1 files changed, 15 insertions, 14 deletions
@@ -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 |