Liking cljdoc? Tell your friends :D

dk.simongray.whatwg-url.hosts

The hosts of URLs by the URL Standard, section 3: domains, IPv4 and IPv6 addresses, opaque hosts and the empty host.

A host is the text that parse returns for it, e.g. "127.0.0.1" or "[::1]". The functions that end in -report also return the validation errors as keywords. Pass them a vector to add the errors to, or nil to skip them.

The hosts of URLs by the URL Standard, section 3: domains, IPv4 and
IPv6 addresses, opaque hosts and the empty host.

A host is the text that parse returns for it, e.g. "127.0.0.1" or
"[::1]". The functions that end in -report also return the validation
errors as keywords. Pass them a vector to add the errors to, or nil to
skip them.
raw docstring

domain->asciiclj/s

(domain->ascii domain)
(domain->ascii domain {:keys [strict?] :as opts})

The Unicode domain in ASCII by the domain parser of the URL Standard, or nil when it doesn't convert, with opts:

  • :strict?, true to only allow the domains that DNS allows, e.g. with no _ and no label longer than 63

    (domain->ascii "Bücher.example") ;; => "xn--bcher-kva.example"

The Unicode `domain` in ASCII by the domain parser of the URL Standard,
or nil when it doesn't convert, with `opts`:

- :strict?, true to only allow the domains that DNS allows, e.g. with no
  _ and no label longer than 63

    (domain->ascii "Bücher.example")
    ;; => "xn--bcher-kva.example"
sourceraw docstring

domain->unicodeclj/s

(domain->unicode domain)

The domain in Unicode, for showing it to a person, or as it is when it doesn't convert.

(domain->unicode "xn--bcher-kva.example")
;; => "bücher.example"
The `domain` in Unicode, for showing it to a person, or as it is when it
doesn't convert.

    (domain->unicode "xn--bcher-kva.example")
    ;; => "bücher.example"
sourceraw docstring

domain-reportclj/s

(domain-report domain strict? errors)

The Unicode domain in ASCII by IDNA, and errors with its validation errors added, as a pair. The domain is nil when it doesn't convert. When strict?, it must also be a domain that DNS allows.

The Unicode `domain` in ASCII by IDNA, and `errors` with its validation
errors added, as a pair. The domain is nil when it doesn't convert. When
`strict?`, it must also be a domain that DNS allows.
sourceraw docstring

ends-in-a-number?clj/s

(ends-in-a-number? s)

Whether the last label of the ASCII domain s is a number, e.g. example.1 or example.0x, which makes the host an IPv4 address. An empty label at the end doesn't count.

Whether the last label of the ASCII domain `s` is a number, e.g.
example.1 or example.0x, which makes the host an IPv4 address. An empty
label at the end doesn't count.
sourceraw docstring

forbidden-domain-code-point?clj/s

(forbidden-domain-code-point? c)

Whether the code point c is a forbidden domain code point.

Whether the code point `c` is a forbidden domain code point.
sourceraw docstring

forbidden-host-code-point?clj/s

(forbidden-host-code-point? c)

Whether the code point c is a forbidden host code point.

Whether the code point `c` is a forbidden host code point.
sourceraw docstring

ipv4clj/s

(ipv4 s)

The IPv4 address in the ASCII text s as a number, or nil. Its parts can be decimal, octal or hexadecimal, and there may be fewer than four.

(ipv4 "0x7f.1")
;; => 2130706433
The IPv4 address in the ASCII text `s` as a number, or nil. Its parts
can be decimal, octal or hexadecimal, and there may be fewer than four.

    (ipv4 "0x7f.1")
    ;; => 2130706433
sourceraw docstring

ipv4-reportclj/s

(ipv4-report s errors)

The IPv4 address in the ASCII text s as a number, and errors with its validation errors added, as a pair. The address is nil when s isn't one.

The IPv4 address in the ASCII text `s` as a number, and `errors` with
its validation errors added, as a pair. The address is nil when `s`
isn't one.
sourceraw docstring

ipv6clj/s

(ipv6 s)

The eight 16-bit pieces of the IPv6 address in the text s (without brackets), or nil.

(ipv6 "::1")
;; => [0 0 0 0 0 0 0 1]
The eight 16-bit pieces of the IPv6 address in the text `s` (without
brackets), or nil.

    (ipv6 "::1")
    ;; => [0 0 0 0 0 0 0 1]
sourceraw docstring

ipv6-reportclj/s

(ipv6-report s errors)

The IPv6 address in the text s (without brackets) as its eight 16-bit pieces, and errors with its validation errors added, as a pair. The address is nil when s isn't one.

The IPv6 address in the text `s` (without brackets) as its eight 16-bit
pieces, and `errors` with its validation errors added, as a pair. The
address is nil when `s` isn't one.
sourceraw docstring

parseclj/s

(parse s)
(parse s {:keys [opaque?] :as opts})

The host in the text s, parsed as the host of a URL and returned as text, or nil when it doesn't parse. With opts:

  • :opaque?, true for the host of a URL whose scheme isn't special, which is only percent-encoded

    (parse "EXAMPLE.com") ;; => "example.com" (parse "0x7f.1") ;; => "127.0.0.1" (parse "[0:0::1]") ;; => "[::1]" (parse "faß.example") ;; => "xn--fa-hia.example"

The host in the text `s`, parsed as the host of a URL and returned as
text, or nil when it doesn't parse. With `opts`:

- :opaque?, true for the host of a URL whose scheme isn't special, which
  is only percent-encoded

    (parse "EXAMPLE.com")      ;; => "example.com"
    (parse "0x7f.1")           ;; => "127.0.0.1"
    (parse "[0:0::1]")         ;; => "[::1]"
    (parse "faß.example")      ;; => "xn--fa-hia.example"
sourceraw docstring

parse-reportclj/s

(parse-report s opaque? errors)

The host of the text s, opaque when opaque?, and errors with its validation errors added, as a pair. The host is nil when it doesn't parse.

The host of the text `s`, opaque when `opaque?`, and `errors` with its
validation errors added, as a pair. The host is nil when it doesn't
parse.
sourceraw docstring

public-suffixclj/s

(public-suffix host rules)

The public suffix of the domain host by the rules of suffix-rules, e.g. com or github.io, or nil when the host isn't a domain. When no rule matches, it's the last label of the host.

(public-suffix "whatwg.github.io" rules)
;; => "github.io"
The public suffix of the domain `host` by the `rules` of suffix-rules,
e.g. com or github.io, or nil when the host isn't a domain. When no rule
matches, it's the last label of the host.

    (public-suffix "whatwg.github.io" rules)
    ;; => "github.io"
sourceraw docstring

registrable-domainclj/s

(registrable-domain host rules)

The registrable domain of the domain host by the rules of suffix-rules: its public suffix and the label before it, e.g. example.com for www.example.com, or nil when there's no label before it.

(registrable-domain "sub.www.example.com" rules)
;; => "example.com"
The registrable domain of the domain `host` by the `rules` of
suffix-rules: its public suffix and the label before it, e.g.
example.com for www.example.com, or nil when there's no label before it.

    (registrable-domain "sub.www.example.com" rules)
    ;; => "example.com"
sourceraw docstring

serialize-ipv4clj/s

(serialize-ipv4 n)

The text of the IPv4 address n, e.g. 127.0.0.1.

The text of the IPv4 address `n`, e.g. 127.0.0.1.
sourceraw docstring

serialize-ipv6clj/s

(serialize-ipv6 pieces)

The text of the IPv6 address of the eight 16-bit pieces, without brackets, e.g. 2001:db8::1.

The text of the IPv6 address of the eight 16-bit `pieces`, without
brackets, e.g. 2001:db8::1.
sourceraw docstring

strict-optionsclj/s

The options of idna/to-ascii that the URL Standard's domain parser uses when it's strict.

The options of idna/to-ascii that the URL Standard's domain parser uses
when it's strict.
sourceraw docstring

suffix-rulesclj/s

(suffix-rules s)

The rules of the Public Suffix List in its text s (e.g. that of public_suffix_list.dat from https://publicsuffix.org/list/), for public-suffix and registrable-domain. They're a map of the :rules and the :exceptions (without their !), all in ASCII.

The rules of the Public Suffix List in its text `s` (e.g. that of
public_suffix_list.dat from https://publicsuffix.org/list/), for
public-suffix and registrable-domain. They're a map of the :rules and the
:exceptions (without their !), all in ASCII.
sourceraw docstring

valid-domain?clj/s

(valid-domain? s)

Whether the text s is a valid domain: one that the strict domain parser converts, and whose last label isn't a number.

Whether the text `s` is a valid domain: one that the strict domain
parser converts, and whose last label isn't a number.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close