func getPort(rawURL string) int {
	parsedURL, err := url.Parse(rawURL)
	if err == nil {
		splitHost := strings.Split(parsedURL.Host, ":")
		if len(splitHost) == 2 {
			port, err := strconv.Atoi(splitHost[1])
			if err == nil {
				return port
			}
		}
		if parsedURL.Scheme == "https" {
			return 443
		}
		return 80
	}

	return -1
}
func getPort(rawURL string) int {
	parsedURL, err := url.Parse(rawURL)
	if err == nil {
		splitHost := strings.Split(parsedURL.Host, ":")
		if len(splitHost) == 2 {
			port, err := strconv.Atoi(splitHost[1])
			if err == nil {
				return port
			}
		}
		if parsedURL.Scheme == "https" {
			return 443
		}
		return 80
	}

	return -1
}
func getPort ( rawURL string ) int { parsedURL , err := url . Parse ( rawURL ) if err == nil { splitHost := strings . Split ( parsedURL . Host , " " ) if len ( splitHost ) == 2 { port , err := strconv . Atoi ( splitHost [ 1 ] ) if err == nil { return port } } if parsedURL . Scheme == " " { return 443 } return 80 } return - 1 }
// Get a port given a URL
Get a port given a URL