Skip to content

Enhance port reachability API with granular status#201

Open
ymattw wants to merge 1 commit into
mpolden:masterfrom
ymattw:port-status
Open

Enhance port reachability API with granular status#201
ymattw wants to merge 1 commit into
mpolden:masterfrom
ymattw:port-status

Conversation

@ymattw

@ymattw ymattw commented Jun 23, 2026

Copy link
Copy Markdown

Adds a strict string enum status (open, refused, timeout, unreachable, unknown) to the PortResponse API.

Design decisions:

  • Normalized Enums: Platform-agnostic strings ensure API predictability across OSes, avoiding raw errno integers or OS-specific error strings.
  • Robust Timeouts: Leverages os.IsTimeout(err) to accurately catch Go's internal network poller deadlines.

Adds a strict string enum `status` (`open`, `refused`, `timeout`,
`unreachable`, `unknown`) to the PortResponse API.

Design decisions:
- Normalized Enums: Platform-agnostic strings ensure API predictability
  across OSes, avoiding raw `errno` integers or OS-specific error strings.
- Robust Timeouts: Leverages `os.IsTimeout(err)` to accurately catch Go's
  internal network poller deadlines.
@ymattw

ymattw commented Jun 23, 2026

Copy link
Copy Markdown
Author

Hello!

Thanks for offering https://ifconfig.co/ and open-sourcing the code. It's a great service with excellent code quality!

This PR adds a granular status field to the port reachability API. This idea came out of a recent incident where I locked myself out after changing the SSH port. With this new feature, I can easily test firewall rules before actually changing the port. Otherwise, I have to make the change, test the port, and then roll it back if it doesn't work.

Let me know what you think! Thanks.

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.

1 participant