-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
API Proposal: IPNetwork to support CIDR notation #64033
Comments
Tagging subscribers to this area: @dotnet/ncl Issue DetailsBackground and motivationAn implementation is exposed through HttpOverrides middleware package at /~https://github.com/dotnet/aspnetcore/blob/main/src/Middleware/HttpOverrides/src/IPNetwork.cs This proposal is to promote it under API Proposalnamespace System.Net
{
public struct IPNetwork
{
// eg: "192.168.0.0/16"
public static IPNetwork Parse(string);
public IPNetwork(IPAddress, IPAddress);
public IPNetwork(IPAddress, int);
public bool Contains(IPAddress);
// ..
}
} API Usagevar range = IPNetwork.Parse(cidr);
bool result = range.Contains(address); Alternative DesignsNo response RisksNo response
|
Relates to #42845 |
Would this also include support for a built-in type converter (or similar) that would allow binding configuration containing such values? At the moment we rely on a custom type converter to bind configuration containing such values (primarily for forwarded headers and ip whitelisting). We add the converters using It would be nice to not need to do this and just have it work out of the box. |
We previously rejected a CIDR proposal due to lack of customer demand: #36428 |
Triage: Still not high enough demand. Other libraries exist that solve it. Not desperately needed in BCL. |
Duplicate of #36428 |
Background and motivation
An implementation is exposed through HttpOverrides middleware package at /~https://github.com/dotnet/aspnetcore/blob/main/src/Middleware/HttpOverrides/src/IPNetwork.cs
This proposal is to promote it under
System.Net
namespace for a built-in support.API Proposal
API Usage
Alternative Designs
No response
Risks
No response
The text was updated successfully, but these errors were encountered: