Checks if the IP address is IPv4.
true
if the IP address is IPv4, otherwise false
.
Checks if the IP address is IPv6.
true
if the IP address is IPv6, otherwise false
.
Gets the version of the IP address (4 for IPv4 or 6 for IPv6).
4
if the IP is IPv4, 6
if IPv6.
Static
canStatic
fromStatic
fromExtracts an IP address from a Request
object by checking the
CF-Connecting-IP
header.
The incoming request containing headers.
A new IPAddress
instance if the IP is present in the headers, otherwise null
.
The
IPAddress
class represents an IP address, providing methods to validate, parse, and determine the version of the IP address (IPv4 or IPv6).The class supports constructing from a string or another
IPAddress
instance, as well as extracting an IP address from a request header. It also provides utility methods for checking IP version and serializing the IP address.Example