Functions for interacting with IP addresses and networks.
Functions for interacting with IP addresses and networks.
(->address addr)Coerce addr to an IPAddress. Throws when it cannot interpret addr.
Coerce `addr` to an IPAddress. Throws when it cannot interpret `addr`.
(->network net)Coerce net to an IPNetwork. Throws when it cannot interpret net.
Coerce `net` to an IPNetwork. Throws when it cannot interpret `net`.
(->network-set coll)Create a hierarchical set from networks in coll.
Create a hierarchical set from networks in `coll`.
(address addr)Return the IP address for representation addr.
This function accepts IPv6 zone IDs. It keeps a zone in metadata for text round-tripping only. A zone is not part of address identity, equality, hashing, comparison, or network ordering. Serialization does not keep the zone. This function rejects zones on IPv4 addresses and on network literals.
Return the IP address for representation `addr`. This function accepts IPv6 zone IDs. It keeps a zone in metadata for text round-tripping only. A zone is not part of address identity, equality, hashing, comparison, or network ordering. Serialization does not keep the zone. This function rejects zones on IPv4 addresses and on network literals.
(address-add addr n)Return the nth address after addr in numeric order.
Return the `n`th address after `addr` in numeric order.
(address-networks start stop)Return the minimal set of networks that contains only the addresses from
start to stop, inclusive.
Return the minimal set of networks that contains only the addresses from `start` to `stop`, *inclusive*.
(address-range start stop)Return a sequence of addresses from start to stop, inclusive.
Return a sequence of addresses from `start` to `stop`, *inclusive*.
(address-zero? addr)True if and only if the address addr is the zero address.
True if and only if the address `addr` is the zero address.
(address? addr)Determine if addr represents an IP address.
Determine if `addr` represents an IP address.
(aggregate-networks values)Return a minimal, ascending network-set covering values exactly.
Values can be addresses or networks. Bare addresses become host networks. This function aggregates IPv4 and IPv6 values independently. It skips invalid or unsupported values, the same as the invalid values that this namespace's address and network predicates reject.
Return a minimal, ascending `network-set` covering `values` exactly. Values can be addresses or networks. Bare addresses become host networks. This function aggregates IPv4 and IPv6 values independently. It skips invalid or unsupported values, the same as the invalid values that this namespace's address and network predicates reject.
(benchmarking? value)Return true when value is in the IPv4 benchmarking block.
For a network value, the result is true only when the full network is inside the benchmarking block. This function does not unwrap IPv4-mapped IPv6 addresses.
Return true when `value` is in the IPv4 benchmarking block. For a network value, the result is true only when the full network is inside the benchmarking block. This function does not unwrap IPv4-mapped IPv6 addresses.
(broadcast? value)Return true when value is the IPv4 limited broadcast address.
For a network value, the result is true only when the full network is
255.255.255.255/32. This function does not unwrap IPv4-mapped IPv6
addresses.
Return true when `value` is the IPv4 limited broadcast address. For a network value, the result is true only when the full network is `255.255.255.255/32`. This function does not unwrap IPv4-mapped IPv6 addresses.
(documentation? value)Return true when value is in an IPv4 or IPv6 documentation block.
For a network value, the result is true only when the full network is inside a documentation block. This function does not unwrap IPv4-mapped IPv6 addresses.
Return true when `value` is in an IPv4 or IPv6 documentation block. For a network value, the result is true only when the full network is inside a documentation block. This function does not unwrap IPv4-mapped IPv6 addresses.
(global? value)Return true when value is valid and matches no special-use block.
For a network value, the result is true only when the full network is outside every special-use block. This function does not unwrap IPv4-mapped IPv6 addresses.
Return true when `value` is valid and matches no special-use block. For a network value, the result is true only when the full network is outside every special-use block. This function does not unwrap IPv4-mapped IPv6 addresses.
(inet-address addr)Generate a java.net.InetAddress from the value addr.
Generate a java.net.InetAddress from the value `addr`.
(link-local? value)Return true when value is in an IPv4 or IPv6 link-local block.
For a network value, the result is true only when the full network is inside a link-local block. This function does not unwrap IPv4-mapped IPv6 addresses.
Return true when `value` is in an IPv4 or IPv6 link-local block. For a network value, the result is true only when the full network is inside a link-local block. This function does not unwrap IPv4-mapped IPv6 addresses.
(loopback? value)Return true when value is in an IPv4 or IPv6 loopback block.
For a network value, the result is true only when the full network is inside a loopback block. This function does not unwrap IPv4-mapped IPv6 addresses.
Return true when `value` is in an IPv4 or IPv6 loopback block. For a network value, the result is true only when the full network is inside a loopback block. This function does not unwrap IPv4-mapped IPv6 addresses.
(multicast? value)Return true when value is in an IPv4 or IPv6 multicast block.
For a network value, the result is true only when the full network is inside a multicast block. This function does not unwrap IPv4-mapped IPv6 addresses.
Return true when `value` is in an IPv4 or IPv6 multicast block. For a network value, the result is true only when the full network is inside a multicast block. This function does not unwrap IPv4-mapped IPv6 addresses.
(network net)(network prefix length)Return the IP network for representation net or prefix and length.
Return the IP network for representation `net` or `prefix` and `length`.
(network-compare left right)(network-compare stable left right)Compare the prefixes of networks left and right. The result semantics
are the same as compare. When stable is true (the default), the result is 0
only when the networks are value-identical. When stable is false, the result
is 0 when the networks are identical up to their minimum common prefix length.
Compare the prefixes of networks `left` and `right`. The result semantics are the same as `compare`. When `stable` is true (the default), the result is 0 only when the networks are value-identical. When `stable` is false, the result is 0 when the networks are identical up to their minimum common prefix length.
(network-contains? net addr)Determine if network net contains the address/network addr.
Determine if network `net` contains the address/network `addr`.
(network-count net)Count of addresses in network net. count on an IPNetwork throws an
IPNetworkException when this value exceeds Integer/MAX_VALUE; use this
function for the exact count.
Count of addresses in network `net`. `count` on an IPNetwork throws an IPNetworkException when this value exceeds Integer/MAX_VALUE; use this function for the exact count.
(network-nth net n)Return the nth address in the network net. Negative ns count backward
from the final address at -1.
Return the `n`th address in the network `net`. Negative `n`s count backward from the final address at -1.
(network-set & nets)Create a hierarchical set from networks nets.
Create a hierarchical set from networks `nets`.
(network-subnets net)(network-subnets net n)Set of networks in the network net which have n more bits of network
prefix, default 1.
Set of networks in the network `net` which have `n` more bits of network prefix, default 1.
(network-supernet net)(network-supernet net n)Return a network that contains net. Its prefix is n bits shorter. The
default is 1.
Return a network that contains `net`. Its prefix is `n` bits shorter. The default is 1.
(network-trunc prefix)(network-trunc prefix length)Create a network. Its prefix is the first length bits of prefix, and its
length is length.
Create a network. Its prefix is the first `length` bits of `prefix`, and its length is `length`.
(network? net)(network? addr length)Determine if net represents an IP network.
Determine if `net` represents an IP network.
(private? value)Return true when value is in an RFC 1918 private block.
For a network value, the result is true only when the full network is inside one private block. This function does not unwrap IPv4-mapped IPv6 addresses.
Return true when `value` is in an RFC 1918 private block. For a network value, the result is true only when the full network is inside one private block. This function does not unwrap IPv4-mapped IPv6 addresses.
(reserved? value)Return true when value is in the IPv4 reserved-for-future-use block.
For a network value, the result is true only when the full network is inside the reserved block. This function does not unwrap IPv4-mapped IPv6 addresses.
Return true when `value` is in the IPv4 reserved-for-future-use block. For a network value, the result is true only when the full network is inside the reserved block. This function does not unwrap IPv4-mapped IPv6 addresses.
(shared-address-space? value)Return true when value is in the IPv4 shared address space block.
For a network value, the result is true only when the full network is inside the shared address space block. This function does not unwrap IPv4-mapped IPv6 addresses.
Return true when `value` is in the IPv4 shared address space block. For a network value, the result is true only when the full network is inside the shared address space block. This function does not unwrap IPv4-mapped IPv6 addresses.
(special-use value)Return the most-specific special-use concept keyword for value, or nil.
The function accepts address-like and network-like values. For a network
value, the result is non-nil only when the full network is inside one
special-use block. IPv4-mapped IPv6 addresses have the :ipv4-mapped
classification. This function does not unwrap them as IPv4 addresses.
Return the most-specific special-use concept keyword for `value`, or `nil`. The function accepts address-like and network-like values. For a network value, the result is non-`nil` only when the full network is inside one special-use block. IPv4-mapped IPv6 addresses have the `:ipv4-mapped` classification. This function does not unwrap them as IPv4 addresses.
(unique-local? value)Return true when value is in the IPv6 unique-local block.
For a network value, the result is true only when the full network is inside the unique-local block. This function does not unwrap IPv4-mapped IPv6 addresses.
Return true when `value` is in the IPv6 unique-local block. For a network value, the result is true only when the full network is inside the unique-local block. This function does not unwrap IPv4-mapped IPv6 addresses.
(unspecified? value)Return true when value is the IPv6 unspecified address.
For a network value, the result is true only when the full network is
::/128. This function does not unwrap IPv4-mapped IPv6 addresses.
Return true when `value` is the IPv6 unspecified address. For a network value, the result is true only when the full network is `::/128`. This function does not unwrap IPv4-mapped IPv6 addresses.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |