HTTP load generator, ApacheBench (ab) replacement
Go
add feature: disable keepalive
Artem Andreenko4791ce8c938f
diff --git a/boom.go b/boom.goindex f19a898..17ad7da 100644--- a/boom.go+++ b/boom.go@@ -44,6 +44,7 @@ var (flagInsecure = flag.Bool("allow-insecure", false, "")flagDisableCompression = flag.Bool("disable-compression", false, "")+ flagDisableKeepAlives = flag.Bool("disable-keepalive", false, ""))var usage = `Usage: boom [options...] <url>@@ -65,8 +66,9 @@ Options:-a Basic authentication, username:password.-x HTTP Proxy address as host:port- -allow-insecure Allow bad/expired TLS/SSL certificates.- -disable-compression Disable compression+ -allow-insecure Allow bad/expired TLS/SSL certificates.+ -disable-compression Disable compression+ -disable-keepalive Disable keep-alive, prevents re-use of TCP connections between different HTTP requests`// Default DNS resolver.@@ -166,6 +168,7 @@ func main() {Timeout: t,AllowInsecure: *flagInsecure,DisableCompression: *flagDisableCompression,+ DisableKeepAlives: *flagDisableKeepAlives,Output: *flagOutput,ProxyAddr: *flagProxyAddr}).Run()}diff --git a/boomer/boomer.go b/boomer/boomer.goindex fb5e76c..bb3de8d 100644--- a/boomer/boomer.go+++ b/boomer/boomer.go@@ -73,6 +73,9 @@ type Boomer struct {// Option to disable decompress responseDisableCompression bool+ // Option to prevents re-use of TCP connections between different HTTP requests+ DisableKeepAlives bool+// Output typeOutput stringdiff --git a/boomer/run.go b/boomer/run.goindex 70a87a0..34f6345 100644--- a/boomer/run.go+++ b/boomer/run.go@@ -38,6 +38,7 @@ func (b *Boomer) worker(ch chan *http.Request) {tr := &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: b.AllowInsecure, ServerName: host},DisableCompression: b.DisableCompression,+ DisableKeepAlives: b.DisableKeepAlives,}if b.ProxyAddr != "" {tr.Dial = func(network string, addr string) (conn net.Conn, err error) {