code: func (p *Provider) getValidDomains(ctx context.Context, domain types.Domain, wildcardAllowed bool) ([]string, error) {
  	domains := domain.ToStrArray()
  	if len(domains) == 0 {
  		return nil, errors.New("unable to generate a certificate in ACME provider when no domain is given")
  	}
  
  	if strings.HasPrefix(domain.Main, "*") {
  		if !wildcardAllowed {
  			return nil, fmt.Errorf("unable to generate a wildcard certificate in ACME provider for domain %q from a 'Host' rule", strings.Join(domains, ","))
  		}
  
  		if p.DNSChallenge == nil {
  			return nil, fmt.Errorf("unable to generate a wildcard certificate in ACME provider for domain %q : ACME needs a DNSChallenge", strings.Join(domains, ","))
  		}
  
  		if strings.HasPrefix(domain.Main, "*.*") {
  			return nil, fmt.Errorf("unable to generate a wildcard certificate in ACME provider for domain %q : ACME does not allow '*.*' wildcard domain", strings.Join(domains, ","))
  		}
  	}
  
  	for _, san := range domain.SANs {
  		if strings.HasPrefix(san, "*") {
  			return nil, fmt.Errorf("unable to generate a certificate in ACME provider for domains %q: SAN %q can not be a wildcard domain", strings.Join(domains, ","), san)
  		}
  	}
  
  	var cleanDomains []string
  	for _, domain := range domains {
  		canonicalDomain := types.CanonicalDomain(domain)
  		cleanDomain := dns01.UnFqdn(canonicalDomain)
  		if canonicalDomain != cleanDomain {
  			log.FromContext(ctx).Warnf("FQDN detected, please remove the trailing dot: %s", canonicalDomain)
  		}
  		cleanDomains = append(cleanDomains, cleanDomain)
  	}
  
  	return cleanDomains, nil
  }
docs: // getValidDomains checks if given domain is allowed to generate a ACME certificate and return it