MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / resolve_cert

Method resolve_cert

gateway/src/cert_store.rs:57–70  ·  view source on GitHub ↗

Resolve certificate for a given SNI hostname (lock-free)

(&self, sni: &str)

Source from the content-addressed store, hash-verified

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 {

Callers 2

resolveMethod · 0.80
has_cert_for_sniMethod · 0.80

Calls 2

cloneMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected