-
Notifications
You must be signed in to change notification settings - Fork 98
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
IPNetwork.Parse(string, ParseOptions) #252
Labels
Comments
Changed my mind, as ParseFlex would be just what I want. I'd instead add
This class Thoughts? |
billpg
changed the title
IPNetwork.ParseFlex, where single IP address strings are returned as /32 or /128.
IPNetwork.Parse(string, ParseOptions)
Dec 23, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I use
IPNetwork.Parse
to parse a user's configuration when they set up their allowed IP ranges. I'd like to allow them to type in single IP addresses and for my code to interpret that this-IP-only, but instead I get the class-A/B/C network that IP is in. (Because of this, my code callsIPAddress.Parse
first, falling back toIPNetwork.Parse
.)What if we added
IPNetwork.ParseFlex
which is documented as being tailored for user configuration, leavingParse
as suitable for validation and code expecting legacy behaviour.IPNetwork.ParseFlex("192.168.1.1/8")
returns192.0.0.0/8
.IPNetwork.ParseFlex("192.168.1.1")
returns192.168.1.1/32
.I'm happy to work on this but I'd like to establish a consensus that we want this before I barrel ahead and start coding.
The text was updated successfully, but these errors were encountered: