Resolve certificate for a given SNI hostname (lock-free)
(&self, sni: &str)
| 55 | |
| 56 | /// Resolve certificate for a given SNI hostname (lock-free) |
| 57 | fn resolve_cert(&self, sni: &str) -> Option<Arc<CertifiedKey>> { |
| 58 | // 1. Try exact match first |
| 59 | if let Some(cert) = self.exact_certs.get(sni) { |
| 60 | return Some(cert.clone()); |
| 61 | } |
| 62 | |
| 63 | // 2. Try wildcard match (only one level deep per TLS spec) |
| 64 | // For "foo.bar.example.com", only try "bar.example.com" |
| 65 | if let Some((_, parent)) = sni.split_once('.') { |
| 66 | self.wildcard_certs.get(parent).cloned() |
| 67 | } else { |
| 68 | None |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | /// Check if a certificate exists for a domain |
| 73 | pub fn has_cert(&self, domain: &str) -> bool { |
no test coverage detected