pub struct ZoneResolver {
zones: Vec<(String, Arc<SwappableCert>)>,
primary: Arc<SwappableCert>,
}Expand description
The process’s one rustls certificate resolver when several zones are
served: one SwappableCert per zone, chosen by SNI.
§No SNI, and unknown SNI
A ClientHello with no server name — an IP-address connection, or an
ancient client — gets the primary zone’s certificate: the first zone
configured, which is also the zone whose hostname the server answers for
itself. Handing back something is right here; the handshake then fails or
succeeds on the client’s own name check, which is where that decision
belongs.
A ClientHello naming a host no configured zone covers gets None,
which rustls turns into an unrecognized_name alert. That is the honest
answer: presenting a certificate for a name we do not serve would fail
the client’s verification anyway, and more confusingly.
Fields§
§zones: Vec<(String, Arc<SwappableCert>)>Zone hostname and its live certificate, sorted deepest zone first so
a nested pair (pds.did.bot and claudes.pds.did.bot) resolves to
the more specific one — matching didbot_identity::ZoneRegistry’s
own “most specific wins” rule.
primary: Arc<SwappableCert>The first zone as configured, which sorting by depth moves. Held separately rather than by index for that reason.
Implementations§
Source§impl ZoneResolver
impl ZoneResolver
Sourcepub fn new(
zones: Vec<(String, Arc<SwappableCert>)>,
) -> Result<Arc<Self>, FleetError>
pub fn new( zones: Vec<(String, Arc<SwappableCert>)>, ) -> Result<Arc<Self>, FleetError>
Builds a resolver over zones, refusing an empty or duplicated set.
The first entry is the primary: the certificate a ClientHello with
no SNI gets.
Sourcepub fn certificate_for(&self, host: &str) -> Option<Arc<CertifiedKey>>
pub fn certificate_for(&self, host: &str) -> Option<Arc<CertifiedKey>>
The certificate this resolver would present for host, if any.
Exposed so a test — or an operator-facing check — can ask the
question without building a ClientHello.
Source§impl ZoneResolver
impl ZoneResolver
Sourcepub fn primary_cert(&self) -> Arc<CertifiedKey>
pub fn primary_cert(&self) -> Arc<CertifiedKey>
The certificate a ClientHello with no SNI name gets: the first zone
configured.