MCPcopy
hub / github.com/nodejs/undici / #defaultLookup

Method #defaultLookup

lib/interceptor/dns.js:241–265  ·  view source on GitHub ↗
(origin, opts, cb)

Source from the content-addressed store, hash-verified

239 }
240
241 #defaultLookup (origin, opts, cb) {
242 lookup(
243 origin.hostname,
244 {
245 all: true,
246 family: this.dualStack === false ? this.affinity : 0,
247 order: 'ipv4first'
248 },
249 (err, addresses) => {
250 if (err) {
251 return cb(err)
252 }
253
254 const results = new Map()
255
256 for (const addr of addresses) {
257 // On linux we found duplicates, we attempt to remove them with
258 // the latest record
259 results.set(`${addr.address}:${addr.family}`, addr)
260 }
261
262 cb(null, results.values())
263 }
264 )
265 }
266
267 #defaultPick (origin, hostnameRecords, affinity) {
268 let ip = null

Callers

nothing calls this directly

Calls 3

valuesMethod · 0.80
lookupFunction · 0.50
setMethod · 0.45

Tested by

no test coverage detected