Function: textsec--ipvx-address-p

textsec--ipvx-address-p is a byte-compiled function defined in textsec.el.gz.

Signature

(textsec--ipvx-address-p DOMAIN)

Documentation

Return non-nil if DOMAIN is an ipv4 or ipv6 address.

Source Code

;; Defined in /usr/src/emacs/lisp/international/textsec.el.gz
(defun textsec--ipvx-address-p (domain)
  "Return non-nil if DOMAIN is an ipv4 or ipv6 address."
  ;; This is a very relaxed pattern for IPv4 or IPv6 addresses.  The
  ;; assumption is that any malformed address accepted by this rule
  ;; will be rejected by the actual address parser eventually.
  (let ((case-fold-search t))
    (rx-let ((ipv4 (** 1 4
                       (** 1 3 (in "0-9"))
                       (? ".")))
             (ipv6 (: (** 1 7
                          (** 0 4 (in "0-9a-f"))
                          ":")
                      (** 0 4 (in "0-9a-f"))
                      (? ":" ipv4))))
      (string-match-p (rx bos (or ipv4 ipv6 (: "[" ipv6 "]")) eos) domain))))