Functions related to IP addresses.
You can use this function to create an IP address.
ip(expression)
The data type of the returned value is ip.
data record(value = "127.0.0.1"),record(value = "2001:0db8:0000:0000:0000:8a2e:0370:7334"),record(value = "2001:db8::8a2e:370:7334"),record(value = "::1"),record(value = "317.0.0.1") // invalid IPv4| fieldsAdd ip(value)
Query result:
This function returns a Boolean which indicates if at least one IP address of the first parameter can be found in the following ones - the same behavior as the in() function.
ipIn(needle_expressions, haystack_expressions...)
The data type of the returned value is boolean.
data record(a = "127.0.0.1", b = "127.0.0.1"),record(a = "127.0.0.1", b = "127.0.0.1/8"),record(a = "127.0.0.1/8", b = "127.0.0.1"),record(a = "127.0.0.1/8", b = "127.0.0.1/16"),record(a = array("127.0.0.1", "10.0.0.1"), b = "127.0.0.1"),record(a = array("127.0.0.1", "10.0.0.1"), b = array("127.0.0.1/8", "10.0.0.2"))| fieldsAdd ipIn(a, b)
Query result:
data record(a = ip("127.0.0.1"), b = ip("127.0.0.1")),record(a = array(ip("127.0.0.1"), ip("10.0.0.1")), b = ip("127.0.0.1")),record(a = array(ip("127.0.0.1"), ip("10.0.0.1")), b = array(ip("127.0.0.1"), ip("10.0.0.2")))| fieldsAdd ipIn(a, b)
Query result:
data record(a = ip("127.0.0.1"), b = "127.0.0.1/8"),record(a = array("127.0.0.1", ip("10.0.0.1")), b = "127.0.0.1"),record(a = array("127.0.0.1", ip("10.0.0.1")), b = array("127.0.0.1/8", ip("10.0.0.2")))| fieldsAdd ipIn(a, b)
Query result:
Checks if an IP address is a link-local IP address.
ipIsLinkLocal(expression)
The data type of the returned value is boolean.
data record(a = "169.254.0.0"),record(a = "169.254.255.255"),record(a = "169.255.0.0")| fieldsAdd ipIsLinkLocal(a)
Query result:
Checks if an IP address is a loopback IP address.
ipIsLoopback(expression)
The data type of the returned value is boolean.
data record(a = "127.0.0.1"),record(a = "10.0.0.1"),record(a = "::1")| fieldsAdd ipIsLoopback(a)
Query result:
Checks if an IP address is a private IP address.
ipIsPrivate(expression)
The data type of the returned value is boolean.
data record(a = "127.0.0.1"),record(a = "10.0.0.1"),record(a = "::1"),record(a = "172.16.1.1"),record(a = "1.2.3.4")| fieldsAdd ipIsPrivate(a)
Query result:
Checks if an IP address is a public IP address.
ipIsPublic(expression)
The data type of the returned value is boolean.
data record(a = "1.2.3.4"),record(a = "2001:0db8:0000:0000:0000:8a2e:0370:7334"),record(a = "10.0.0.1"),record(a = "::1")| fieldsAdd ipIsPublic(a)
Query result:
Masks an IP address with given bits (optional parameter for IPv6 addresses).
ipMask(expression, maskBits [, ipv6MaskBits])
The data type of the returned value is ip.
data record(a = "127.1.2.3"),record(a = "2001:0db8:0000:0000:0000:8a2e:0370:7334")| fieldsAdd ipMask(a, 8),ipMask(a, 16, ipv6MaskBits: 32)
Query result:
Checks if an expression is an IPv4/v6 address.
isIp(expression)
The data type of the returned value is boolean.
data record(a = "127.0.0.1"),record(a = "127.0.0."),record(a = toIp("127.0.0.1")),record(a = "2001:0db8:0000:0000:0000:8a2e:0370:7334"),record(a = toIp("2001:0db8:0000:0000:0000:8a2e:0370:7334")),record(a = "2001:0db8:0000:0000:0000:8a2e:0370:")| fieldsAdd isIp(a)
Query result:
Checks if an expression is an IPv4 address.
isIpV4(expression)
The data type of the returned value is boolean.
data record(a = "127.0.0.1"),record(a = "127.0.0."),record(a = toIp("127.0.0.1")),record(a = "2001:0db8:0000:0000:0000:8a2e:0370:7334"),record(a = toIp("2001:0db8:0000:0000:0000:8a2e:0370:7334")),record(a = "2001:0db8:0000:0000:0000:8a2e:0370:")| fieldsAdd isIpV4(a)
Query result:
Checks if an expression is an IPv6 address.
isIpV6(expression)
The data type of the returned value is boolean.
data record(a = "127.0.0.1"),record(a = "127.0.0."),record(a = toIp("127.0.0.1")),record(a = "2001:0db8:0000:0000:0000:8a2e:0370:7334"),record(a = toIp("2001:0db8:0000:0000:0000:8a2e:0370:7334")),record(a = "2001:0db8:0000:0000:0000:8a2e:0370:")| fieldsAdd isIpV6(a)
Query result:
IP address + numeric
IP address + IP address
IP address - numeric
IP address - IP address
data record(a = toIp("127.0.0.10"), b = toIp("10.0.0.1"))| fieldsAdd a + b, a - b, a + 1, a - 1
Query result: