From 9279fb66cff35c6424778a77c9dbeb37a8e876cb Mon Sep 17 00:00:00 2001 From: Gabriel Adrian Samfira Date: Fri, 27 Jun 2025 07:18:54 +0000 Subject: [PATCH] Set http transport config This change sets the github client http transport options to mirror those of the default transport from Go, with the addition of the TLSClientConfig. Signed-off-by: Gabriel Adrian Samfira --- Makefile | 2 +- params/params.go | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index bce60045..f5337783 100644 --- a/Makefile +++ b/Makefile @@ -106,7 +106,7 @@ $(LOCALBIN): GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint ## Tool Versions -GOLANGCI_LINT_VERSION ?= v1.61.0 +GOLANGCI_LINT_VERSION ?= v1.64.8 .PHONY: golangci-lint golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary. If wrong version is installed, it will be overwritten. diff --git a/params/params.go b/params/params.go index c44891bd..ed9403b2 100644 --- a/params/params.go +++ b/params/params.go @@ -22,6 +22,7 @@ import ( "encoding/json" "encoding/pem" "fmt" + "net" "net/http" "time" @@ -642,11 +643,22 @@ func (g GithubCredentials) GetHTTPClient(ctx context.Context) (*http.Client, err } } + dialer := &net.Dialer{ + Timeout: 30 * time.Second, + KeepAlive: 30 * time.Second, + } + httpTransport := &http.Transport{ + Proxy: http.ProxyFromEnvironment, + DialContext: dialer.DialContext, TLSClientConfig: &tls.Config{ RootCAs: roots, MinVersion: tls.VersionTLS12, }, + ForceAttemptHTTP2: true, + IdleConnTimeout: 90 * time.Second, + TLSHandshakeTimeout: 10 * time.Second, + ExpectContinueTimeout: 1 * time.Second, } var tc *http.Client