| 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 |