mirror of
https://github.com/containrrr/watchtower.git
synced 2025-09-22 05:40:50 +02:00
fix: use default http transport for head (#926)
note: still disables TLS verification to enable use with local regisitries
This commit is contained in:
parent
d38e52b5c6
commit
fdf6e46e7b
1 changed files with 13 additions and 1 deletions
|
@ -10,8 +10,10 @@ import (
|
||||||
"github.com/containrrr/watchtower/pkg/registry/manifest"
|
"github.com/containrrr/watchtower/pkg/registry/manifest"
|
||||||
"github.com/containrrr/watchtower/pkg/types"
|
"github.com/containrrr/watchtower/pkg/types"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContentDigestHeader is the key for the key-value pair containing the digest header
|
// ContentDigestHeader is the key for the key-value pair containing the digest header
|
||||||
|
@ -69,7 +71,17 @@ func TransformAuth(registryAuth string) string {
|
||||||
// GetDigest from registry using a HEAD request to prevent rate limiting
|
// GetDigest from registry using a HEAD request to prevent rate limiting
|
||||||
func GetDigest(url string, token string) (string, error) {
|
func GetDigest(url string, token string) (string, error) {
|
||||||
tr := &http.Transport{
|
tr := &http.Transport{
|
||||||
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
|
Proxy: http.ProxyFromEnvironment,
|
||||||
|
DialContext: (&net.Dialer{
|
||||||
|
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: true},
|
||||||
}
|
}
|
||||||
client := &http.Client{Transport: tr}
|
client := &http.Client{Transport: tr}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue