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

Function format_gateway_url

crates/openshell-core/src/forward.rs:751–762  ·  view source on GitHub ↗

Format a gateway URL, bracketing IPv6 literals when needed.

(scheme: &str, host: &str, port: u16)

Source from the content-addressed store, hash-verified

749
750/// Format a gateway URL, bracketing IPv6 literals when needed.
751pub fn format_gateway_url(scheme: &str, host: &str, port: u16) -> String {
752 let host = if host
753 .parse::<std::net::IpAddr>()
754 .is_ok_and(|ip| ip.is_ipv6())
755 && !host.starts_with('[')
756 {
757 format!("[{host}]")
758 } else {
759 host.to_string()
760 };
761 format!("{scheme}://{host}:{port}")
762}
763
764/// Shell-escape a value for use inside a `ProxyCommand` string.
765pub fn shell_escape(value: &str) -> String {

Callers 5

handle_shell_connectFunction · 0.85
handle_exec_commandFunction · 0.85
start_port_forwardsFunction · 0.85
ssh_session_configFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected