fix lint errors

This commit is contained in:
Pavel 2024-06-06 14:11:11 +03:00
parent 655b86abb0
commit 8c71692047

View File

@ -17,6 +17,14 @@ import (
"github.com/retailcrm/mg-transport-core/v2/core/logger" "github.com/retailcrm/mg-transport-core/v2/core/logger"
) )
const (
defaultDialerTimeout = 30 * time.Second
defaultIdleConnTimeout = 90 * time.Second
defaultTLSHandshakeTimeout = 10 * time.Second
defaultExpectContinueTimeout = 1 * time.Second
defaultMaxIdleConns = 100
)
// DefaultClient stores original http.DefaultClient. // DefaultClient stores original http.DefaultClient.
var DefaultClient = http.DefaultClient var DefaultClient = http.DefaultClient
@ -71,17 +79,17 @@ func NewHTTPClientBuilder() *HTTPClientBuilder {
httpTransport: &http.Transport{ httpTransport: &http.Transport{
Proxy: http.ProxyFromEnvironment, Proxy: http.ProxyFromEnvironment,
DialContext: (&net.Dialer{ DialContext: (&net.Dialer{
Timeout: 30 * time.Second, Timeout: defaultDialerTimeout,
KeepAlive: 30 * time.Second, KeepAlive: defaultDialerTimeout,
}).DialContext, }).DialContext,
ForceAttemptHTTP2: true, ForceAttemptHTTP2: true,
MaxIdleConns: 100, MaxIdleConns: defaultMaxIdleConns,
IdleConnTimeout: 90 * time.Second, IdleConnTimeout: defaultIdleConnTimeout,
TLSHandshakeTimeout: 10 * time.Second, TLSHandshakeTimeout: defaultTLSHandshakeTimeout,
ExpectContinueTimeout: 1 * time.Second, ExpectContinueTimeout: defaultExpectContinueTimeout,
}, },
tlsVersion: tls.VersionTLS12, tlsVersion: tls.VersionTLS12,
timeout: 30 * time.Second, timeout: defaultDialerTimeout,
mockAddress: "", mockAddress: "",
mockedDomains: []string{}, mockedDomains: []string{},
logging: false, logging: false,