Method Protocols.DNS.async_client()->generic_query()


Method generic_query

void generic_query(string type, string domain, function(array(string)|zero, __unknown__ ... :void) callback, mixed ... restargs)

Description

Asynchronous DNS query with multiple results and a distinction between failure and empty results.

Parameter type

DNS query type. Currenlty supported:

"A"

Return just IPv4 records.

"AAAA"

Return both IPv6 and IPv4 records.

"PTR"

Reverse lookup for IP addresses, it expects normal IP addresses for domain.

"TXT"

Return TXT records.

"MX"

Return MX records sorted by preference, lowest numbers first.

"MXIP"

Like querying for MX, except it returns IP addresses instead of the MX records themselves.

Parameter domain

The domain name we are querying. Add a trailing dot to prohibit domain-postfix searching.

Parameter callback

The callback function that receives the result of the DNS query. It should be declared as follows: void callback(array(string)|zero results, mixed ... restargs); If the request fails it will return zero for results.

Parameter restargs

They are passed unaltered to the callback function.

Note

There is a notable difference between results equal to zero (= request failed and can be retried) and ({}) (= request definitively answered the record does not exist; retries are pointless).

Note

This method uses the exact same heuristics as the standard DNS resolver library (regarding the use of /etc/hosts, and when to perform a domain-postfix search, and when not to (i.e. trailing dot)).

Note

All queries sort automatically by preference (lowest numbers first).