Network

ASN

ASN(ip_expr)

Returns ASN number of IPADDR, IPSOCKET or IPNET type argument.

Returns NULL if argument evaluates to NULL.

output type:INTEGER

Example:

1
dual | select(ASN(213.3.222.5));
asn
3303

ASN_NAME

ASN_NAME(ip_expr)

ASNAME(ip_expr)

Returns ASN Name of IPADDR, IPSOCKET or IPNET type argument.

Returns NULL if argument evaluates to NULL.

output type:STRING

Example:

1
dual | select(ASN_NAME(213.3.222.5));
asn_name
AS3303 Bluewin

CC

CC(ip_expr)

Returns 2-letter ISO 3166 country code of IPADDR, IPSOCKET or IPNET type argument.

Returns NULL if argument evaluates to NULL.

output type:STRING

Example:

1
dual | select(CC(213.3.222.5));
cc
CH

DNS_LOOKUP

DNS_LOOKUP(ipaddr)

Returns result of the reverse DNS lookup of IPADDR type argument.

Returns NULL if argument evaluates to NULL.

output type:STRING

Example:

1
dual | select(DNS_LOOKUP(85.222.234.14));
dns_lookup
uvn-234-14.ams01.zonevs.eu

DNS_LOOKUP(domain)

Returns result of DNS lookup for STRING type argument.

output type:IPADDR

Example:

1
dual | select(DNS_LOOKUP('www.spectx.com'));
dns_lookup
85.222.234.14

DSLICE

DSLICE(domain, level)

Returns substring of domain containing labels up to the level specified.

Returns NULL if argument evaluates to NULL.

output type:STRING

Example:

1
dual | select(DSLICE('www.spectx.com',2));
dslice
spectx.com

IPLOC

IPLOC(ip_expr)

Returns country code, city name and geographical coordinates of IPADDR, IPSOCKET or IPNET type argument.

Returns NULL if argument evaluates to NULL.

output type:TUPLE

Example:

1
dual | select(IPLOC(84.50.125.243:443));
iploc
{cc=”EE” city=”Tallinn” geo=59.433,24.7323}

IPIN

IPIN(ip_expr, ipnet), IPADDR_IN(ip_expr, ipnet)

Returns true or false if IPADDR, IPSOCKET type ip_expr are within the range of ipnet.

Returns NULL if either of the arguments evaluates to NULL.

output type:BOOLEAN

Example:

1
dual | select(IPIN(200.100.32.45,200.100.32.0/8));
ipin
true

IS_IPV4

IS_IPV4(ip_expr)

Returns true if IPADDR, IPSOCKET or IPNET type IPADDR, IPNET or argument contains IPv4 address, otherwise returns false.

Returns NULL if argument evaluates to NULL.

output type:BOOLEAN

Example:

1
dual | select(IS_IPV4(200.100.32.45:99));
is_ipv4
true

IS_IPV6

IS_IPV6(ip_expr)

Returns true if IPADDR, IPSOCKET or IPNET type argument contains IPv6 address, otherwise returns false.

Returns NULL if argument evaluates to NULL.

output type:BOOLEAN

Example:

1
dual | select(IS_IPV6(IPADDR('2a00:1450:4010:c05::69')));
is_ipv6
true

MANUF

MANUF(macaddr)

Returns manufacturer of MACADDR type argument.

Returns NULL if argument evaluates to NULL.

output type:STRING

Example:

1
dual | select(MANUF(6c-40-08-98-54-7e));
manuf
Apple

MASK

MASK(ipnet)

Returns netmask from IPNET type argument.

Returns NULL if argument evaluates to NULL.

output type:INTEGER

Example:

1
dual | select(MASK(IPNET('2a00:1450:4010:c05::69/20')));
mask
20

PARSEURI

PARSEURI(uri_str)

Returns array of URI elements parsed from STRING type argument.

Returns NULL if argument evaluates to NULL.

output type:TUPLE

Example:

1
dual | select(PARSEURI("https://docs.spectx.com:443/pages/spectx.html#sx-install"));
parseuri
{scheme=”https” user=NULL host=”docs.spectx.com” port=443 path=”/pages/spectx.html” query=NULL fragment=”sx-install”}

PORT

PORT(ipsocket)

Returns port of IPSOCKET type argument.

Returns NULL if argument evaluates to NULL.

output type:INTEGER

Example:

1
dual | select(PORT(200.100.32.45:99));
port
99