code: func proxyFromClient(c *Client) func(req *http.Request) (*url.URL, error) {
  	return func(req *http.Request) (*url.URL, error) {
  		httpsProxy, httpProxy, noProxy := getProxyServers(req.URL, c.uc, c.osEnv)
  
  		var proxy string
  		if req.URL.Scheme == "https" {
  			proxy = httpsProxy
  		}
  
  		if len(proxy) == 0 {
  			proxy = httpProxy
  		}
  
  		if len(proxy) == 0 {
  			return nil, nil
  		}
  
  		if !useProxy(noProxy, canonicalAddr(req.URL)) {
  			return nil, nil
  		}
  
  		proxyURL, err := url.Parse(proxy)
  		if err != nil || !strings.HasPrefix(proxyURL.Scheme, "http") {
  			// proxy was bogus. Try prepending "http://" to it and
  			// see if that parses correctly. If not, we fall
  			// through and complain about the original one.
  			if httpProxyURL, httpErr := url.Parse("http://" + proxy); httpErr == nil {
  				return httpProxyURL, nil
  			}
  		}
  		if err != nil {
  			return nil, fmt.Errorf("invalid proxy address: %q: %v", proxy, err)
  		}
  		return proxyURL, nil
  	}
  }
docs: // Logic is copied, with small changes, from "net/http".ProxyFromEnvironment in the go std lib.