MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / api_for_host

Method api_for_host

crates/openshell-prover/src/credentials.rs:156–166  ·  view source on GitHub ↗

API capability registry for a given host. Exact matches win, then wildcard host overlap is used so credentialed wildcard proposals can be evaluated against concrete API capability registries.

(&self, host: &str)

Source from the content-addressed store, hash-verified

154 /// wildcard host overlap is used so credentialed wildcard proposals can be
155 /// evaluated against concrete API capability registries.
156 pub fn api_for_host(&self, host: &str) -> Option<&ApiCapability> {
157 let needle = normalize_host(host);
158 self.api_registries
159 .values()
160 .find(|api| normalize_host(&api.host) == needle)
161 .or_else(|| {
162 self.api_registries
163 .values()
164 .find(|api| host_patterns_overlap(host, &api.host))
165 })
166 }
167}
168
169fn normalize_host(host: &str) -> String {

Calls 2

host_patterns_overlapFunction · 0.85
normalize_hostFunction · 0.70