mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-25 10:07:43 +01:00
Merge pull request #6541 from salkin/proxy-transport
Add support for http proxy in transport
This commit is contained in:
commit
b28bca7af4
@ -39,7 +39,11 @@ func NewClient(c *http.Client, modifiers ...modifier.Modifier) *Client {
|
|||||||
client: c,
|
client: c,
|
||||||
}
|
}
|
||||||
if client.client == nil {
|
if client.client == nil {
|
||||||
client.client = &http.Client{}
|
client.client = &http.Client{
|
||||||
|
Transport: &http.Transport{
|
||||||
|
Proxy: http.ProxyFromEnvironment,
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if len(modifiers) > 0 {
|
if len(modifiers) > 0 {
|
||||||
client.modifiers = modifiers
|
client.modifiers = modifiers
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
// "time"
|
// "time"
|
||||||
|
|
||||||
commonhttp "github.com/goharbor/harbor/src/common/http"
|
commonhttp "github.com/goharbor/harbor/src/common/http"
|
||||||
@ -39,11 +40,13 @@ func init() {
|
|||||||
defaultHTTPTransport = &http.Transport{}
|
defaultHTTPTransport = &http.Transport{}
|
||||||
|
|
||||||
secureHTTPTransport = &http.Transport{
|
secureHTTPTransport = &http.Transport{
|
||||||
|
Proxy: http.ProxyFromEnvironment,
|
||||||
TLSClientConfig: &tls.Config{
|
TLSClientConfig: &tls.Config{
|
||||||
InsecureSkipVerify: false,
|
InsecureSkipVerify: false,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
insecureHTTPTransport = &http.Transport{
|
insecureHTTPTransport = &http.Transport{
|
||||||
|
Proxy: http.ProxyFromEnvironment,
|
||||||
TLSClientConfig: &tls.Config{
|
TLSClientConfig: &tls.Config{
|
||||||
InsecureSkipVerify: true,
|
InsecureSkipVerify: true,
|
||||||
},
|
},
|
||||||
|
@ -41,7 +41,7 @@ const (
|
|||||||
UsersURLSuffix = "/Users"
|
UsersURLSuffix = "/Users"
|
||||||
)
|
)
|
||||||
|
|
||||||
var uaaTransport = &http.Transport{}
|
var uaaTransport = &http.Transport{Proxy: http.ProxyFromEnvironment}
|
||||||
|
|
||||||
// Client provides funcs to interact with UAA.
|
// Client provides funcs to interact with UAA.
|
||||||
type Client interface {
|
type Client interface {
|
||||||
|
@ -135,6 +135,7 @@ func initProjectManager() error {
|
|||||||
}
|
}
|
||||||
AdmiralClient = &http.Client{
|
AdmiralClient = &http.Client{
|
||||||
Transport: &http.Transport{
|
Transport: &http.Transport{
|
||||||
|
Proxy: http.ProxyFromEnvironment,
|
||||||
TLSClientConfig: &tls.Config{
|
TLSClientConfig: &tls.Config{
|
||||||
RootCAs: pool,
|
RootCAs: pool,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user