MCPcopy
hub / github.com/caddyserver/certmagic / AllMatchingCertificates

Method AllMatchingCertificates

cache.go:386–400  ·  view source on GitHub ↗

AllMatchingCertificates returns a list of all certificates that could be used to serve the given SNI name, including exact SAN matches and wildcard matches.

(name string)

Source from the content-addressed store, hash-verified

384// be used to serve the given SNI name, including exact SAN matches and
385// wildcard matches.
386func (certCache *Cache) AllMatchingCertificates(name string) []Certificate {
387 // get exact matches first
388 certs := certCache.getAllMatchingCerts(name)
389
390 // then look for wildcard matches by replacing each
391 // label of the domain name with wildcards
392 labels := strings.Split(name, ".")
393 for i := range labels {
394 labels[i] = "*"
395 candidate := strings.Join(labels, ".")
396 certs = append(certs, certCache.getAllMatchingCerts(candidate)...)
397 }
398
399 return certs
400}
401
402// SubjectIssuer pairs a subject name with an issuer ID/key.
403type SubjectIssuer struct {

Callers

nothing calls this directly

Calls 1

getAllMatchingCertsMethod · 0.95

Tested by

no test coverage detected