MCPcopy Index your code
hub / github.com/nodejs/node / lookupService

Function lookupService

lib/dns.js:268–301  ·  view source on GitHub ↗
(address, port, callback)

Source from the content-addressed store, hash-verified

266
267
268function 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
303ObjectDefineProperty(lookupService, customPromisifyArgs,
304 { __proto__: null, value: ['hostname', 'service'], enumerable: false });

Callers

nothing calls this directly

Calls 3

isIPFunction · 0.85
hasObserverFunction · 0.85
startPerfFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…