(host: &str, _port: u32)
| 1129 | } |
| 1130 | |
| 1131 | fn validate_tcp_target_parts(host: &str, _port: u32) -> Result<String, Status> { |
| 1132 | if host.is_empty() { |
| 1133 | return Err(Status::invalid_argument("tcp target host is required")); |
| 1134 | } |
| 1135 | if host.eq_ignore_ascii_case("localhost") { |
| 1136 | return Ok("127.0.0.1".to_string()); |
| 1137 | } |
| 1138 | |
| 1139 | let ip: IpAddr = host |
| 1140 | .parse() |
| 1141 | .map_err(|_| Status::invalid_argument("tcp target host must be loopback"))?; |
| 1142 | if ip.is_loopback() { |
| 1143 | Ok(ip.to_string()) |
| 1144 | } else { |
| 1145 | Err(Status::invalid_argument("tcp target host must be loopback")) |
| 1146 | } |
| 1147 | } |
| 1148 | |
| 1149 | async fn bridge_forward_tcp_stream( |
| 1150 | mut inbound: tonic::Streaming<TcpForwardFrame>, |
no test coverage detected