Skip to content

Improve port parsing to support combined specifications #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 21, 2025

Conversation

guoard
Copy link
Contributor

@guoard guoard commented Jul 16, 2025

The readPortsRange function was previously limited to a single keyword or range per call, making it difficult for users to define complex port sets. For instance, scanning the top 1000 ports and a specific custom port required extra logic outside the function.

This commit refactors the function to parse a comma-separated string containing multiple specifications. It now supports combining keywords (top1000, reserved), single ports, and ranges in one input, like "top1000,8080,9000-9100".

The final list of ports is de-duplicated and sorted to ensure a clean, predictable output.

@guoard guoard requested review from eze-kiel and a team as code owners July 16, 2025 06:49
@guoard
Copy link
Contributor Author

guoard commented Jul 21, 2025

Hi @leucos, sorry for the ping. github didn’t add you as a reviewer, so I wanted to make sure this gets on your radar.

Copy link
Contributor

@leucos leucos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@leucos
Copy link
Contributor

leucos commented Jul 21, 2025

Sorry for the lag. Thanks !

@leucos leucos added this pull request to the merge queue Jul 21, 2025
Merged via the queue into devops-works:master with commit 5d1d0ac Jul 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants