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

Function resolve_socket_addrs

crates/openshell-supervisor-network/src/proxy.rs:2476–2502  ·  view source on GitHub ↗
(
    host: &str,
    port: u16,
    entrypoint_pid: u32,
)

Source from the content-addressed store, hash-verified

2474}
2475
2476async fn resolve_socket_addrs(
2477 host: &str,
2478 port: u16,
2479 entrypoint_pid: u32,
2480) -> std::result::Result<Vec<SocketAddr>, String> {
2481 if let Some(addrs) = resolve_ip_literal(host, port) {
2482 return Ok(addrs);
2483 }
2484
2485 if let Some(addrs) = resolve_from_sandbox_hosts(host, port, entrypoint_pid).await {
2486 return Ok(addrs);
2487 }
2488
2489 let lookup_host = normalize_host_lookup_key(host);
2490 let addrs: Vec<SocketAddr> = tokio::net::lookup_host((lookup_host, port))
2491 .await
2492 .map_err(|e| format!("DNS resolution failed for {lookup_host}:{port}: {e}"))?
2493 .collect();
2494
2495 if addrs.is_empty() {
2496 return Err(format!(
2497 "DNS resolution returned no addresses for {lookup_host}:{port}"
2498 ));
2499 }
2500
2501 Ok(addrs)
2502}
2503
2504fn reject_internal_resolved_addrs(
2505 host: &str,

Calls 4

resolve_ip_literalFunction · 0.85
is_emptyMethod · 0.45

Tested by

no test coverage detected