Documentation
¶
Index ¶
- func CreateHTTPClient(proxy string) (*http.Client, error)
- func GetHttpProxy() string
- func GetHttpsProxy() string
- func GetProxy(targetURL string) (string, error)
- func GetTLSConfig() *tls.Config
- func GetTransport(proxy string) (*http.Transport, error)
- func ParseProxy(proxy *share.CLUSProxy) string
- func SetDefaultTLSClientConfig(config *TLSClientSettings, httpProxy string, httpsProxy string, noProxy string) (err error)
- type TLSClientSettings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateHTTPClient ¶
This function creates a HTTP client using GetTransport().
Basically a wrapper of GetTransport(). If the proxy setting doesn't exist, GetTransport() will create a new Transport for it.
func GetHttpProxy ¶
func GetHttpProxy() string
Get HTTP proxy setting.
A convenient function to get the latest setting without implementing consul config notification.
func GetHttpsProxy ¶
func GetHttpsProxy() string
Get HTTPS proxy setting.
A convenient function to get the latest setting without implementing consul config notification.
func GetTLSConfig ¶
Get the current TLS config
This function doesn't support proxy, so it's not recommended in most cases. Use GetSharedTransport() or CreateHTTPClient()instead.
func GetTransport ¶
Get the shared http.Transport with the proxy url.
Note that proxy url must contain user name and password. If there is no transport available, this function creates a new transport for it using shared TLS config.
func ParseProxy ¶
Convert share.CLUSProxy to a proxy url with username and password.
func SetDefaultTLSClientConfig ¶
func SetDefaultTLSClientConfig(config *TLSClientSettings, httpProxy string, httpsProxy string, noProxy string) (err error)
Change TLS config and update related connection pools (http.Transport).
noProxy has no effect for now.
Note: When this function is called, a new set of connection pools will be created to prevent issue in the existing clients.