Class IPAddressExtensions
NAT extensions to the IPAddress class.
Inherited Members
Namespace: Makaretu.Nat
Assembly: Makaretu.Nat.dll
Syntax
public static class IPAddressExtensions
Remarks
IsPrivate(IPAddress) and IsPublic(IPAddress) determines if an IP address is reachable from the public internet; see RFC 1918 for more details.
Methods
| Improve this Doc View SourceIsPrivate(IPAddress)
Determines if the IP address belongs to a private internet.
Declaration
public static bool IsPrivate(this IPAddress address)
Parameters
Type | Name | Description |
---|---|---|
IPAddress | address | The IP address to test. |
Returns
Type | Description |
---|---|
Boolean | true if the |
Remarks
RFC 1918 defines the following as private addresses (in CIDR notation)
- 10/8
- 172.16/12
- 192.168/16
Loop back addresses are considered private.
If the address
IsIPv4MappedToIPv6,
then the IPv4 address is tested.
IsPublic(IPAddress)
Determines if the IP address does not belong to a private internet.
Declaration
public static bool IsPublic(this IPAddress address)
Parameters
Type | Name | Description |
---|---|---|
IPAddress | address | The IP address to test. |
Returns
Type | Description |
---|---|
Boolean | true if the |
Remarks
This is the inverse of IsPrivate(IPAddress).