IP Addresses
IP addresses can be written like this: ipAddress("1.2.3.4") for IPv4
or ipAddress("2001:0db8:85a3:0000:0000:8a2e:0370:7334") for IPv6.
Such values have type IpAddress.
If ip has type IpAddress, then it can be inverted via - like this: -ip.
For example, -ipAddress("0.0.0.255") is an expression of the IP address 255.255.255.0.
In addition, the following functions work on IP addresses:
-
toNumber(ipv4Address): The numeric value corresponding to an IPv4 address. For example,toNumber(ipAddress("0.0.1.2"))is258. Note that this can only be applied to IPv4 addresses. -
ipv4Address(integer): The IPv4 address corresponding to a given integer in the range0to2 ^ 32 - 1. For example,ipv4Address(0)denotes0.0.0.0andipv4Address(1234)denotes0.0.4.210. -
isIPv4(ipAddress): Tests whetheripAddressis an IPv4 address. For example,isIPv4(ipAddress("1.2.3.4"))returnstrueandisIPv4(ipAddress("2001:0db8:85a3:0000:0000:8a2e:0370:7334")returnsfalse. -
isIPv6(ipAddress): Tests whetheripAddressis an IPv6 address. For example,isIPv6(ipAddress("2001:0db8:85a3:0000:0000:8a2e:0370:7334")returnstrueandisIPv6(ipAddress("1.2.3.4"))returnsfalse. -
fromTo(ipAddress, ipAddress): List of IP addresses between twoipAddress.