Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable proxy for remaining clients #152

Merged
merged 5 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pkg/client/acr/acr.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ type ACRManifestResponse struct {

func New(opts Options) (*Client, error) {
client := &http.Client{
Timeout: time.Second * 5,
Timeout: time.Second * 5,
Transport: &http.Transport{Proxy: http.ProxyFromEnvironment},
}

if len(opts.RefreshToken) > 0 &&
Expand Down
3 changes: 2 additions & 1 deletion pkg/client/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ type Image struct {

func New(ctx context.Context, opts Options) (*Client, error) {
client := &http.Client{
Timeout: time.Second * 10,
Timeout: time.Second * 10,
Transport: &http.Transport{Proxy: http.ProxyFromEnvironment},
}

// Setup Auth if username and password used.
Expand Down
3 changes: 3 additions & 0 deletions pkg/client/ecr/ecr.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package ecr
import (
"context"
"fmt"
"net/http"
"sync"

"github.com/aws/aws-sdk-go/aws"
Expand Down Expand Up @@ -102,6 +103,8 @@ func (c *Client) getClient(region string) (*ecr.ECR, error) {
return nil, err
}
}
// Try and use an HTTP(S) Proxies defined within Environment variables.
client.Config.WithHTTPClient(&http.Client{Transport: &http.Transport{Proxy: http.ProxyFromEnvironment}})

c.cachedRegionClients[region] = client
return client, nil
Expand Down
9 changes: 6 additions & 3 deletions pkg/client/gcr/gcr.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,14 @@ type ManifestItem struct {
}

func New(opts Options) *Client {
client := &http.Client{
Timeout: time.Second * 5,
Transport: &http.Transport{Proxy: http.ProxyFromEnvironment},
}

return &Client{
Options: opts,
Client: &http.Client{
Timeout: time.Second * 5,
},
Client: client,
}
}

Expand Down
3 changes: 2 additions & 1 deletion pkg/client/ghcr/ghcr.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ func New(opts Options) *Client {
return &Client{
Options: opts,
Client: &http.Client{
Timeout: time.Second * 5,
Timeout: time.Second * 5,
Transport: &http.Transport{Proxy: http.ProxyFromEnvironment},
},
}
}
Expand Down
1 change: 1 addition & 0 deletions pkg/client/quay/quay.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ type responseManifestDataItem struct {

func New(opts Options) *Client {
client := retryablehttp.NewClient()
client.HTTPClient.Transport = &http.Transport{Proxy: http.ProxyFromEnvironment}
client.RetryMax = 10
client.Logger = nil

Expand Down
Loading