Supporting Mixed Single Ports and Ranges in RustScan's PortRanges
rustscan
rust
recon
The Problem
parse_range in src/input.rs used splitn(2, '-') and
unconditionally required a second token, rejecting standalone port numbers mixed into a range
list (such as 1-22,661-669,8888).
The Change
let trimmed = input.trim();
let Some((a, b)) = trimmed.split_once('-') else {
let port = trimmed.parse::<u16>().ok()?;
return Some((port, port));
};
Tokens without a hyphen now cleanly parse as (port, port), while range tokens
preserve the start <= end validation and clearer error messaging.