(address, port, callback)
| 266 | |
| 267 | |
| 268 | function lookupService(address, port, callback) { |
| 269 | if (arguments.length !== 3) |
| 270 | throw new ERR_MISSING_ARGS('address', 'port', 'callback'); |
| 271 | |
| 272 | if (isIP(address) === 0) |
| 273 | throw new ERR_INVALID_ARG_VALUE('address', address); |
| 274 | |
| 275 | validatePort(port); |
| 276 | |
| 277 | validateFunction(callback, 'callback'); |
| 278 | |
| 279 | // Coerce -0 to +0. |
| 280 | port = +port + 0; |
| 281 | |
| 282 | const req = new GetNameInfoReqWrap(); |
| 283 | req.callback = callback; |
| 284 | req.hostname = address; |
| 285 | req.port = port; |
| 286 | req.oncomplete = onlookupservice; |
| 287 | |
| 288 | const err = cares.getnameinfo(req, address, port); |
| 289 | if (err) throw new DNSException(err, 'getnameinfo', address); |
| 290 | if (hasObserver('dns')) { |
| 291 | startPerf(req, kPerfHooksDnsLookupServiceContext, { |
| 292 | type: 'dns', |
| 293 | name: 'lookupService', |
| 294 | detail: { |
| 295 | host: address, |
| 296 | port, |
| 297 | }, |
| 298 | }); |
| 299 | } |
| 300 | return req; |
| 301 | } |
| 302 | |
| 303 | ObjectDefineProperty(lookupService, customPromisifyArgs, |
| 304 | { __proto__: null, value: ['hostname', 'service'], enumerable: false }); |
nothing calls this directly
no test coverage detected
searching dependent graphs…