Format a gateway URL, bracketing IPv6 literals when needed.
(scheme: &str, host: &str, port: u16)
| 749 | |
| 750 | /// Format a gateway URL, bracketing IPv6 literals when needed. |
| 751 | pub 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. |
| 765 | pub fn shell_escape(value: &str) -> String { |
no outgoing calls
no test coverage detected