connections per host implementation
This commit is contained in:
parent
17afe8a6dd
commit
7764297a42
23
config.go
23
config.go
@ -10,15 +10,15 @@ import (
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
OutputFileName string `short:"o" long:"output-file" default:"-" description:"Output filename, use - for stdout"`
|
||||
InputFileName string `short:"f" long:"input-file" default:"-" description:"Input filename, use - for stdin"`
|
||||
MetaFileName string `short:"m" long:"metadata-file" default:"-" description:"Metadata filename, use - for stdout"`
|
||||
LogFileName string `short:"l" long:"log-file" default:"-" description:"Log filename, use - for stdout"`
|
||||
Interface string `short:"i" long:"interface" description:"Network interface to send on"`
|
||||
Senders int `short:"s" long:"senders" default:"1000" description:"Number of send goroutines to use"`
|
||||
GOMAXPROCS int `long:"gomaxprocs" default:"0" description:"Set GOMAXPROCS"`
|
||||
ConnectionsPerHost int `long:"connections-per-host" default:"1" description:"Number of times to connect to each host (results in more output)"`
|
||||
Prometheus string `long:"prometheus" description:"Address to use for Prometheus server (e.g. localhost:8080). If empty, Prometheus is disabled."`
|
||||
OutputFileName string `short:"o" long:"output-file" default:"-" description:"Output filename, use - for stdout"`
|
||||
InputFileName string `short:"f" long:"input-file" default:"-" description:"Input filename, use - for stdin"`
|
||||
MetaFileName string `short:"m" long:"metadata-file" default:"-" description:"Metadata filename, use - for stdout"`
|
||||
LogFileName string `short:"l" long:"log-file" default:"-" description:"Log filename, use - for stdout"`
|
||||
Interface string `short:"i" long:"interface" description:"Network interface to send on"`
|
||||
Senders int `short:"s" long:"senders" default:"1000" description:"Number of send goroutines to use"`
|
||||
GOMAXPROCS int `long:"gomaxprocs" default:"0" description:"Set GOMAXPROCS"`
|
||||
ConnectionsPerHost int `long:"connections-per-host" default:"1" description:"Number of times to connect to each host (results in more output)"`
|
||||
Prometheus string `long:"prometheus" description:"Address to use for Prometheus server (e.g. localhost:8080). If empty, Prometheus is disabled."`
|
||||
Multiple MultipleCommand `command:"multiple" description:"Multiple module actions"`
|
||||
|
||||
inputFile *os.File
|
||||
@ -98,6 +98,11 @@ func validateFrameworkConfiguration() {
|
||||
log.Fatalf("need at least one sender, given %d", config.Senders)
|
||||
}
|
||||
|
||||
// validate connections per host
|
||||
if config.ConnectionsPerHost <= 0 {
|
||||
log.Fatalf("need at least one connection, given %d", config.ConnectionsPerHost)
|
||||
}
|
||||
|
||||
// Stop the lowliest idiot from using this to DoS people
|
||||
if config.ConnectionsPerHost > 50 || config.ConnectionsPerHost < 1 {
|
||||
log.Fatalf("connectionsPerHost must be in the range [0,50]")
|
||||
|
@ -88,8 +88,10 @@ func Process(mon *Monitor) {
|
||||
for i := 0; i < workers; i++ {
|
||||
go func() {
|
||||
for obj := range processQueue {
|
||||
result := grabTarget(obj, mon)
|
||||
outputQueue <- result
|
||||
for run := uint(0); run < config.ConnectionsPerHost; run++ {
|
||||
result := grabTarget(obj, mon)
|
||||
outputQueue <- result
|
||||
}
|
||||
}
|
||||
workerDone.Done()
|
||||
}()
|
||||
|
Loading…
Reference in New Issue
Block a user