package netutil

import (
	
	
	
	
)

func ( *url.URL) string {
	return .Scheme + "://" + AuthorityAddr(.Scheme, .Host)
}

// AuthorityAddr returns a given authority (a host/IP, or host:port / ip:port)
// and returns a host:port. The port 443 is added if needed.
func (,  string) ( string) {
	,  := AuthorityHostPort(, )
	// IPv6 address literal, without a port:
	if strings.HasPrefix(, "[") && strings.HasSuffix(, "]") {
		return  + ":" + 
	}
	 = net.JoinHostPort(, )
	return
}

func (,  string) (,  string) {
	, ,  := net.SplitHostPort()
	if  != nil { // authority didn't have a port
		 = "443"
		if  == "http" {
			 = "80"
		}
		 = 
	}
	if ,  := idna.ToASCII();  == nil {
		 = 
	}
	return
}