Documentation ¶
Index ¶
- func HTTPTransport() http.RoundTripper
- func URIStringForDisplay(uri string) (string, error)
- func ValidateProxyURL(proxyURL string, isHTTPSProxy bool) error
- type ProxyConfig
- func (p *ProxyConfig) AddNoProxy(host ...string)
- func (p *ProxyConfig) ApplyToEnvironment()
- func (p *ProxyConfig) GetNoProxyString() string
- func (p *ProxyConfig) HTTPProxyForDisplay() string
- func (p *ProxyConfig) HTTPSProxyForDisplay() string
- func (p *ProxyConfig) HTTPTransport() http.RoundTripper
- func (p *ProxyConfig) IsEnabled() bool
- func (p *ProxyConfig) ProxyFunc() func(req *http.Request) (*url.URL, error)
- func (p *ProxyConfig) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HTTPTransport ¶
func HTTPTransport() http.RoundTripper
func URIStringForDisplay ¶
func ValidateProxyURL ¶
ValidateProxyURL validates that the specified proxyURL is valid
Types ¶
type ProxyConfig ¶
type ProxyConfig struct { HTTPProxy string HTTPSProxy string ProxyCACert string ProxyCAFile string // contains filtered or unexported fields }
ProxyConfig keeps the proxy configuration for the current environment
var (
DefaultProxy ProxyConfig
)
func NewProxyConfig ¶
func NewProxyConfig() (*ProxyConfig, error)
NewProxyConfig creates a proxy configuration with the specified parameters. If an empty string is passed the corresponding environment variable is checked.
func NewProxyDefaults ¶
func NewProxyDefaults(httpProxy, httpsProxy, noProxy, proxyCAFile string) (*ProxyConfig, error)
func (*ProxyConfig) AddNoProxy ¶
func (p *ProxyConfig) AddNoProxy(host ...string)
AddNoProxy appends the specified host to the list of no proxied hosts.
func (*ProxyConfig) ApplyToEnvironment ¶
func (p *ProxyConfig) ApplyToEnvironment()
Sets the current config as environment variables in the current process.
func (*ProxyConfig) GetNoProxyString ¶
func (p *ProxyConfig) GetNoProxyString() string
func (*ProxyConfig) HTTPProxyForDisplay ¶
func (p *ProxyConfig) HTTPProxyForDisplay() string
HTTPProxy with hidden credentials
func (*ProxyConfig) HTTPSProxyForDisplay ¶
func (p *ProxyConfig) HTTPSProxyForDisplay() string
HTTPSProxy with hidden credentials
func (*ProxyConfig) HTTPTransport ¶
func (p *ProxyConfig) HTTPTransport() http.RoundTripper
func (*ProxyConfig) IsEnabled ¶
func (p *ProxyConfig) IsEnabled() bool
Enabled returns true if at least one proxy (HTTP or HTTPS) is configured. Returns false otherwise.
func (*ProxyConfig) ProxyFunc ¶
This wraps https://pkg.go.dev/golang.org/x/net/http/httpproxy#Config.ProxyFunc This can be called on a nil *ProxyConfig
func (*ProxyConfig) String ¶
func (p *ProxyConfig) String() string