diff --git a/docs/api.adoc b/docs/api.adoc index 968ca8b..4bd0e1b 100644 --- a/docs/api.adoc +++ b/docs/api.adoc @@ -562,7 +562,17 @@ var resolver = mod_cueball.resolverForIpOrDomain({ In these examples, the `input` string is assumed to come from a user cueball does the expected thing when given an IP address or DNS name. +### `DNSResolver.getBootstrapResolver([host])` +Returns the `DNSResolver` created for the input host when +`resolverForIpOrDomain` is used to create a bootstrap resolver, i.e. a +resolver for the DNS service itself. If no resolver has yet been created, +returns `undefined`. + +Parameters + +- `host` -- String, hostname of the host for which the resolver is being +requested. ## Connection interface diff --git a/lib/resolver.js b/lib/resolver.js index 62c3c23..be3834a 100644 --- a/lib/resolver.js +++ b/lib/resolver.js @@ -400,6 +400,11 @@ CueBallDNSResolver.bootstrapResolvers = {}; CueBallDNSResolver.globalNSClients = {}; +CueBallDNSResolver.getBootstrapResolver = function (host) { + mod_assert.string(host, 'hostname'); + return (CueBallDNSResolver.bootstrapResolvers[host]); +}; + CueBallDNSResolver.prototype.start = function () { this.emit('startAsserted'); };