Bump github.com/tsenart/vegeta/v12 from 12.11.3 to 12.12.0 (#3082)

* 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] <support@github.com>

* Run ./hack/update-codegen.sh

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
dependabot[bot] 2024-08-05 06:37:31 +00:00 committed by GitHub
parent cb30d007bf
commit c88d5dad96
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 46 additions and 4 deletions

2
go.mod
View File

@ -20,7 +20,7 @@ require (
github.com/kelseyhightower/envconfig v1.4.0
github.com/openzipkin/zipkin-go v0.4.3
github.com/spf13/pflag v1.0.5
github.com/tsenart/vegeta/v12 v12.11.3
github.com/tsenart/vegeta/v12 v12.12.0
go.opencensus.io v0.24.0
go.uber.org/automaxprocs v1.5.3
go.uber.org/zap v1.27.0

4
go.sum
View File

@ -341,8 +341,8 @@ github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o
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/stvp/go-udp-testing v0.0.0-20201019212854-469649b16807/go.mod h1:7jxmlfBCDBXRzr0eAQJ48XC1hBu1np4CS5+cHEYfwpc=
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=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=

View File

@ -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

2
vendor/modules.txt vendored
View File

@ -182,7 +182,7 @@ github.com/rs/dnscache
# github.com/spf13/pflag v1.0.5
## explicit; go 1.12
github.com/spf13/pflag
# 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
# go.opencensus.io v0.24.0