Skip to main content

validate_ports

Function validate_ports 

Source
pub fn validate_ports(ports: &[u16]) -> Result<()>
Expand description

Validate an already-parsed port list.

Lives here, next to MAX_PORTS_PER_SCAN, so every interface answers the same way. The CLI and GUI reach it through parse_ports_checked; the MCP server and any library consumer reach it through Ops, which validates whatever it is handed rather than trusting the caller to have parsed it from a string.

Port 0 is rejected. It is not a connectable TCP port — in a bind it means “pick any free port”, and in a connect it is meaningless. The MCP server has always rejected it while the CLI happily reported “Scanned 1 port (0 open)”, which is the divergence this function exists to remove.