Functions for interacting with DNS domain names.
Internally represents domain names using a normalized byte-oriented form. The normalized form is defined as: (a) IDN labels IDNA-encoded; (b) domain labels arranged from top-level to bottom-level (i.e., reversed from typical order); and (c) every label preceded by a byte indicating the count of bytes in the label.
This form has the following benefits: (a) it may accurately represent any binary data, just like the DNS wire form; (b) lexicographic byte order is also hierarchical order; and (c) for a given child domain and ancestor domain, one may easily find the next longer child of the ancestor. The primary down-side is that this form does make it more difficult to find the immediate parent of a given domain.
Functions for interacting with DNS domain names. Internally represents domain names using a normalized byte-oriented form. The normalized form is defined as: (a) IDN labels IDNA-encoded; (b) domain labels arranged from top-level to bottom-level (i.e., reversed from typical order); and (c) every label preceded by a byte indicating the count of bytes in the label. This form has the following benefits: (a) it may accurately represent any binary data, just like the DNS wire form; (b) lexicographic byte order is also hierarchical order; and (c) for a given child domain and ancestor domain, one may easily find the next longer child of the ancestor. The primary down-side is that this form does make it more difficult to find the immediate parent of a given domain.
(->domain-set coll)
Create a hierarchical set from domains in coll
.
Create a hierarchical set from domains in `coll`.
(domain dom)
The DNS domain for representation dom
.
The DNS domain for representation `dom`.
(domain-ancestors child)
(domain-ancestors child parent)
Generate a seq of the all the domains for which the provided domain child
is a proper subdomain, starting with the domain after parent
and ending with
the domain itself. Uses the implied empty root domain as parent
if not
provided.
Generate a seq of the all the domains for which the provided domain `child` is a proper subdomain, starting with the domain after `parent` and ending with the domain itself. Uses the implied empty root domain as `parent` if not provided.
(domain-byte-seq dom)
Return the internal normalized byte form of of the domain dom
as a
sequence of bytes.
Return the internal normalized byte form of of the domain `dom` as a sequence of bytes.
(domain-compare left right)
(domain-compare stable left right)
Compare two domains, with the same result semantics as compare
. When
stable
is true (the default), 0 will only be returned when the domains are
value-identical. When stable
is false, 0 will be returned as long as the
networks are identical up to their minimum common full-label length. Domain
comparison always occurs in a case-independent fashion.
Compare two domains, with the same result semantics as `compare`. When `stable` is true (the default), 0 will only be returned when the domains are value-identical. When `stable` is false, 0 will be returned as long as the networks are identical up to their minimum common full-label length. Domain comparison always occurs in a case-independent fashion.
(domain-contains? parent child)
Determine if the domain child
is a subdomain of or identical to the domain
parent
.
Determine if the domain `child` is a subdomain of or identical to the domain `parent`.
(domain-hostname? dom)
(domain-hostname? dom underscores)
Determine if the provided domain dom
is a valid hostname. Allow
underscores in hostnames if underscores
is true (default false).
Determine if the provided domain `dom` is a valid hostname. Allow underscores in hostnames if `underscores` is true (default false).
(domain-labels dom)
Seq of labels in the domain dom
.
Seq of labels in the domain `dom`.
(domain-next child)
(domain-next child parent)
For the domain child
which is a subdomain of domain parent
, return the
immediate child domain of parent
which is either identical to child
or also
a parent domain of child
. Returns nil
if there is no such domain. Uses
the implied empty root domain as parent
if not provided.
For the domain `child` which is a subdomain of domain `parent`, return the immediate child domain of `parent` which is either identical to `child` or also a parent domain of `child`. Returns `nil` if there is no such domain. Uses the implied empty root domain as `parent` if not provided.
(domain-parent dom)
Return the domain for which dom
is an immediate sub-domain.
Return the domain for which `dom` is an immediate sub-domain.
(domain-set & doms)
Create a hierarchical set from domains doms
.
Create a hierarchical set from domains `doms`.
(domain-subdomain? parent child)
Determine if the domain child
is a subdomain of the domain parent
.
Determine if the domain `child` is a subdomain of the domain `parent`.
(domain? dom)
Determine if dom is a value which represents a DNS domain.
Determine if dom is a value which represents a DNS domain.
(idn-str dom)
Convert dom
to IDN string form, interpreting Punycode.
Convert `dom` to IDN string form, interpreting Punycode.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close