func (pc *ProxyConfig) GetProxy(req *http.Request) (*url.URL, error) {
	pc.mu.Lock()
	defer pc.mu.Unlock()

	var proxy *url.URL
	if req.URL.Scheme == "https" {
		proxy = pc.https
	}
	if proxy == nil {
		proxy = pc.http
	}
	if proxy == nil {
		return nil, nil
	}
	if !pc.useProxy(canonicalAddr(req.URL)) {
		return nil, nil
	}
	return proxy, nil
}
// GetProxy returns the URL of the proxy to use for a given request as
// indicated by the proxy settings. It behaves the same as the
// net/http.ProxyFromEnvironment function, except that it uses the
// stored settings rather than pulling the configuration from
// environment variables. (The implementation is copied from
// net/http.ProxyFromEnvironment.)
GetProxy returns the URL of the proxy to use for a given request as
indicated by the proxy settings. It behaves the same as the
net/http.ProxyFromEnvironment function, except that it uses the
stored settings rather than pulling the configuration from
environment variables. (The implementation is copied from
net/http.ProxyFromEnvironment.)
// GetProxy returns the URL of the proxy to use for a given request as // indicated by the proxy settings . It behaves the same as the // net / http . ProxyFromEnvironment function except that it uses the // stored settings rather than pulling the configuration from // environment variables . ( The implementation is copied from // net / http . ProxyFromEnvironment . )
func (pc *ProxyConfig) GetProxy(req *http.Request) (*url.URL, error) {
	pc.mu.Lock()
	defer pc.mu.Unlock()
	var proxy *url.URL
	if req.URL.Scheme == "https" {
		proxy = pc.https
	}
	if proxy == nil {
		proxy = pc.http
	}
	if proxy == nil {
		return nil, nil
	}
	if !pc.useProxy(canonicalAddr(req.URL)) {
		return nil, nil
	}
	return proxy, nil
}
func ( pc * ProxyConfig ) GetProxy ( req * http . Request ) ( * url . URL , error ) { pc . mu . Lock ( ) defer pc . mu . Unlock ( ) var proxy * url . URL if req . URL . Scheme == " " { proxy = pc . https } if proxy == nil { proxy = pc . http } if proxy == nil { return nil , nil } if ! pc . useProxy ( canonicalAddr ( req . URL ) ) { return nil , nil } return proxy , nil }
GetProxy returns the URL of the proxy to use for a given request as
indicated by the proxy settings.
GetProxy returns the URL of the proxy to use for a given request as indicated by the proxy settings .