Functions to load inet.data entities from flat, line-oriented files.
Functions to load inet.data entities from flat, line-oriented files.
(domain-e2ld etlds dom)Return the effective 2LD, zone, or bailiwick of dom. Use etlds as the
set of ETLDs. etlds must support associative lookup and is normally a
dns/domain-set; dom accepts a string, primitive byte array, existing DNS
domain, or nil. This is lenient for malformed supported domains and returns
nil, as it does when no ETLD matches. An unsupported dom type throws
java.lang.IllegalArgumentException. For a domain set of n entries, k
matching ancestors, and encoded length b, lookup is O(b * (log n + k)).
Return the effective 2LD, zone, or bailiwick of `dom`. Use `etlds` as the set of ETLDs. `etlds` must support associative lookup and is normally a `dns/domain-set`; `dom` accepts a string, primitive byte array, existing DNS domain, or nil. This is lenient for malformed supported domains and returns nil, as it does when no ETLD matches. An unsupported `dom` type throws `java.lang.IllegalArgumentException`. For a domain set of `n` entries, `k` matching ancestors, and encoded length `b`, lookup is O(b * (log n + k)).
(domain-etld etlds dom)Return the effective TLD of dom from the hierarchical domain set etlds.
etlds must support associative lookup and is normally a dns/domain-set;
dom accepts a string, primitive byte array, existing DNS domain, or nil.
This is lenient for malformed supported domains and returns nil, as it does
when no proper suffix is present. An unsupported dom type throws
java.lang.IllegalArgumentException. For a domain set of n entries, k
matching ancestors, and encoded length b, lookup is O(b * (log n + k)).
Return the effective TLD of `dom` from the hierarchical domain set `etlds`. `etlds` must support associative lookup and is normally a `dns/domain-set`; `dom` accepts a string, primitive byte array, existing DNS domain, or nil. This is lenient for malformed supported domains and returns nil, as it does when no proper suffix is present. An unsupported `dom` type throws `java.lang.IllegalArgumentException`. For a domain set of `n` entries, `k` matching ancestors, and encoded length `b`, lookup is O(b * (log n + k)).
(load entryf collf & paths)Read the non-nil members of paths. The files contain line-oriented,
'#'-commented, tab-delimited entries. Parse each entry with entryf. Parse
the sequence of entries with collf. Both callbacks must implement
clojure.lang.IFn; each path may be any source accepted by
clojure.java.io/reader, or nil, which is skipped. With no non-nil paths this
leniently returns nil without invoking collf.
A missing file throws java.io.FileNotFoundException; other open, read, or
close failures throw java.io.IOException; an unsupported path throws
java.lang.IllegalArgumentException; and a non-function callback throws
java.lang.ClassCastException when invoked. Exceptions from either callback
propagate unchanged. For p paths and n retained input lines, traversal is
O(p + n) plus callback work; loader overhead is O(p), excluding collf's
result.
Read the non-`nil` members of `paths`. The files contain line-oriented, '#'-commented, tab-delimited entries. Parse each entry with `entryf`. Parse the sequence of entries with `collf`. Both callbacks must implement `clojure.lang.IFn`; each path may be any source accepted by `clojure.java.io/reader`, or nil, which is skipped. With no non-nil paths this leniently returns nil without invoking `collf`. A missing file throws `java.io.FileNotFoundException`; other open, read, or close failures throw `java.io.IOException`; an unsupported path throws `java.lang.IllegalArgumentException`; and a non-function callback throws `java.lang.ClassCastException` when invoked. Exceptions from either callback propagate unchanged. For `p` paths and `n` retained input lines, traversal is O(p + n) plus callback work; loader overhead is O(p), excluding `collf`'s result.
(load-domain-set & paths)Create a dns/domain-set from the entries in paths. Paths are readable
sources accepted by clojure.java.io/reader, or nil. This is lenient for
malformed domain entries: dns/domain converts them to nil and the set
retains that root representation. A missing file throws
java.io.FileNotFoundException, other I/O failures throw
java.io.IOException, and an unsupported path throws
java.lang.IllegalArgumentException. For n entries, longest encoded domain
b, and encoded byte total B, loading takes O(n^2 * b + B) worst-case time
and O(n + B) result space.
Create a `dns/domain-set` from the entries in `paths`. Paths are readable sources accepted by `clojure.java.io/reader`, or nil. This is lenient for malformed domain entries: `dns/domain` converts them to nil and the set retains that root representation. A missing file throws `java.io.FileNotFoundException`, other I/O failures throw `java.io.IOException`, and an unsupported path throws `java.lang.IllegalArgumentException`. For `n` entries, longest encoded domain `b`, and encoded byte total `B`, loading takes O(n^2 * b + B) worst-case time and O(n + B) result space.
(load-network-set & paths)Create an ip/network-set from the entries in paths. Paths are readable
sources accepted by clojure.java.io/reader, or nil. This is strict for
malformed entries: ip/network first converts one to nil, then set
construction throws java.lang.IllegalArgumentException when it attempts to
convert that nil again. A missing file throws
java.io.FileNotFoundException, other I/O failures throw
java.io.IOException, and an unsupported path throws
java.lang.IllegalArgumentException. Loading n valid entries takes O(n^2)
worst-case time and O(n) result space.
Create an `ip/network-set` from the entries in `paths`. Paths are readable sources accepted by `clojure.java.io/reader`, or nil. This is strict for malformed entries: `ip/network` first converts one to nil, then set construction throws `java.lang.IllegalArgumentException` when it attempts to convert that nil again. A missing file throws `java.io.FileNotFoundException`, other I/O failures throw `java.io.IOException`, and an unsupported path throws `java.lang.IllegalArgumentException`. Loading `n` valid entries takes O(n^2) worst-case time and O(n) result space.
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 |