From 61d7eb27191fdcb3f5c406f17c30a0b998e8accd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 30 Jul 2024 04:30:49 +0000 Subject: [PATCH] Bump github.com/tsenart/vegeta/v12 from 12.11.3 to 12.12.0 Bumps [github.com/tsenart/vegeta/v12](https://github.com/tsenart/vegeta) from 12.11.3 to 12.12.0. - [Release notes](https://github.com/tsenart/vegeta/releases) - [Changelog](https://github.com/tsenart/vegeta/blob/master/CHANGELOG) - [Commits](https://github.com/tsenart/vegeta/compare/v12.11.3...v12.12.0) --- updated-dependencies: - dependency-name: github.com/tsenart/vegeta/v12 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 +- .../tsenart/vegeta/v12/lib/attack.go | 42 +++++++++++++++++++ vendor/modules.txt | 2 +- 4 files changed, 46 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 73abb03c..25a7e460 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/onsi/gomega v1.34.0 github.com/prometheus/client_golang v1.19.1 github.com/prometheus/client_model v0.6.1 - github.com/tsenart/vegeta/v12 v12.11.3 + github.com/tsenart/vegeta/v12 v12.12.0 ) require ( diff --git a/go.sum b/go.sum index d418174e..8b42e086 100644 --- a/go.sum +++ b/go.sum @@ -62,8 +62,8 @@ github.com/streadway/quantile v0.0.0-20220407130108-4246515d968d h1:X4+kt6zM/OVO github.com/streadway/quantile v0.0.0-20220407130108-4246515d968d/go.mod h1:lbP8tGiBjZ5YWIc2fzuRpTaz0b/53vT6PEs3QuAWzuU= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/tsenart/vegeta/v12 v12.11.3 h1:U0rW+Vt/WrG2566n6YXcijvP41EoKzL8/85Xnx+f/wQ= -github.com/tsenart/vegeta/v12 v12.11.3/go.mod h1:gpdfR++WHV9/RZh4oux0f6lNPhsOH8pCjIGUlcPQe1M= +github.com/tsenart/vegeta/v12 v12.12.0 h1:FKMMNomd3auAElO/TtbXzRFXAKGee6N/GKCGweFVm2U= +github.com/tsenart/vegeta/v12 v12.12.0/go.mod h1:gpdfR++WHV9/RZh4oux0f6lNPhsOH8pCjIGUlcPQe1M= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20240119083558-1b970713d09a h1:Q8/wZp0KX97QFTc2ywcOE0YRjZPVIx+MXInMzdvQqcA= golang.org/x/exp v0.0.0-20240119083558-1b970713d09a/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08= diff --git a/vendor/github.com/tsenart/vegeta/v12/lib/attack.go b/vendor/github.com/tsenart/vegeta/v12/lib/attack.go index 0e43e91f..d2f1cf5a 100644 --- a/vendor/github.com/tsenart/vegeta/v12/lib/attack.go +++ b/vendor/github.com/tsenart/vegeta/v12/lib/attack.go @@ -28,6 +28,9 @@ type Attacker struct { maxWorkers uint64 maxBody int64 redirects int + seqmu sync.Mutex + seq uint64 + began time.Time chunked bool } @@ -272,6 +275,45 @@ func ProxyHeader(h http.Header) func(*Attacker) { } } +// ConnectTo returns a functional option which makes the attacker use the +// passed in map to translate target addr:port pairs. When used with DNSCaching, +// it must be used after it. +func ConnectTo(addrMap map[string][]string) func(*Attacker) { + return func(a *Attacker) { + if len(addrMap) == 0 { + return + } + + tr, ok := a.client.Transport.(*http.Transport) + if !ok { + return + } + + dial := tr.DialContext + if dial == nil { + dial = a.dialer.DialContext + } + + type roundRobin struct { + addrs []string + n int + } + + connectTo := make(map[string]*roundRobin, len(addrMap)) + for k, v := range addrMap { + connectTo[k] = &roundRobin{addrs: v} + } + + tr.DialContext = func(ctx context.Context, network, addr string) (net.Conn, error) { + if cm, ok := connectTo[addr]; ok { + cm.n = (cm.n + 1) % len(cm.addrs) + addr = cm.addrs[cm.n] + } + return dial(ctx, network, addr) + } + } +} + // DNSCaching returns a functional option that enables DNS caching for // the given ttl. When ttl is zero cached entries will never expire. // When ttl is non-zero, this will start a refresh go-routine that updates diff --git a/vendor/modules.txt b/vendor/modules.txt index 10d09d91..d8b4a332 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -114,7 +114,7 @@ github.com/prometheus/procfs/internal/util # github.com/rs/dnscache v0.0.0-20230804202142-fc85eb664529 ## explicit; go 1.12 github.com/rs/dnscache -# github.com/tsenart/vegeta/v12 v12.11.3 +# github.com/tsenart/vegeta/v12 v12.12.0 ## explicit; go 1.22 github.com/tsenart/vegeta/v12/lib # golang.org/x/net v0.27.0