Skip to content

Commit

Permalink
Remove dependency on vegeta from default
Browse files Browse the repository at this point in the history
  • Loading branch information
nakabonne committed Oct 8, 2020
1 parent 06cefb6 commit c10cfb2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion attacker/attacker.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const (
DefaultConnections = 10000
)

var DefaultLocalAddr = net.IPAddr{IP: net.IPv4zero}

type Attacker interface {
Attack(vegeta.Targeter, vegeta.Pacer, time.Duration, string) <-chan *vegeta.Result
Stop()
Expand Down Expand Up @@ -75,7 +77,7 @@ func Attack(ctx context.Context, target string, resCh chan *Result, metricsCh ch
opts.Connections = DefaultConnections
}
if opts.LocalAddr.IP == nil {
opts.LocalAddr = vegeta.DefaultLocalAddr
opts.LocalAddr = DefaultLocalAddr
}
if opts.Attacker == nil {
opts.Attacker = vegeta.NewAttacker(
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ func parseFlags(stdout, stderr io.Writer) (*cli, error) {
flagSet.Uint64VarP(&c.workers, "workers", "w", attacker.DefaultWorkers, "Amount of initial workers to spawn.")
flagSet.Uint64VarP(&c.maxWorkers, "max-workers", "W", attacker.DefaultMaxWorkers, "Amount of maximum workers to spawn.")
flagSet.IntVarP(&c.connections, "connections", "c", attacker.DefaultConnections, "Amount of maximum open idle connections per target host")
flagSet.BoolVar(&c.http2, "http2", true, "Issue HTTP/2 requests to servers which support it. (default true)")
flagSet.StringVarP(&c.localAddress, "local-address", "L", "0.0.0.0", "Local IP address.")
flagSet.BoolVar(&c.http2, "http2", true, "Issue HTTP/2 requests to servers which support it.")
flagSet.StringVar(&c.localAddress, "local-addr", "0.0.0.0", "Local IP address.")
flagSet.Usage = c.usage
if err := flagSet.Parse(os.Args[1:]); err != nil {
if !errors.Is(err, flag.ErrHelp) {
Expand Down

0 comments on commit c10cfb2

Please sign in to comment.