Remove some dead code from the scanner
This commit is contained in:
parent
74f9ceb6a2
commit
19e05b901a
|
@ -29,7 +29,6 @@ import (
|
||||||
|
|
||||||
var batchSize = flag.Int("batch_size", 1000, "Max number of entries to request at per call to get-entries")
|
var batchSize = flag.Int("batch_size", 1000, "Max number of entries to request at per call to get-entries")
|
||||||
var numWorkers = flag.Int("num_workers", 2, "Number of concurrent matchers")
|
var numWorkers = flag.Int("num_workers", 2, "Number of concurrent matchers")
|
||||||
var parallelFetch = flag.Int("parallel_fetch", 2, "Number of concurrent GetEntries fetches")
|
|
||||||
var script = flag.String("script", "", "Script to execute when a matching certificate is found")
|
var script = flag.String("script", "", "Script to execute when a matching certificate is found")
|
||||||
var logsFilename = flag.String("logs", "", "JSON file containing log URLs")
|
var logsFilename = flag.String("logs", "", "JSON file containing log URLs")
|
||||||
var underwater = flag.Bool("underwater", false, "Monitor certificates from distrusted CAs instead of trusted CAs")
|
var underwater = flag.Bool("underwater", false, "Monitor certificates from distrusted CAs instead of trusted CAs")
|
||||||
|
@ -186,7 +185,6 @@ func Main (argStateDir string, processCallback certspotter.ProcessCallback) int
|
||||||
opts := certspotter.ScannerOptions{
|
opts := certspotter.ScannerOptions{
|
||||||
BatchSize: *batchSize,
|
BatchSize: *batchSize,
|
||||||
NumWorkers: *numWorkers,
|
NumWorkers: *numWorkers,
|
||||||
ParallelFetch: *parallelFetch,
|
|
||||||
Quiet: !*verbose,
|
Quiet: !*verbose,
|
||||||
}
|
}
|
||||||
scanner := certspotter.NewScanner(logUri, logKey, &opts)
|
scanner := certspotter.NewScanner(logUri, logKey, &opts)
|
||||||
|
|
27
scanner.go
27
scanner.go
|
@ -6,6 +6,9 @@
|
||||||
//
|
//
|
||||||
// This software is distributed WITHOUT A WARRANTY OF ANY KIND.
|
// This software is distributed WITHOUT A WARRANTY OF ANY KIND.
|
||||||
// See the Mozilla Public License for details.
|
// See the Mozilla Public License for details.
|
||||||
|
//
|
||||||
|
// This file contains code from https://github.com/google/certificate-transparency/tree/master/go
|
||||||
|
// See ct/AUTHORS and ct/LICENSE for copyright and license information.
|
||||||
|
|
||||||
package certspotter
|
package certspotter
|
||||||
|
|
||||||
|
@ -38,9 +41,6 @@ type ScannerOptions struct {
|
||||||
// Number of concurrent proecssors to run
|
// Number of concurrent proecssors to run
|
||||||
NumWorkers int
|
NumWorkers int
|
||||||
|
|
||||||
// Number of concurrent fethers to run
|
|
||||||
ParallelFetch int
|
|
||||||
|
|
||||||
// Don't print any status messages to stdout
|
// Don't print any status messages to stdout
|
||||||
Quiet bool
|
Quiet bool
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,6 @@ func DefaultScannerOptions() *ScannerOptions {
|
||||||
return &ScannerOptions{
|
return &ScannerOptions{
|
||||||
BatchSize: 1000,
|
BatchSize: 1000,
|
||||||
NumWorkers: 1,
|
NumWorkers: 1,
|
||||||
ParallelFetch: 1,
|
|
||||||
Quiet: false,
|
Quiet: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -260,26 +259,6 @@ func (s *Scanner) Scan(startIndex int64, endIndex int64, processCert ProcessCall
|
||||||
go s.processerJob(w, jobs, processCert, &processorWG)
|
go s.processerJob(w, jobs, processCert, &processorWG)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start fetcher workers
|
|
||||||
/* parallel fetcher - disabled for now because it complicates tree building
|
|
||||||
var ranges list.List
|
|
||||||
for start := startIndex; start < int64(endIndex); {
|
|
||||||
end := min(start+int64(s.opts.BatchSize), int64(endIndex)) - 1
|
|
||||||
ranges.PushBack(fetchRange{start, end})
|
|
||||||
start = end + 1
|
|
||||||
}
|
|
||||||
var fetcherWG sync.WaitGroup
|
|
||||||
fetches := make(chan fetchRange, 1000)
|
|
||||||
for w := 0; w < s.opts.ParallelFetch; w++ {
|
|
||||||
fetcherWG.Add(1)
|
|
||||||
go s.fetcherJob(w, fetches, jobs, &fetcherWG)
|
|
||||||
}
|
|
||||||
for r := ranges.Front(); r != nil; r = r.Next() {
|
|
||||||
fetches <- r.Value.(fetchRange)
|
|
||||||
}
|
|
||||||
close(fetches)
|
|
||||||
fetcherWG.Wait()
|
|
||||||
*/
|
|
||||||
for start := startIndex; start < int64(endIndex); {
|
for start := startIndex; start < int64(endIndex); {
|
||||||
end := min(start+int64(s.opts.BatchSize), int64(endIndex)) - 1
|
end := min(start+int64(s.opts.BatchSize), int64(endIndex)) - 1
|
||||||
if err := s.fetch(fetchRange{start, end}, jobs, treeBuilder); err != nil {
|
if err := s.fetch(fetchRange{start, end}, jobs, treeBuilder); err != nil {
|
||||||
|
|
Loading…
Reference in New Issue