func VerifyLoginURL()

in cli/net/net.go [262:287]


func VerifyLoginURL(network *Network) error {
	url, err := url.Parse(network.BrooklynUrl)
	if err != nil {
		return err
	}
	if url.Scheme != "http" && url.Scheme != "https" {
		return errors.New("Use login command to set Brooklyn URL with a scheme of \"http\" or \"https\"")
	}
	if url.Host == "" {
		return errors.New("Use login command to set Brooklyn URL with a valid host[:port]")
	}
	if len(strings.Split(url.Host, ":")) < 2 {
		if url.Scheme == "https" {
			url.Host += ":443"
			network.BrooklynUrl = url.String()
		} else if url.Scheme == "http" {
			url.Host += ":80"
			network.BrooklynUrl = url.String()
		}
	}
	_, err = net.DialTimeout("tcp", url.Host, time.Duration(30) * time.Second)
	if err != nil {
		return errors.New("Could not connect to " + url.Host)
	}
	return nil
}