From fbf7fed2cea03994741fa6f3a3a526fa5bbdc0f6 Mon Sep 17 00:00:00 2001 From: ston1th Date: Sat, 16 Oct 2021 18:00:33 +0200 Subject: [PATCH] added more default client options --- netbox/netbox.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/netbox/netbox.go b/netbox/netbox.go index 8bfe492..6889eb6 100644 --- a/netbox/netbox.go +++ b/netbox/netbox.go @@ -90,8 +90,14 @@ func NewAllocator(opts ...Option) (netalloc.Allocator, error) { if a.httpClient == nil { a.httpClient = &http.Client{Transport: &http.Transport{ DialContext: (&net.Dialer{ - Timeout: 30 * time.Second, + Timeout: 30 * time.Second, + KeepAlive: 30 * time.Second, }).DialContext, + ForceAttemptHTTP2: true, + MaxIdleConns: 100, + IdleConnTimeout: 90 * time.Second, + TLSHandshakeTimeout: 10 * time.Second, + ExpectContinueTimeout: 1 * time.Second, TLSClientConfig: &tls.Config{ InsecureSkipVerify: a.insecure, },