Returns the version of an IP

Syntax

IPFAMILY …ip-expr…

IP_FAMILY …ip-expr…

Typing

IPv4 -> unsigned-int

IPv6 -> unsigned-int

Ip -> unsigned-int

Description

Returns either 4 if the IP is an IPv4 or 6 if the IP is an IPv6.

Examples

expression evaluates to
IPFAMILY 135.181.17.92 4
IPFAMILY 2a01:4f9:4b:55b0::2 6

See Also

Country code of an IP