» Import: sockaddr

The sockaddr import makes working with IP addresses easy.

» sockaddr.is_contained(outer, inner)

The is_contained function returns true if inner is an address that is contained within outer.

sockaddr.is_contained("", "") // true
sockaddr.is_contained("", "")   // false

» sockaddr.is_equal(addr1, addr2)

The is_equal function returns true if addr1 is equal to addr2.

sockaddr.is_equal("", "") // true

» sockaddr.is_ipv4(addr)

The is_ipv4 function returns true if addr is an IPv4 address.

sockaddr.is_ipv4("") // true
sockaddr.is_ipv4("2001:0db8:85a3:0000:0000:8a2e:0370:7334") // false

» sockaddr.is_ipv6(addr)

The is_ipv6 function returns true if addr is an IPv6 address.