func BuildProxySettings(agentConfig Config) (map[string]string, error) {
	proxyHost := agentConfig["proxy_host"]

	proxyMap := make(map[string]string)

	if proxyHost == "" {
		// this is expected, not an error
		return nil, nil
	}

	var err error
	var u *url.URL

	if u, err = url.Parse(proxyHost); err != nil {
		return nil, fmt.Errorf("unable to import value of settings 'proxy_host': %v", err)
	}

	// set scheme if missing
	if u.Scheme == "" {
		u, _ = url.Parse("http://" + proxyHost)
	}

	if agentConfig["proxy_port"] != "" {
		u.Host = u.Host + ":" + agentConfig["proxy_port"]
	}

	if user := agentConfig["proxy_user"]; user != "" {
		if pass := agentConfig["proxy_password"]; pass != "" {
			u.User = url.UserPassword(user, pass)
		} else {
			u.User = url.User(user)
		}
	}

	proxyMap["http"] = u.String()
	proxyMap["https"] = u.String()

	return proxyMap, nil

}
// BuildProxySettings returns a map with http/https proxies based on old config
BuildProxySettings returns a map with http/https proxies based on old config
// BuildProxySettings returns a map with http / https proxies based on old config
func BuildProxySettings(agentConfig Config) (map[string]string, error) {
	proxyHost := agentConfig["proxy_host"]
	proxyMap := make(map[string]string)
	if proxyHost == "" {
		return nil, nil
	}
	var err error
	var u *url.URL
	if u, err = url.Parse(proxyHost); err != nil {
		return nil, fmt.Errorf("unable to import value of settings 'proxy_host': %v", err)
	}
	if u.Scheme == "" {
		u, _ = url.Parse("http://" + proxyHost)
	}
	if agentConfig["proxy_port"] != "" {
		u.Host = u.Host + ":" + agentConfig["proxy_port"]
	}
	if user := agentConfig["proxy_user"]; user != "" {
		if pass := agentConfig["proxy_password"]; pass != "" {
			u.User = url.UserPassword(user, pass)
		} else {
			u.User = url.User(user)
		}
	}
	proxyMap["http"] = u.String()
	proxyMap["https"] = u.String()
	return proxyMap, nil
}
func BuildProxySettings ( agentConfig Config ) ( map [ string ] string , error ) { proxyHost := agentConfig [ " " ] proxyMap := make ( map [ string ] string ) if proxyHost == " " { return nil , nil } var err error var u * url . URL if u , err = url . Parse ( proxyHost ) ; err != nil { return nil , fmt . Errorf ( " " , err ) } if u . Scheme == " " { u , _ = url . Parse ( " " + proxyHost ) } if agentConfig [ " " ] != " " { u . Host = u . Host + " " + agentConfig [ " " ] } if user := agentConfig [ " " ] ; user != " " { if pass := agentConfig [ " " ] ; pass != " " { u . User = url . UserPassword ( user , pass ) } else { u . User = url . User ( user ) } } proxyMap [ " " ] = u . String ( ) proxyMap [ " " ] = u . String ( ) return proxyMap , nil }
BuildProxySettings returns a map with http/https proxies based on old config
BuildProxySettings returns a map with http / https proxies based on old config
// this is expected, not an error // set scheme if missing