lib/cares.js
function Resolver(options) {
    if (!(this instanceof Resolver)) {
        return new Resolver(options);
    }

    options = options || {};

    if (!isObject(options)) {
        throw new Error('options must be an object');
    }

    this._resolver = new cares.Resolver(options);

    if (options.servers) {
        this.setServers(options.servers);
    }
}
function Resolver(options) {
    if (!(this instanceof Resolver)) {
        return new Resolver(options);
    }

    options = options || {};

    if (!isObject(options)) {
        throw new Error('options must be an object');
    }

    this._resolver = new cares.Resolver(options);

    if (options.servers) {
        this.setServers(options.servers);
    }
}
function Resolver ( options ) { if ( ! ( this instanceof Resolver ) ) { return new Resolver ( options ) ; } options = options || { } ; if ( ! isObject ( options ) ) { throw new Error ( 'options must be an object' ) ; } this . _resolver = new cares . Resolver ( options ) ; if ( options . servers ) { this . setServers ( options . servers ) ; } }
Initialize the resolver with given options.
@param {Object} [options={}] The options to be used with the resolver.
@param {Number} [options.timeout=5000] The number of milliseconds each
name server should be given to respond to a query on the first try.
(After the first try, the timeout algorithm becomes more complicated,
but scales linearly with the value of timeout.)
@param {Number} [options.tries=4] The number of times the resolver should try
contacting each name server before giving up.
@param {Number} [options.ndots=1] The number of dots which must be present in
a domain name for it to be queried for "as is" prior to querying for it with
the default domain extensions appended. The default value is 1 unless set
otherwise by resolv.conf or the RES_OPTIONS environment variable.
@param {Number} [options.tcp_port] The tcp port to use for queries.
@param {Number} [options.udp_port] The udp port to use for queries.
@param {Array} [options.servers] An array of IP addresses as strings,
set them as the servers to use for resolving.
@param {Number} [options.flags] The flags field should be the bitwise or
of some subset of ARES_FLAG_*.
@class
@classdesc Instances of the Resolver class represent a single `ares_channel`.
Initialize the resolver with given options .