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

Function parse_target

crates/openshell-supervisor-network/src/proxy.rs:4311–4319  ·  view source on GitHub ↗
(target: &str)

Source from the content-addressed store, hash-verified

4309}
4310
4311fn parse_target(target: &str) -> Result<(String, u16)> {
4312 let (host, port_str) = target
4313 .split_once(':')
4314 .ok_or_else(|| miette::miette!("CONNECT target missing port: {target}"))?;
4315 let port: u16 = port_str
4316 .parse()
4317 .map_err(|_| miette::miette!("Invalid port in CONNECT target: {target}"))?;
4318 Ok((host.to_string(), port))
4319}
4320
4321async fn respond(client: &mut TcpStream, bytes: &[u8]) -> Result<()> {
4322 client.write_all(bytes).await.into_diagnostic()?;

Callers 1

handle_tcp_connectionFunction · 0.85

Calls 1

parseMethod · 0.45

Tested by

no test coverage detected