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

Function validate_tcp_forward_target

crates/openshell-server/src/grpc/sandbox.rs:1118–1129  ·  view source on GitHub ↗
(target: &TcpRelayTarget)

Source from the content-addressed store, hash-verified

1116}
1117
1118fn 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
1131fn validate_tcp_target_parts(host: &str, _port: u32) -> Result<String, Status> {
1132 if host.is_empty() {

Callers 1

Calls 1

Tested by

no test coverage detected