(target: &TcpRelayTarget)
| 1116 | } |
| 1117 | |
| 1118 | fn validate_tcp_forward_target(target: &TcpRelayTarget) -> Result<TcpRelayTarget, Status> { |
| 1119 | if target.port == 0 || target.port > u32::from(u16::MAX) { |
| 1120 | return Err(Status::invalid_argument( |
| 1121 | "tcp target port must be between 1 and 65535", |
| 1122 | )); |
| 1123 | } |
| 1124 | |
| 1125 | validate_tcp_target_parts(target.host.trim(), target.port).map(|host| TcpRelayTarget { |
| 1126 | host, |
| 1127 | port: target.port, |
| 1128 | }) |
| 1129 | } |
| 1130 | |
| 1131 | fn validate_tcp_target_parts(host: &str, _port: u32) -> Result<String, Status> { |
| 1132 | if host.is_empty() { |
no test coverage detected