checkmgr/broker.go
func (cm *CheckManager) getBrokerCN(broker *api.Broker, submissionURL api.URLType) (string, error) {
	u, err := url.Parse(string(submissionURL))
	if err != nil {
		return "", err
	}

	hostParts := strings.Split(u.Host, ":")
	host := hostParts[0]

	if net.ParseIP(host) == nil { // it's a non-ip string
		return u.Host, nil
	}

	cn := ""

	for _, detail := range broker.Details {
		if *detail.IP == host {
			cn = detail.CN
			break
		}
	}

	if cn == "" {
		return "", fmt.Errorf("[ERROR] Unable to match URL host (%s) to Broker", u.Host)
	}

	return cn, nil

}
func (cm *CheckManager) getBrokerCN(broker *api.Broker, submissionURL api.URLType) (string, error) {
	u, err := url.Parse(string(submissionURL))
	if err != nil {
		return "", err
	}

	hostParts := strings.Split(u.Host, ":")
	host := hostParts[0]

	if net.ParseIP(host) == nil { // it's a non-ip string
		return u.Host, nil
	}

	cn := ""

	for _, detail := range broker.Details {
		if *detail.IP == host {
			cn = detail.CN
			break
		}
	}

	if cn == "" {
		return "", fmt.Errorf("[ERROR] Unable to match URL host (%s) to Broker", u.Host)
	}

	return cn, nil

}
func ( cm * CheckManager ) getBrokerCN ( broker * api . Broker , submissionURL api . URLType ) ( string , error ) { u , err := url . Parse ( string ( submissionURL ) ) if err != nil { return " " , err } hostParts := strings . Split ( u . Host , " " ) host := hostParts [ 0 ] if net . ParseIP ( host ) == nil { // it's a non-ip string return u . Host , nil } cn := " " for _ , detail := range broker . Details { if * detail . IP == host { cn = detail . CN break } } if cn == " " { return " " , fmt . Errorf ( " " , u . Host ) } return cn , nil }
// Get CN of Broker associated with submission_url to satisfy no IP SANS in certs
Get CN of Broker associated with submission_url to satisfy no IP SANS in certs