(gateway_url: &str)
| 1397 | } |
| 1398 | |
| 1399 | fn grpc_server_from_ssh_gateway_url(gateway_url: &str) -> Result<String> { |
| 1400 | let url: url::Url = gateway_url |
| 1401 | .parse() |
| 1402 | .into_diagnostic() |
| 1403 | .wrap_err("invalid gateway URL")?; |
| 1404 | let scheme = url.scheme(); |
| 1405 | let gateway_host = url |
| 1406 | .host_str() |
| 1407 | .ok_or_else(|| miette::miette!("gateway URL missing host"))?; |
| 1408 | let gateway_port = url |
| 1409 | .port_or_known_default() |
| 1410 | .ok_or_else(|| miette::miette!("gateway URL missing port"))?; |
| 1411 | Ok(format_gateway_url(scheme, gateway_host, gateway_port)) |
| 1412 | } |
| 1413 | |
| 1414 | /// Run the SSH proxy in "name mode": create a session on the fly, then proxy. |
| 1415 | /// |
no test coverage detected