Closed ciorg closed 1 month ago
other ip functions to consider:
from presto:
ip_prefix(ip_address, prefix_bits) → ipprefix#
Returns the IP prefix of a given ip_address with subnet size of prefix_bits. ip_address can be either of type VARCHAR or type IPADDRESS.
SELECT ip_prefix(CAST('192.168.255.255' AS IPADDRESS), 9); -- {192.128.0.0/9}
SELECT ip_prefix('2001:0db8:85a3:0001:0001:8a2e:0370:7334', 48); -- {2001:db8:85a3::/48}
ip_subnet_range(ip_prefix)#
Return an array of 2 IP addresses. The array contains the smallest and the largest IP address in the subnet specified by ip_prefix.
SELECT ip_subnet_range(IPPREFIX '1.2.3.160/24'); -- [{1.2.3.0}, {1.2.3.255}]
SELECT ip_subnet_range(IPPREFIX '64:ff9b::52f4/120'); -- [{64:ff9b::5200}, {64:ff9b::52ff}]
functions from ipaddr.js
a module that we already use
ipv4 specific
ipv6 specific
other:
70.176.201.23
-> 1185990935
70.176.201.23
-> 100011010110000110010010001011170.176.201.23
-> 0x46b0c917I believe we have reasonable coverage on these now.
current functions:
new functions: