nameservers – array, defaults to unset
An array of IP addresses to use as name servers. If this is unset, Net_DNS2 will default to using the /etc/resolv.conf file.
use_tcp – boolean, defaults to false.
Tells Net_DNS2 to use TCP instead of UDP for queries. UDP is faster, but is limited in size. Net_DNS2 will automatically use TCP for zone transfers (AFXR) and when a response was truncated.
In the event of a truncated response, Net_DNS2 will switch to TCP, and resend the request.
dns_port – int, defaults to 53.
The UDP/TCP port to use when making DNS requests.
local_host – string, defaults to unset.
The local IP address to bind to when making outbound requests.
local_port – int, defaults to unset.
The local port number to bind to when making outbound requests. local_host can be set without this setting, and the system will auto-allocate the port from the ephemeral ports.
timeout – int, defaults to 5 seconds
Timeout value to use for socket connections (in seconds)
ns_random – boolean, defaults to false
Tells Net_DNS2 to randomize the name servers list each time it’s used.
domain – string, defaults to unset
The default domain to use for unqualified host names.
cache_type – string, defaults to ‘none’
Defines the type of cache to use; either ‘none’ to disable the cache, ‘shared’ to use the shmop extension, or ‘file’ to use a flat file.
cache_file – string, defaults to ‘/tmp/net_dns2.cache’
The file to use for the cache. This is used for both the shared memory and file based cached. Net_DNS2 will need to write to this file, so it must have proper permissions.
cache_size – int, defaults to 10000
The number of bytes Net_DNS2 is allowed to use as a cache- the bigger the better.
cache_serializer – string, defaults to ‘serialize’ (since v1.2.0)
Defines the serialization method to use when storing the cache content. Can be either ‘serialize’ to use the PHP serialize function, or ‘json’ to store the data as a JSON object.
JSON is much faster, but loses the object definition; all content becomes a stdClass object- but all the data is still accessible.
strict_query_mode – boolean, defaults to false
strict_query_mode means that if the hostname that was looked up isn’t actually in the answer section of the response, Net_DNS2 will return an empty answer section, instead of an answer section that could contain CNAME records.
recurse – boolean, defaults to true
if we should set the recursion desired bit to 1 or 0.
dnssec – boolean, defaults to false
request DNSSEC values, by setting the DO flag to 1; this actually makes the resolver add a OPT RR to the additional section, and sets the DO flag in this RR to 1.
dnssec_ad_flag – boolean, defaults to false
set the DNSSEC AD (Authentic Data) bit on/off.
dnssec_cd_flag – boolean, defaults to false
set the DNSSEC CD (Checking Disabled) bit on/off
dnssec_payload_size – integer, defaults to 1280
the EDNS(0) UDP payload size to use when making DNSSEC requests; see RFC 2671 section 6.2.3 for more details
// // pass the options directly to the constructor // $r = new Net_DNS2_Resolver(array( 'nameservers' => array('192.168.0.1', '192.168.0.2'), 'use_tcp' => true, 'cache_type' => 'shared', 'cache_size' => 100000 )