Functions related to IP addresses.
You can use this function to create an IP address.
ip(expression)
| Parameter | Type | Description | Required |
|---|---|---|---|
expression | string, ip address | The expression to create a new IP address. | Required |
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:
| value | ip(value) |
|---|---|
|
|
|
|
|
|
|
|
| null |
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...)
| Parameter | Type | Description | Required |
|---|---|---|---|
needle_expressions | string, ip, array of string expressions/IP addresses | Represents the IP addresses that needs to be found in the haystack_expressions. | Required |
haystack_expressions | string, ip, array of string expressions/ip addresses | The variable argument list where the needle_expressions should be found. | Required |
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:
| a | b | ipIn(a, b) |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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:
| a | b | ipIn(a, b) |
|---|---|---|
|
|
|
|
|
|
|
|
|
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:
| a | b | ipIn(a, b) |
|---|---|---|
|
|
|
|
|
|
|
|
|
Checks if an IP address is a link-local IP address.
ipIsLinkLocal(expression)
| Parameter | Type | Description | Required |
|---|---|---|---|
expression | string, ip address | The expression to check if it is a particular type of IP address. | Required |
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:
| a | ipIsLinkLocal(a) |
|---|---|
|
|
|
|
|
|
Checks if an IP address is a loopback IP address.
ipIsLoopback(expression)
| Parameter | Type | Description | Required |
|---|---|---|---|
expression | string, ip address | The expression to check if it is a particular type of IP address. | Required |
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:
| a | ipIsLoopback(a) |
|---|---|
|
|
|
|
|
|
Checks if an IP address is a private IP address.
ipIsPrivate(expression)
| Parameter | Type | Description | Required |
|---|---|---|---|
expression | string, ip address | The expression to check if it is a particular type of IP address. | Required |
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:
| a | ipIsPrivate(a) |
|---|---|
|
|
|
|
|
|
|
|
|
|
Checks if an IP address is a public IP address.
ipIsPublic(expression)
| Parameter | Type | Description | Required |
|---|---|---|---|
expression | string, ip address | The expression to check if it is a particular type of IP address. | Required |
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:
| a | ipIsPublic(a) |
|---|---|
|
|
|
|
|
|
|
|
Masks an IP address with given bits (optional parameter for IPv6 addresses).
ipMask(expression, maskBits [, ipv6MaskBits])
| Parameter | Type | Description | Required |
|---|---|---|---|
expression | string, ip address | The expression to check if it is a particular type of IP address. | Required |
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:
| a | ipMask(a, 8) | ipMask(a, 16, ipv6MaskBits:32) |
|---|---|---|
|
|
|
|
|
|
Checks if an expression is an IPv4/v6 address.
isIp(expression)
| Parameter | Type | Description | Required |
|---|---|---|---|
expression | string, ip address | The expression to check if it contains/produces an IPv4/v6 address. | Required |
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:
| a | isIp(a) |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
Checks if an expression is an IPv4 address.
isIpV4(expression)
| Parameter | Type | Description | Required |
|---|---|---|---|
expression | string, ip address | The expression to check if it contains/produces an IPv4 address. | Required |
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:
| a | isIpV4(a) |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
Checks if an expression is an IPv6 address.
isIpV6(expression)
| Parameter | Type | Description | Required |
|---|---|---|---|
expression | string, ip address | The expression to check if it contains/produces an IPv6 address. | Required |
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:
| a | isIpV6(a) |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
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:
| a | b | a + b | a - b | a + 1 | a - 1 |
|---|---|---|---|---|---|
|
|
|
|
|
|