func computeExternalURL(u, listenAddr string) (*url.URL, error) {
	if u == "" {
		hostname, err := os.Hostname()
		if err != nil {
			return nil, err
		}
		_, port, err := net.SplitHostPort(listenAddr)
		if err != nil {
			return nil, err
		}
		u = fmt.Sprintf("http://%s:%s/", hostname, port)
	}

	if startsOrEndsWithQuote(u) {
		return nil, errors.New("URL must not begin or end with quotes")
	}

	eu, err := url.Parse(u)
	if err != nil {
		return nil, err
	}

	ppref := strings.TrimRight(eu.Path, "/")
	if ppref != "" && !strings.HasPrefix(ppref, "/") {
		ppref = "/" + ppref
	}
	eu.Path = ppref

	return eu, nil
}
func computeExternalURL(u, listenAddr string) (*url.URL, error) {
	if u == "" {
		hostname, err := os.Hostname()
		if err != nil {
			return nil, err
		}
		_, port, err := net.SplitHostPort(listenAddr)
		if err != nil {
			return nil, err
		}
		u = fmt.Sprintf("http:
	}

	if startsOrEndsWithQuote(u) {
		return nil, errors.New("URL must not begin or end with quotes")
	}

	eu, err := url.Parse(u)
	if err != nil {
		return nil, err
	}

	ppref := strings.TrimRight(eu.Path, "/")
	if ppref != "" && !strings.HasPrefix(ppref, "/") {
		ppref = "/" + ppref
	}
	eu.Path = ppref

	return eu, nil
}
func computeExternalURL ( u , listenAddr string ) ( * url . URL , error ) { if u == " " { hostname , err := os . Hostname ( ) if err != nil { return nil , err } _ , port , err := net . SplitHostPort ( listenAddr ) if err != nil { return nil , err } u = fmt . Sprintf ( " " , hostname , port ) } if startsOrEndsWithQuote ( u ) { return nil , errors . New ( " " ) } eu , err := url . Parse ( u ) if err != nil { return nil , err } ppref := strings . TrimRight ( eu . Path , " " ) if ppref != " " && ! strings . HasPrefix ( ppref , " " ) { ppref = " " + ppref } eu . Path = ppref return eu , nil }
// computeExternalURL computes a sanitized external URL from a raw input. It infers unset
// URL parts from the OS and the given listen address.
computeExternalURL computes a sanitized external URL from a raw input . It infers unset URL parts from the OS and the given listen address .