SaltDns.Proxy.Coverage (Salt v1.0.0)

Whether a certificate's names cover a route host as a visitor's browser sees it. Pure.

A certificate name covers a host when it is equal, or when it is *.parent and the host is exactly one label below parent (TLS wildcards stand for one label). A wildcard route *.example.org is covered by a certificate that lists *.example.org. Routing matches deeper names (SaltDns.Proxy.Routes.match/2) but a certificate does not cover them.

Summary

Functions

The certificate that serves host best, from {certificate, names} pairs in the order of preference: one with the exact name beats one with a wildcard that covers it; among equals the first wins. nil when none covers the host. The decision uses the actual names of each certificate, never the zone.

True when one of names covers host (both normalised, lower-case).

Functions

best(candidates, host)

@spec best([{term(), [String.t()]}], String.t()) :: term() | nil

The certificate that serves host best, from {certificate, names} pairs in the order of preference: one with the exact name beats one with a wildcard that covers it; among equals the first wins. nil when none covers the host. The decision uses the actual names of each certificate, never the zone.

covers?(names, host)

@spec covers?([String.t()], String.t()) :: boolean()

True when one of names covers host (both normalised, lower-case).