-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
api-suggestionEarly API idea and discussion, it is NOT ready for implementationEarly API idea and discussion, it is NOT ready for implementationarea-System.Net
Milestone
Description
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
namespace 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 Usage
var range = IPNetwork.Parse(cidr);
bool result = range.Contains(address);Alternative Designs
No response
Risks
No response
Metadata
Metadata
Assignees
Labels
api-suggestionEarly API idea and discussion, it is NOT ready for implementationEarly API idea and discussion, it is NOT ready for implementationarea-System.Net