szmarczak / cacheable-lookup

A cacheable dns.lookup(…) that respects TTL :tada:
MIT License
193 stars 29 forks source link

set dns.lookup family by this._iface(has4 and has6) #38

Closed my1229 closed 3 years ago

my1229 commented 3 years ago

https://github.com/szmarczak/cacheable-lookup/blob/5960e1d98c61f9edd6873eb03050a12122f24af4/source/index.js#L285

could we set family by this._iface(has4 and has6), not set 0 always.

szmarczak commented 3 years ago

If you want to override the family option, then definitely a no. If you want to specify the family, then you can just set the family option when calling lookup(...).

my1229 commented 3 years ago

yes, override is not a good idea, but it seems that setting options.family also does not take effect when calling dns.lookup(...) interface,actually it is used to filter ip in package.

Is it possible that maybe cause a problem if calling ipv6 have wrong or timeout, the result will still return [] although options.family is ipv4 and dns.lookup ipv4 is also successed

szmarczak commented 3 years ago

It must be something wrong on your side, it works correctly here.