Function: dns-query-asynchronous

dns-query-asynchronous is a byte-compiled function defined in dns.el.gz.

Signature

(dns-query-asynchronous NAME CALLBACK &optional TYPE FULL REVERSE)

Documentation

Query a DNS server for NAME of TYPE.

CALLBACK will be called with a single parameter: The result.

If there's no result, or dns-timeout has passed, CALLBACK will be called with nil as the parameter.

If FULL, return the entire record. If REVERSE, look up an IP address.

Probably introduced at or before Emacs version 28.1.

Source Code

;; Defined in /usr/src/emacs/lisp/net/dns.el.gz
(defun dns-query-asynchronous (name callback &optional type full reverse)
  "Query a DNS server for NAME of TYPE.
CALLBACK will be called with a single parameter: The result.

If there's no result, or `dns-timeout' has passed, CALLBACK will
be called with nil as the parameter.

If FULL, return the entire record.
If REVERSE, look up an IP address."
  (setq type (or type 'A))
  (unless (dns-servers-up-to-date-p)
    (dns-set-servers))

  (when reverse
    (setq name (concat
		(mapconcat #'identity (nreverse (split-string name "\\.")) ".")
		".in-addr.arpa")
	  type 'PTR))

  (if (not dns-servers)
      (progn
        (message "No DNS server configuration found")
        nil)
    (dns--lookup name callback type full)))