Enhance port reachability API with granular status#201
Open
ymattw wants to merge 1 commit into
Open
Conversation
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.
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a strict string enum
status(open,refused,timeout,unreachable,unknown) to the PortResponse API.Design decisions:
errnointegers or OS-specific error strings.os.IsTimeout(err)to accurately catch Go's internal network poller deadlines.