Random utils, IP address support functions.
Random utils, IP address support functions.
(address s)
(address a b c d)
(address a b c d e f g h i j k l m n o p)
Converts the given value to an IP address. Can work with strings, byte arrays, sequences of bytes and numbers. When 4 (for IPv4) or 16 (for IPv6) arguments are given, they should be a bytes or values which may be converted to (unchecked) bytes.
Converts the given value to an IP address. Can work with strings, byte arrays, sequences of bytes and numbers. When 4 (for IPv4) or 16 (for IPv6) arguments are given, they should be a bytes or values which may be converted to (unchecked) bytes.
(bytes-to-address b)
(bytes-to-address b & bytes)
Coverts a byte array to an IP address. If there are 4 bytes are less, an IPv4 address will be created, otherwise IPv6. When more than one argument is given, it will create a byte array, converting each argument's value to an unchecked byte. Will throw an exception if a number given for a byte is lesser than 0 or greater than 255.
Coverts a byte array to an IP address. If there are 4 bytes are less, an IPv4 address will be created, otherwise IPv6. When more than one argument is given, it will create a byte array, converting each argument's value to an unchecked byte. Will throw an exception if a number given for a byte is lesser than 0 or greater than 255.
(bytes-to-ipv4 b)
(bytes-to-ipv4 a b c d)
Creates new IPv4 address using an array of bytes. When 4 arguments are given, they will be used to create a byte array. Will throw an exception if a number given for a byte is lesser than 0 or greater than 255.
Creates new IPv4 address using an array of bytes. When 4 arguments are given, they will be used to create a byte array. Will throw an exception if a number given for a byte is lesser than 0 or greater than 255.
(bytes-to-ipv6 b)
(bytes-to-ipv6 a b c d e f g h i j k l m n o p)
Creates new IPv6 address using an array of bytes. When 16 arguments are given, they will be used to create a byte array. Will throw an exception if a number given for a byte is lesser than 0 or greater than 255.
Creates new IPv6 address using an array of bytes. When 16 arguments are given, they will be used to create a byte array. Will throw an exception if a number given for a byte is lesser than 0 or greater than 255.
(in4t? trie ip)
Returns true
if an IPv6 address is contained within the given tree.
Returns `true` if an IPv6 address is contained within the given tree.
(in6t? trie ip)
Returns true
if an IPv6 address is contained within the given tree.
Returns `true` if an IPv6 address is contained within the given tree.
(inet-address? v)
Returns true
if the given value is of a type java.net.InetAddress
.
Returns `true` if the given value is of a type `java.net.InetAddress`.
(ip? v)
Returns true
if the given value (a string, a number, a sequence of bytes, or an IP
address object) represents a valid IP address.
Returns `true` if the given value (a string, a number, a sequence of bytes, or an IP address object) represents a valid IP address.
(ipv4-mapped? v)
Returns true
if the given value (a string, a number, a sequence of bytes, or an IP
address object) represents a valid IPv4 address and it is a IPv4-mapped IPv6 address.
Returns `true` if the given value (a string, a number, a sequence of bytes, or an IP address object) represents a valid IPv4 address and it is a IPv4-mapped IPv6 address.
(ipv4? v)
Returns true
if the given value (a string, a number, a sequence of bytes, or an IP
address object) represents a valid IPv4 address.
Returns `true` if the given value (a string, a number, a sequence of bytes, or an IP address object) represents a valid IPv4 address.
(ipv6? v)
Returns true
if the given value (a string, a number, a sequence of bytes, or an IP
address object) represents a valid IPv6 address.
Returns `true` if the given value (a string, a number, a sequence of bytes, or an IP address object) represents a valid IPv6 address.
(is-ip? v)
Returns true
if the given value is of type inet.ipaddr.IPAddress
.
Returns `true` if the given value is of type `inet.ipaddr.IPAddress`.
(is-ipv4-mapped? v)
Returns true
if the given value is of type inet.ipaddr.ipv6.IPv6Address
and
it is IPv4-mapped address.
Returns `true` if the given value is of type `inet.ipaddr.ipv6.IPv6Address` and it is IPv4-mapped address.
(is-ipv4? v)
Returns true
if the given value is of type inet.ipaddr.ipv4.IPv4Address
.
Returns `true` if the given value is of type `inet.ipaddr.ipv4.IPv4Address`.
(is-ipv6? v)
Returns true
if the given value is of type inet.ipaddr.ipv6.IPv6Address
.
Returns `true` if the given value is of type `inet.ipaddr.ipv6.IPv6Address`.
(java-inet-to-address v)
Converts java.net.InetAddress
to IP address.
Converts `java.net.InetAddress` to IP address.
(number-to-address n)
Coverts a number to an IP address. If the number is a kind of java.math.BigInteger
or clojure.lang.BigInt
, the IPv6 address will be created. Otherwise the number
will be converted to int
and IPv4 address will be created.
Coverts a number to an IP address. If the number is a kind of `java.math.BigInteger` or `clojure.lang.BigInt`, the IPv6 address will be created. Otherwise the number will be converted to `int` and IPv4 address will be created.
(number-to-ipv4 n)
Coverts a number to an IPv4 address.
Coverts a number to an IPv4 address.
(number-to-ipv6 n)
Coverts a number to an IPv6 address.
Coverts a number to an IPv6 address.
(plain-ip ip)
Returns an IP address. If the address can be expressed as IPv4, it is returned as IPv4, otherwise as IPv6.
Returns an IP address. If the address can be expressed as IPv4, it is returned as IPv4, otherwise as IPv6.
(plain-ip-str ip)
Returns string representation of IP address (if the address can be expressed as IPv4, it is returned as 4 octets in dotted-decimal notation, otherwise IPv6 representation is returned).
Returns string representation of IP address (if the address can be expressed as IPv4, it is returned as 4 octets in dotted-decimal notation, otherwise IPv6 representation is returned).
(preprocess-ip-list p)
Takes a sequence of IP addresses and returns a vector of Trie trees with IP address ranges.
Takes a sequence of IP addresses and returns a vector of Trie trees with IP address ranges.
(string-to-address s)
Coverts a string to an IP address.
Coverts a string to an IP address.
(to-address s)
(to-address a b c d)
(to-address a b c d e f g h i j k l m n o p)
Converts the given value to an IP address. Can work with strings, byte arrays, sequences of bytes and numbers. When 4 (for IPv4) or 16 (for IPv6) arguments are given, they should be a bytes or values which may be converted to (unchecked) bytes.
Converts the given value to an IP address. Can work with strings, byte arrays, sequences of bytes and numbers. When 4 (for IPv4) or 16 (for IPv6) arguments are given, they should be a bytes or values which may be converted to (unchecked) bytes.
(to-str ip)
Converts IP address to a string. Returns nil
if it is not possible.
Converts IP address to a string. Returns `nil` if it is not possible.
(to-str-plain ip)
Returns string representation of IP address (if the address can be expressed as IPv4, it is returned as 4 octets in dotted-decimal notation, otherwise IPv6 representation is returned).
Returns string representation of IP address (if the address can be expressed as IPv4, it is returned as 4 octets in dotted-decimal notation, otherwise IPv6 representation is returned).
(to-str-v4 ip)
Converts IP address to a string expressing IPv4 notation. Returns nil
if this is
not possible.
Converts IP address to a string expressing IPv4 notation. Returns `nil` if this is not possible.
(to-str-v6 ip)
Converts IP address to a string expressing IPv6 notation. Returns nil
if this is
not possible.
Converts IP address to a string expressing IPv6 notation. Returns `nil` if this is not possible.
(to-string ip)
Converts IP address to a string. Returns nil
if it is not possible.
Converts IP address to a string. Returns `nil` if it is not possible.
(to-string-v4 ip)
Converts IP address to a string expressing IPv4 notation. Returns nil
if this is
not possible.
Converts IP address to a string expressing IPv4 notation. Returns `nil` if this is not possible.
(to-string-v6 ip)
Converts IP address to a string expressing IPv6 notation. Returns nil
if this is
not possible.
Converts IP address to a string expressing IPv6 notation. Returns `nil` if this is not possible.
(to-v4 v)
Converts the given IP address to IPv4. Returns nil
if this is not possible.
Converts the given IP address to IPv4. Returns `nil` if this is not possible.
(to-v6 v)
Converts the given IP address to IPv6. Returns nil
if this is not possible.
Converts the given IP address to IPv6. Returns `nil` if this is not possible.
(ubyte v)
Converts to an unchecked byte used to express unsigned values. Throws an
IllegalArgumentException
exception if the given value is not a byte but exceeds
the range of 0-255.
Converts to an unchecked byte used to express unsigned values. Throws an `IllegalArgumentException` exception if the given value is not a byte but exceeds the range of 0-255.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close