Class IpRange
A range of IP addresses in CIDR notation, such as 10.0.0.0/8 or fe80::/10; a single address is a range of one.
Implements
Inherited Members
Namespace: Uniform.Turn
Assembly: Uniform.Turn.dll
Syntax
public sealed record IpRange : IEquatable<IpRange>
Constructors
| Edit this page View SourceIpRange(IPAddress, int)
A range of IP addresses in CIDR notation, such as 10.0.0.0/8 or fe80::/10; a single address is a range of one.
Declaration
public IpRange(IPAddress Network, int PrefixLength)
Parameters
| Type | Name | Description |
|---|---|---|
| IPAddress | Network | First address of the range. |
| int | PrefixLength | Number of leading bits that all addresses of the range share. |
Properties
| Edit this page View SourceNetwork
First address of the range.
Declaration
public IPAddress Network { get; init; }
Property Value
| Type | Description |
|---|---|
| IPAddress |
NonPublic
Ranges a TURN server should not relay to, so outsiders cannot reach its local network or itself: unspecified, loopback, private, carrier-grade NAT, link-local, multicast and reserved addresses of IPv4 and IPv6.
Declaration
public static IReadOnlyList<IpRange> NonPublic { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<IpRange> |
PrefixLength
Number of leading bits that all addresses of the range share.
Declaration
public int PrefixLength { get; init; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
| Edit this page View SourceContains(IPAddress)
Return whether address is in the range; IPv4 addresses mapped into IPv6 count as IPv4.
Declaration
public bool Contains(IPAddress address)
Parameters
| Type | Name | Description |
|---|---|---|
| IPAddress | address |
Returns
| Type | Description |
|---|---|
| bool |
Parse(string)
Return the range of text, e.g. 192.168.0.0/16 or 192.168.1.5; throw FormatException when it is not one.
Declaration
public static IpRange Parse(string text)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text |
Returns
| Type | Description |
|---|---|
| IpRange |
ParseList(string?)
Return the ranges of a comma-separated list, e.g. from settings; an empty list for null or empty text.
Declaration
public static IReadOnlyList<IpRange> ParseList(string? text)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<IpRange> |
ToString()
Return the range in CIDR notation.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string |