使用 nodejs 获取 DNS 后缀

Get DNS suffix with nodejs

对于 NodeJs,“dns”库不使用 dns 后缀来解析主机名。

await dns.promises.resolve('foo.ad.toto.fr')
>>> [ '10.1.40.205' ]
await dns.promises.resolve('foo')
>>> Error: queryA ENOTFOUND foo
ipconfig /all

Configuration IP de Windows

   Nom de l’hôte . . . . . . . . . . : arc-pc-y399539
   Suffixe DNS principal . . . . . . : ad.toto.fr
   Type de noeud. . . . . . . . . .  : Hybride
   Routage IP activé . . . . . . . . : Non
   Proxy WINS activé . . . . . . . . : Non
   Liste de recherche du suffixe DNS.: ad.toto.fr

所以我需要获取“DNS 后缀列表”,但我不知道如何...

而且我无法解析命令“ipconfig”的 return,因为它必须与 windows 和 linux

兼容

我找到了获取主 dns 后缀的包“systeminformation”,但不是“DNS 后缀列表”