Skip to main content

ipAddressSet

ipAddressSet(ipSubnets: Bag<IpSubnet>) : Set<IpAddress>

Returns a set of IP addresses from a collection of subnets, such as ipAddressSet([ipSubnet("1.2.3.4/24"), ipSubnet("5.6.7.8/24")]) or ipAddressSet([ipSubnet("1234::/64"), ipSubnet("abcd::/64")]). The space of IPv4 addresses is disjoint from the space of IPv6 addresses.

warning

A runtime error will occur if more than 20,000 subnets are required to express either the IPv4 addresses or the IPv6 addresses and the set is returned from a query or passed to toString or toStringTruncate.

A bag of IpSubsets is different than a set of IpAddresses. For example, if subnets = bag([ipSubnet("1.2.3.0/32"), ipSubnet("1.2.3.1/32")]), then

  • toString(subnets) returns "[1.2.3.0/32, 1.2.3.1/32]" but
  • toString(ipAddressSet(subnets)) returns "[1.2.3.0/31]".

See also

Types

Functions