alicezetion 1.9.6 → 1.9.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (292) hide show
  1. package/.cache/replit/modules/nodejs-20.res +1 -0
  2. package/.cache/replit/modules/replit.res +1 -0
  3. package/.cache/typescript/5.4/node_modules/.package-lock.json +137 -0
  4. package/.cache/typescript/5.4/node_modules/@types/bluebird/LICENSE +21 -0
  5. package/.cache/typescript/5.4/node_modules/@types/bluebird/README.md +15 -0
  6. package/.cache/typescript/5.4/node_modules/@types/bluebird/index.d.ts +1365 -0
  7. package/.cache/typescript/5.4/node_modules/@types/bluebird/package.json +25 -0
  8. package/.cache/typescript/5.4/node_modules/@types/caseless/LICENSE +21 -0
  9. package/.cache/typescript/5.4/node_modules/@types/caseless/README.md +48 -0
  10. package/.cache/typescript/5.4/node_modules/@types/caseless/index.d.ts +29 -0
  11. package/.cache/typescript/5.4/node_modules/@types/caseless/package.json +35 -0
  12. package/.cache/typescript/5.4/node_modules/@types/cheerio/LICENSE +21 -0
  13. package/.cache/typescript/5.4/node_modules/@types/cheerio/README.md +15 -0
  14. package/.cache/typescript/5.4/node_modules/@types/cheerio/index.d.ts +318 -0
  15. package/.cache/typescript/5.4/node_modules/@types/cheerio/package.json +71 -0
  16. package/.cache/typescript/5.4/node_modules/@types/node/LICENSE +21 -0
  17. package/.cache/typescript/5.4/node_modules/@types/node/README.md +15 -0
  18. package/.cache/typescript/5.4/node_modules/@types/node/assert/strict.d.ts +8 -0
  19. package/.cache/typescript/5.4/node_modules/@types/node/assert.d.ts +1040 -0
  20. package/.cache/typescript/5.4/node_modules/@types/node/async_hooks.d.ts +541 -0
  21. package/.cache/typescript/5.4/node_modules/@types/node/buffer.d.ts +2363 -0
  22. package/.cache/typescript/5.4/node_modules/@types/node/child_process.d.ts +1544 -0
  23. package/.cache/typescript/5.4/node_modules/@types/node/cluster.d.ts +578 -0
  24. package/.cache/typescript/5.4/node_modules/@types/node/console.d.ts +452 -0
  25. package/.cache/typescript/5.4/node_modules/@types/node/constants.d.ts +19 -0
  26. package/.cache/typescript/5.4/node_modules/@types/node/crypto.d.ts +4523 -0
  27. package/.cache/typescript/5.4/node_modules/@types/node/dgram.d.ts +596 -0
  28. package/.cache/typescript/5.4/node_modules/@types/node/diagnostics_channel.d.ts +554 -0
  29. package/.cache/typescript/5.4/node_modules/@types/node/dns/promises.d.ts +476 -0
  30. package/.cache/typescript/5.4/node_modules/@types/node/dns.d.ts +864 -0
  31. package/.cache/typescript/5.4/node_modules/@types/node/dom-events.d.ts +124 -0
  32. package/.cache/typescript/5.4/node_modules/@types/node/domain.d.ts +170 -0
  33. package/.cache/typescript/5.4/node_modules/@types/node/events.d.ts +931 -0
  34. package/.cache/typescript/5.4/node_modules/@types/node/fs/promises.d.ts +1245 -0
  35. package/.cache/typescript/5.4/node_modules/@types/node/fs.d.ts +4317 -0
  36. package/.cache/typescript/5.4/node_modules/@types/node/globals.d.ts +412 -0
  37. package/.cache/typescript/5.4/node_modules/@types/node/globals.global.d.ts +1 -0
  38. package/.cache/typescript/5.4/node_modules/@types/node/http.d.ts +1908 -0
  39. package/.cache/typescript/5.4/node_modules/@types/node/http2.d.ts +2418 -0
  40. package/.cache/typescript/5.4/node_modules/@types/node/https.d.ts +550 -0
  41. package/.cache/typescript/5.4/node_modules/@types/node/index.d.ts +89 -0
  42. package/.cache/typescript/5.4/node_modules/@types/node/inspector.d.ts +2746 -0
  43. package/.cache/typescript/5.4/node_modules/@types/node/module.d.ts +315 -0
  44. package/.cache/typescript/5.4/node_modules/@types/node/net.d.ts +999 -0
  45. package/.cache/typescript/5.4/node_modules/@types/node/os.d.ts +495 -0
  46. package/.cache/typescript/5.4/node_modules/@types/node/package.json +217 -0
  47. package/.cache/typescript/5.4/node_modules/@types/node/path.d.ts +191 -0
  48. package/.cache/typescript/5.4/node_modules/@types/node/perf_hooks.d.ts +905 -0
  49. package/.cache/typescript/5.4/node_modules/@types/node/process.d.ts +1754 -0
  50. package/.cache/typescript/5.4/node_modules/@types/node/punycode.d.ts +117 -0
  51. package/.cache/typescript/5.4/node_modules/@types/node/querystring.d.ts +153 -0
  52. package/.cache/typescript/5.4/node_modules/@types/node/readline/promises.d.ts +150 -0
  53. package/.cache/typescript/5.4/node_modules/@types/node/readline.d.ts +540 -0
  54. package/.cache/typescript/5.4/node_modules/@types/node/repl.d.ts +430 -0
  55. package/.cache/typescript/5.4/node_modules/@types/node/sea.d.ts +153 -0
  56. package/.cache/typescript/5.4/node_modules/@types/node/stream/consumers.d.ts +12 -0
  57. package/.cache/typescript/5.4/node_modules/@types/node/stream/promises.d.ts +83 -0
  58. package/.cache/typescript/5.4/node_modules/@types/node/stream/web.d.ts +367 -0
  59. package/.cache/typescript/5.4/node_modules/@types/node/stream.d.ts +1707 -0
  60. package/.cache/typescript/5.4/node_modules/@types/node/string_decoder.d.ts +67 -0
  61. package/.cache/typescript/5.4/node_modules/@types/node/test.d.ts +1718 -0
  62. package/.cache/typescript/5.4/node_modules/@types/node/timers/promises.d.ts +97 -0
  63. package/.cache/typescript/5.4/node_modules/@types/node/timers.d.ts +240 -0
  64. package/.cache/typescript/5.4/node_modules/@types/node/tls.d.ts +1217 -0
  65. package/.cache/typescript/5.4/node_modules/@types/node/trace_events.d.ts +197 -0
  66. package/.cache/typescript/5.4/node_modules/@types/node/tty.d.ts +208 -0
  67. package/.cache/typescript/5.4/node_modules/@types/node/url.d.ts +952 -0
  68. package/.cache/typescript/5.4/node_modules/@types/node/util.d.ts +2292 -0
  69. package/.cache/typescript/5.4/node_modules/@types/node/v8.d.ts +808 -0
  70. package/.cache/typescript/5.4/node_modules/@types/node/vm.d.ts +924 -0
  71. package/.cache/typescript/5.4/node_modules/@types/node/wasi.d.ts +181 -0
  72. package/.cache/typescript/5.4/node_modules/@types/node/worker_threads.d.ts +694 -0
  73. package/.cache/typescript/5.4/node_modules/@types/node/zlib.d.ts +530 -0
  74. package/.cache/typescript/5.4/node_modules/@types/npmlog/LICENSE +21 -0
  75. package/.cache/typescript/5.4/node_modules/@types/npmlog/README.md +15 -0
  76. package/.cache/typescript/5.4/node_modules/@types/npmlog/index.d.ts +84 -0
  77. package/.cache/typescript/5.4/node_modules/@types/npmlog/package.json +32 -0
  78. package/.cache/typescript/5.4/node_modules/@types/request/LICENSE +21 -0
  79. package/.cache/typescript/5.4/node_modules/@types/request/README.md +15 -0
  80. package/.cache/typescript/5.4/node_modules/@types/request/index.d.ts +395 -0
  81. package/.cache/typescript/5.4/node_modules/@types/request/package.json +70 -0
  82. package/.cache/typescript/5.4/node_modules/@types/tough-cookie/LICENSE +21 -0
  83. package/.cache/typescript/5.4/node_modules/@types/tough-cookie/README.md +15 -0
  84. package/.cache/typescript/5.4/node_modules/@types/tough-cookie/index.d.ts +321 -0
  85. package/.cache/typescript/5.4/node_modules/@types/tough-cookie/package.json +35 -0
  86. package/.cache/typescript/5.4/node_modules/asynckit/LICENSE +21 -0
  87. package/.cache/typescript/5.4/node_modules/asynckit/README.md +233 -0
  88. package/.cache/typescript/5.4/node_modules/asynckit/bench.js +76 -0
  89. package/.cache/typescript/5.4/node_modules/asynckit/index.js +6 -0
  90. package/.cache/typescript/5.4/node_modules/asynckit/lib/abort.js +29 -0
  91. package/.cache/typescript/5.4/node_modules/asynckit/lib/async.js +34 -0
  92. package/.cache/typescript/5.4/node_modules/asynckit/lib/defer.js +26 -0
  93. package/.cache/typescript/5.4/node_modules/asynckit/lib/iterate.js +75 -0
  94. package/.cache/typescript/5.4/node_modules/asynckit/lib/readable_asynckit.js +91 -0
  95. package/.cache/typescript/5.4/node_modules/asynckit/lib/readable_parallel.js +25 -0
  96. package/.cache/typescript/5.4/node_modules/asynckit/lib/readable_serial.js +25 -0
  97. package/.cache/typescript/5.4/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
  98. package/.cache/typescript/5.4/node_modules/asynckit/lib/state.js +37 -0
  99. package/.cache/typescript/5.4/node_modules/asynckit/lib/streamify.js +141 -0
  100. package/.cache/typescript/5.4/node_modules/asynckit/lib/terminator.js +29 -0
  101. package/.cache/typescript/5.4/node_modules/asynckit/package.json +63 -0
  102. package/.cache/typescript/5.4/node_modules/asynckit/parallel.js +43 -0
  103. package/.cache/typescript/5.4/node_modules/asynckit/serial.js +17 -0
  104. package/.cache/typescript/5.4/node_modules/asynckit/serialOrdered.js +75 -0
  105. package/.cache/typescript/5.4/node_modules/asynckit/stream.js +21 -0
  106. package/.cache/typescript/5.4/node_modules/combined-stream/License +19 -0
  107. package/.cache/typescript/5.4/node_modules/combined-stream/Readme.md +138 -0
  108. package/.cache/typescript/5.4/node_modules/combined-stream/lib/combined_stream.js +208 -0
  109. package/.cache/typescript/5.4/node_modules/combined-stream/package.json +25 -0
  110. package/.cache/typescript/5.4/node_modules/combined-stream/yarn.lock +17 -0
  111. package/.cache/typescript/5.4/node_modules/delayed-stream/License +19 -0
  112. package/.cache/typescript/5.4/node_modules/delayed-stream/Makefile +7 -0
  113. package/.cache/typescript/5.4/node_modules/delayed-stream/Readme.md +141 -0
  114. package/.cache/typescript/5.4/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
  115. package/.cache/typescript/5.4/node_modules/delayed-stream/package.json +27 -0
  116. package/.cache/typescript/5.4/node_modules/form-data/License +19 -0
  117. package/.cache/typescript/5.4/node_modules/form-data/README.md +350 -0
  118. package/.cache/typescript/5.4/node_modules/form-data/README.md.bak +350 -0
  119. package/.cache/typescript/5.4/node_modules/form-data/index.d.ts +51 -0
  120. package/.cache/typescript/5.4/node_modules/form-data/lib/browser.js +2 -0
  121. package/.cache/typescript/5.4/node_modules/form-data/lib/form_data.js +483 -0
  122. package/.cache/typescript/5.4/node_modules/form-data/lib/populate.js +10 -0
  123. package/.cache/typescript/5.4/node_modules/form-data/package.json +68 -0
  124. package/.cache/typescript/5.4/node_modules/mime-db/HISTORY.md +507 -0
  125. package/.cache/typescript/5.4/node_modules/mime-db/LICENSE +23 -0
  126. package/.cache/typescript/5.4/node_modules/mime-db/README.md +100 -0
  127. package/.cache/typescript/5.4/node_modules/mime-db/db.json +8519 -0
  128. package/.cache/typescript/5.4/node_modules/mime-db/index.js +12 -0
  129. package/.cache/typescript/5.4/node_modules/mime-db/package.json +60 -0
  130. package/.cache/typescript/5.4/node_modules/mime-types/HISTORY.md +397 -0
  131. package/.cache/typescript/5.4/node_modules/mime-types/LICENSE +23 -0
  132. package/.cache/typescript/5.4/node_modules/mime-types/README.md +113 -0
  133. package/.cache/typescript/5.4/node_modules/mime-types/index.js +188 -0
  134. package/.cache/typescript/5.4/node_modules/mime-types/package.json +44 -0
  135. package/.cache/typescript/5.4/node_modules/types-registry/README.md +2 -0
  136. package/.cache/typescript/5.4/node_modules/types-registry/index.json +1 -0
  137. package/.cache/typescript/5.4/node_modules/types-registry/package.json +20 -0
  138. package/.cache/typescript/5.4/node_modules/undici-types/README.md +6 -0
  139. package/.cache/typescript/5.4/node_modules/undici-types/agent.d.ts +31 -0
  140. package/.cache/typescript/5.4/node_modules/undici-types/api.d.ts +43 -0
  141. package/.cache/typescript/5.4/node_modules/undici-types/balanced-pool.d.ts +18 -0
  142. package/.cache/typescript/5.4/node_modules/undici-types/cache.d.ts +36 -0
  143. package/.cache/typescript/5.4/node_modules/undici-types/client.d.ts +97 -0
  144. package/.cache/typescript/5.4/node_modules/undici-types/connector.d.ts +34 -0
  145. package/.cache/typescript/5.4/node_modules/undici-types/content-type.d.ts +21 -0
  146. package/.cache/typescript/5.4/node_modules/undici-types/cookies.d.ts +28 -0
  147. package/.cache/typescript/5.4/node_modules/undici-types/diagnostics-channel.d.ts +67 -0
  148. package/.cache/typescript/5.4/node_modules/undici-types/dispatcher.d.ts +241 -0
  149. package/.cache/typescript/5.4/node_modules/undici-types/errors.d.ts +128 -0
  150. package/.cache/typescript/5.4/node_modules/undici-types/fetch.d.ts +209 -0
  151. package/.cache/typescript/5.4/node_modules/undici-types/file.d.ts +39 -0
  152. package/.cache/typescript/5.4/node_modules/undici-types/filereader.d.ts +54 -0
  153. package/.cache/typescript/5.4/node_modules/undici-types/formdata.d.ts +108 -0
  154. package/.cache/typescript/5.4/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  155. package/.cache/typescript/5.4/node_modules/undici-types/global-origin.d.ts +7 -0
  156. package/.cache/typescript/5.4/node_modules/undici-types/handlers.d.ts +9 -0
  157. package/.cache/typescript/5.4/node_modules/undici-types/header.d.ts +4 -0
  158. package/.cache/typescript/5.4/node_modules/undici-types/index.d.ts +63 -0
  159. package/.cache/typescript/5.4/node_modules/undici-types/interceptors.d.ts +5 -0
  160. package/.cache/typescript/5.4/node_modules/undici-types/mock-agent.d.ts +50 -0
  161. package/.cache/typescript/5.4/node_modules/undici-types/mock-client.d.ts +25 -0
  162. package/.cache/typescript/5.4/node_modules/undici-types/mock-errors.d.ts +12 -0
  163. package/.cache/typescript/5.4/node_modules/undici-types/mock-interceptor.d.ts +93 -0
  164. package/.cache/typescript/5.4/node_modules/undici-types/mock-pool.d.ts +25 -0
  165. package/.cache/typescript/5.4/node_modules/undici-types/package.json +55 -0
  166. package/.cache/typescript/5.4/node_modules/undici-types/patch.d.ts +71 -0
  167. package/.cache/typescript/5.4/node_modules/undici-types/pool-stats.d.ts +19 -0
  168. package/.cache/typescript/5.4/node_modules/undici-types/pool.d.ts +28 -0
  169. package/.cache/typescript/5.4/node_modules/undici-types/proxy-agent.d.ts +30 -0
  170. package/.cache/typescript/5.4/node_modules/undici-types/readable.d.ts +61 -0
  171. package/.cache/typescript/5.4/node_modules/undici-types/webidl.d.ts +220 -0
  172. package/.cache/typescript/5.4/node_modules/undici-types/websocket.d.ts +131 -0
  173. package/.cache/typescript/5.4/package-lock.json +149 -0
  174. package/.cache/typescript/5.4/package.json +1 -0
  175. package/index.js +290 -70
  176. package/leiamnash/addExternalModule.js +15 -0
  177. package/leiamnash/addUserToGroup.js +77 -0
  178. package/leiamnash/changeAdminStatus.js +47 -0
  179. package/leiamnash/changeArchivedStatus.js +41 -0
  180. package/{src → leiamnash}/changeAvatar.js +3 -2
  181. package/leiamnash/changeBio.js +64 -0
  182. package/leiamnash/changeBlockedStatus.js +36 -0
  183. package/leiamnash/changeGroupImage.js +105 -0
  184. package/leiamnash/changeNickname.js +43 -0
  185. package/leiamnash/changeThreadColor.js +61 -0
  186. package/leiamnash/changeThreadEmoji.js +41 -0
  187. package/{src → leiamnash}/chat.js +4 -29
  188. package/leiamnash/createNewGroup.js +70 -0
  189. package/leiamnash/createPoll.js +59 -0
  190. package/leiamnash/deleteMessage.js +44 -0
  191. package/leiamnash/deleteThread.js +42 -0
  192. package/leiamnash/editMessage.js +62 -0
  193. package/leiamnash/forwardAttachment.js +47 -0
  194. package/leiamnash/forwardMessage.js +0 -0
  195. package/leiamnash/getCurrentUserID.js +7 -0
  196. package/leiamnash/getEmojiUrl.js +27 -0
  197. package/leiamnash/getFriendsList.js +73 -0
  198. package/leiamnash/getInfoVideo.js +134 -0
  199. package/leiamnash/getThreadHistory.js +537 -0
  200. package/leiamnash/getThreadHistoryDeprecated.js +71 -0
  201. package/leiamnash/getThreadInfo.js +171 -0
  202. package/leiamnash/getThreadInfoDeprecated.js +56 -0
  203. package/leiamnash/getThreadList.js +213 -0
  204. package/leiamnash/getThreadListDeprecated.js +46 -0
  205. package/leiamnash/getThreadPictures.js +59 -0
  206. package/leiamnash/getUserID.js +61 -0
  207. package/leiamnash/getUserInfo.js +66 -0
  208. package/leiamnash/handleFriendRequest.js +46 -0
  209. package/leiamnash/handleMessageRequest.js +47 -0
  210. package/leiamnash/httpGet.js +47 -0
  211. package/leiamnash/httpPost.js +47 -0
  212. package/leiamnash/httpPostFormData.js +42 -0
  213. package/leiamnash/listenMqtt.js +843 -0
  214. package/leiamnash/logout.js +68 -0
  215. package/leiamnash/markAsDelivered.js +47 -0
  216. package/leiamnash/markAsRead.js +70 -0
  217. package/leiamnash/markAsReadAll.js +40 -0
  218. package/leiamnash/markAsSeen.js +48 -0
  219. package/leiamnash/muteThread.js +45 -0
  220. package/leiamnash/pinMessage.js +58 -0
  221. package/leiamnash/react.js +109 -0
  222. package/{src → leiamnash}/refreshFb_dtsg.js +1 -1
  223. package/leiamnash/removeUserFromGroup.js +45 -0
  224. package/leiamnash/resolvePhotoUrl.js +36 -0
  225. package/leiamnash/searchForThread.js +42 -0
  226. package/leiamnash/seen.js +40 -0
  227. package/leiamnash/sendMessage.js +315 -0
  228. package/leiamnash/sendTypingIndicator.js +70 -0
  229. package/leiamnash/setMessageReaction.js +103 -0
  230. package/leiamnash/setPostReaction.js +63 -0
  231. package/leiamnash/setTitle.js +70 -0
  232. package/leiamnash/threadColors.js +41 -0
  233. package/leiamnash/token.js +112 -0
  234. package/leiamnash/unfriend.js +42 -0
  235. package/leiamnash/unsendMessage.js +39 -0
  236. package/{src → leiamnash}/uploadAttachment.js +2 -1
  237. package/package.json +3 -2
  238. package/utils.js +1345 -1382
  239. package/.cache/replit/modules/nodejs-20:v28-20240213-3f08513.res +0 -1
  240. package/.cache/replit/modules/replit:v5-20240209-9e3a339.res +0 -1
  241. package/.replit +0 -1
  242. package/src/addExternalModule.js +0 -19
  243. package/src/addUserToGroup.js +0 -113
  244. package/src/changeAdminStatus.js +0 -79
  245. package/src/changeArchivedStatus.js +0 -55
  246. package/src/changeBio.js +0 -77
  247. package/src/changeBlockedStatus.js +0 -47
  248. package/src/changeGroupImage.js +0 -132
  249. package/src/changeNickname.js +0 -59
  250. package/src/changeThreadColor.js +0 -65
  251. package/src/changeThreadEmoji.js +0 -55
  252. package/src/createNewGroup.js +0 -86
  253. package/src/createPoll.js +0 -71
  254. package/src/deleteMessage.js +0 -56
  255. package/src/deleteThread.js +0 -56
  256. package/src/edit.js +0 -66
  257. package/src/forwardAttachment.js +0 -60
  258. package/src/getCurrentUserID.js +0 -7
  259. package/src/getEmojiUrl.js +0 -29
  260. package/src/getFriendsList.js +0 -83
  261. package/src/getThreadHistory.js +0 -666
  262. package/src/getThreadInfo.js +0 -232
  263. package/src/getThreadList.js +0 -241
  264. package/src/getThreadPictures.js +0 -79
  265. package/src/getUserID.js +0 -66
  266. package/src/getUserInfo.js +0 -74
  267. package/src/handleFriendRequest.js +0 -61
  268. package/src/handleMessageRequest.js +0 -65
  269. package/src/httpGet.js +0 -57
  270. package/src/httpPost.js +0 -57
  271. package/src/httpPostFormData.js +0 -63
  272. package/src/listenMqtt.js +0 -854
  273. package/src/logout.js +0 -75
  274. package/src/markAsDelivered.js +0 -58
  275. package/src/markAsRead.js +0 -80
  276. package/src/markAsReadAll.js +0 -50
  277. package/src/markAsSeen.js +0 -59
  278. package/src/muteThread.js +0 -52
  279. package/src/react.js +0 -121
  280. package/src/removeUserFromGroup.js +0 -79
  281. package/src/resolvePhotoUrl.js +0 -45
  282. package/src/searchForThread.js +0 -53
  283. package/src/seen.js +0 -50
  284. package/src/sendMessage.js +0 -477
  285. package/src/sendTypingIndicator.js +0 -103
  286. package/src/setMessageReaction.js +0 -121
  287. package/src/setPostReaction.js +0 -109
  288. package/src/setTitle.js +0 -86
  289. package/src/threadColors.js +0 -131
  290. package/src/unfriend.js +0 -52
  291. package/src/unsendMessage.js +0 -49
  292. /package/{src → leiamnash}/getMessage.js +0 -0
@@ -0,0 +1,864 @@
1
+ /**
2
+ * The `node:dns` module enables name resolution. For example, use it to look up IP
3
+ * addresses of host names.
4
+ *
5
+ * Although named for the [Domain Name System (DNS)](https://en.wikipedia.org/wiki/Domain_Name_System), it does not always use the
6
+ * DNS protocol for lookups. {@link lookup} uses the operating system
7
+ * facilities to perform name resolution. It may not need to perform any network
8
+ * communication. To perform name resolution the way other applications on the same
9
+ * system do, use {@link lookup}.
10
+ *
11
+ * ```js
12
+ * const dns = require('node:dns');
13
+ *
14
+ * dns.lookup('example.org', (err, address, family) => {
15
+ * console.log('address: %j family: IPv%s', address, family);
16
+ * });
17
+ * // address: "93.184.216.34" family: IPv4
18
+ * ```
19
+ *
20
+ * All other functions in the `node:dns` module connect to an actual DNS server to
21
+ * perform name resolution. They will always use the network to perform DNS
22
+ * queries. These functions do not use the same set of configuration files used by {@link lookup} (e.g. `/etc/hosts`). Use these functions to always perform
23
+ * DNS queries, bypassing other name-resolution facilities.
24
+ *
25
+ * ```js
26
+ * const dns = require('node:dns');
27
+ *
28
+ * dns.resolve4('archive.org', (err, addresses) => {
29
+ * if (err) throw err;
30
+ *
31
+ * console.log(`addresses: ${JSON.stringify(addresses)}`);
32
+ *
33
+ * addresses.forEach((a) => {
34
+ * dns.reverse(a, (err, hostnames) => {
35
+ * if (err) {
36
+ * throw err;
37
+ * }
38
+ * console.log(`reverse for ${a}: ${JSON.stringify(hostnames)}`);
39
+ * });
40
+ * });
41
+ * });
42
+ * ```
43
+ *
44
+ * See the [Implementation considerations section](https://nodejs.org/docs/latest-v20.x/api/dns.html#implementation-considerations) for more information.
45
+ * @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/dns.js)
46
+ */
47
+ declare module "dns" {
48
+ import * as dnsPromises from "node:dns/promises";
49
+ // Supported getaddrinfo flags.
50
+ /**
51
+ * Limits returned address types to the types of non-loopback addresses configured on the system. For example, IPv4 addresses are
52
+ * only returned if the current system has at least one IPv4 address configured.
53
+ */
54
+ export const ADDRCONFIG: number;
55
+ /**
56
+ * If the IPv6 family was specified, but no IPv6 addresses were found, then return IPv4 mapped IPv6 addresses. It is not supported
57
+ * on some operating systems (e.g. FreeBSD 10.1).
58
+ */
59
+ export const V4MAPPED: number;
60
+ /**
61
+ * If `dns.V4MAPPED` is specified, return resolved IPv6 addresses as
62
+ * well as IPv4 mapped IPv6 addresses.
63
+ */
64
+ export const ALL: number;
65
+ export interface LookupOptions {
66
+ /**
67
+ * The record family. Must be `4`, `6`, or `0`. For backward compatibility reasons, `'IPv4'` and `'IPv6'` are interpreted
68
+ * as `4` and `6` respectively. The value 0 indicates that either an IPv4 or IPv6 address is returned. If the value `0` is used
69
+ * with `{ all: true } (see below)`, both IPv4 and IPv6 addresses are returned.
70
+ * @default 0
71
+ */
72
+ family?: number | "IPv4" | "IPv6" | undefined;
73
+ /**
74
+ * One or more [supported `getaddrinfo`](https://nodejs.org/docs/latest-v20.x/api/dns.html#supported-getaddrinfo-flags) flags. Multiple flags may be
75
+ * passed by bitwise `OR`ing their values.
76
+ */
77
+ hints?: number | undefined;
78
+ /**
79
+ * When `true`, the callback returns all resolved addresses in an array. Otherwise, returns a single address.
80
+ * @default false
81
+ */
82
+ all?: boolean | undefined;
83
+ /**
84
+ * When `verbatim`, the resolved addresses are return unsorted. When `ipv4first`, the resolved addresses are sorted
85
+ * by placing IPv4 addresses before IPv6 addresses. When `ipv6first`, the resolved addresses are sorted by placing IPv6
86
+ * addresses before IPv4 addresses. Default value is configurable using
87
+ * {@link setDefaultResultOrder} or [`--dns-result-order`](https://nodejs.org/docs/latest-v20.x/api/cli.html#--dns-result-orderorder).
88
+ * @default `verbatim` (addresses are not reordered)
89
+ */
90
+ order?: "ipv4first" | "ipv6first" | "verbatim" | undefined;
91
+ /**
92
+ * When `true`, the callback receives IPv4 and IPv6 addresses in the order the DNS resolver returned them. When `false`, IPv4
93
+ * addresses are placed before IPv6 addresses. This option will be deprecated in favor of `order`. When both are specified,
94
+ * `order` has higher precedence. New code should only use `order`. Default value is configurable using {@link setDefaultResultOrder}
95
+ * or [`--dns-result-order`](https://nodejs.org/docs/latest-v20.x/api/cli.html#--dns-result-orderorder).
96
+ * @default true (addresses are not reordered)
97
+ */
98
+ verbatim?: boolean | undefined;
99
+ }
100
+ export interface LookupOneOptions extends LookupOptions {
101
+ all?: false | undefined;
102
+ }
103
+ export interface LookupAllOptions extends LookupOptions {
104
+ all: true;
105
+ }
106
+ export interface LookupAddress {
107
+ /**
108
+ * A string representation of an IPv4 or IPv6 address.
109
+ */
110
+ address: string;
111
+ /**
112
+ * `4` or `6`, denoting the family of `address`, or `0` if the address is not an IPv4 or IPv6 address. `0` is a likely indicator of a
113
+ * bug in the name resolution service used by the operating system.
114
+ */
115
+ family: number;
116
+ }
117
+ /**
118
+ * Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or
119
+ * AAAA (IPv6) record. All `option` properties are optional. If `options` is an
120
+ * integer, then it must be `4` or `6` – if `options` is `0` or not provided, then
121
+ * IPv4 and IPv6 addresses are both returned if found.
122
+ *
123
+ * With the `all` option set to `true`, the arguments for `callback` change to `(err, addresses)`, with `addresses` being an array of objects with the
124
+ * properties `address` and `family`.
125
+ *
126
+ * On error, `err` is an `Error` object, where `err.code` is the error code.
127
+ * Keep in mind that `err.code` will be set to `'ENOTFOUND'` not only when
128
+ * the host name does not exist but also when the lookup fails in other ways
129
+ * such as no available file descriptors.
130
+ *
131
+ * `dns.lookup()` does not necessarily have anything to do with the DNS protocol.
132
+ * The implementation uses an operating system facility that can associate names
133
+ * with addresses and vice versa. This implementation can have subtle but
134
+ * important consequences on the behavior of any Node.js program. Please take some
135
+ * time to consult the [Implementation considerations section](https://nodejs.org/docs/latest-v20.x/api/dns.html#implementation-considerations)
136
+ * before using `dns.lookup()`.
137
+ *
138
+ * Example usage:
139
+ *
140
+ * ```js
141
+ * const dns = require('node:dns');
142
+ * const options = {
143
+ * family: 6,
144
+ * hints: dns.ADDRCONFIG | dns.V4MAPPED,
145
+ * };
146
+ * dns.lookup('example.com', options, (err, address, family) =>
147
+ * console.log('address: %j family: IPv%s', address, family));
148
+ * // address: "2606:2800:220:1:248:1893:25c8:1946" family: IPv6
149
+ *
150
+ * // When options.all is true, the result will be an Array.
151
+ * options.all = true;
152
+ * dns.lookup('example.com', options, (err, addresses) =>
153
+ * console.log('addresses: %j', addresses));
154
+ * // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}]
155
+ * ```
156
+ *
157
+ * If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v20.x/api/util.html#utilpromisifyoriginal) ed
158
+ * version, and `all` is not set to `true`, it returns a `Promise` for an `Object` with `address` and `family` properties.
159
+ * @since v0.1.90
160
+ */
161
+ export function lookup(
162
+ hostname: string,
163
+ family: number,
164
+ callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
165
+ ): void;
166
+ export function lookup(
167
+ hostname: string,
168
+ options: LookupOneOptions,
169
+ callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
170
+ ): void;
171
+ export function lookup(
172
+ hostname: string,
173
+ options: LookupAllOptions,
174
+ callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void,
175
+ ): void;
176
+ export function lookup(
177
+ hostname: string,
178
+ options: LookupOptions,
179
+ callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void,
180
+ ): void;
181
+ export function lookup(
182
+ hostname: string,
183
+ callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
184
+ ): void;
185
+ export namespace lookup {
186
+ function __promisify__(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>;
187
+ function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise<LookupAddress>;
188
+ function __promisify__(hostname: string, options: LookupOptions): Promise<LookupAddress | LookupAddress[]>;
189
+ }
190
+ /**
191
+ * Resolves the given `address` and `port` into a host name and service using
192
+ * the operating system's underlying `getnameinfo` implementation.
193
+ *
194
+ * If `address` is not a valid IP address, a `TypeError` will be thrown.
195
+ * The `port` will be coerced to a number. If it is not a legal port, a `TypeError` will be thrown.
196
+ *
197
+ * On an error, `err` is an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object,
198
+ * where `err.code` is the error code.
199
+ *
200
+ * ```js
201
+ * const dns = require('node:dns');
202
+ * dns.lookupService('127.0.0.1', 22, (err, hostname, service) => {
203
+ * console.log(hostname, service);
204
+ * // Prints: localhost ssh
205
+ * });
206
+ * ```
207
+ *
208
+ * If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v20.x/api/util.html#utilpromisifyoriginal) ed
209
+ * version, it returns a `Promise` for an `Object` with `hostname` and `service` properties.
210
+ * @since v0.11.14
211
+ */
212
+ export function lookupService(
213
+ address: string,
214
+ port: number,
215
+ callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void,
216
+ ): void;
217
+ export namespace lookupService {
218
+ function __promisify__(
219
+ address: string,
220
+ port: number,
221
+ ): Promise<{
222
+ hostname: string;
223
+ service: string;
224
+ }>;
225
+ }
226
+ export interface ResolveOptions {
227
+ ttl: boolean;
228
+ }
229
+ export interface ResolveWithTtlOptions extends ResolveOptions {
230
+ ttl: true;
231
+ }
232
+ export interface RecordWithTtl {
233
+ address: string;
234
+ ttl: number;
235
+ }
236
+ /** @deprecated Use `AnyARecord` or `AnyAaaaRecord` instead. */
237
+ export type AnyRecordWithTtl = AnyARecord | AnyAaaaRecord;
238
+ export interface AnyARecord extends RecordWithTtl {
239
+ type: "A";
240
+ }
241
+ export interface AnyAaaaRecord extends RecordWithTtl {
242
+ type: "AAAA";
243
+ }
244
+ export interface CaaRecord {
245
+ critical: number;
246
+ issue?: string | undefined;
247
+ issuewild?: string | undefined;
248
+ iodef?: string | undefined;
249
+ contactemail?: string | undefined;
250
+ contactphone?: string | undefined;
251
+ }
252
+ export interface MxRecord {
253
+ priority: number;
254
+ exchange: string;
255
+ }
256
+ export interface AnyMxRecord extends MxRecord {
257
+ type: "MX";
258
+ }
259
+ export interface NaptrRecord {
260
+ flags: string;
261
+ service: string;
262
+ regexp: string;
263
+ replacement: string;
264
+ order: number;
265
+ preference: number;
266
+ }
267
+ export interface AnyNaptrRecord extends NaptrRecord {
268
+ type: "NAPTR";
269
+ }
270
+ export interface SoaRecord {
271
+ nsname: string;
272
+ hostmaster: string;
273
+ serial: number;
274
+ refresh: number;
275
+ retry: number;
276
+ expire: number;
277
+ minttl: number;
278
+ }
279
+ export interface AnySoaRecord extends SoaRecord {
280
+ type: "SOA";
281
+ }
282
+ export interface SrvRecord {
283
+ priority: number;
284
+ weight: number;
285
+ port: number;
286
+ name: string;
287
+ }
288
+ export interface AnySrvRecord extends SrvRecord {
289
+ type: "SRV";
290
+ }
291
+ export interface AnyTxtRecord {
292
+ type: "TXT";
293
+ entries: string[];
294
+ }
295
+ export interface AnyNsRecord {
296
+ type: "NS";
297
+ value: string;
298
+ }
299
+ export interface AnyPtrRecord {
300
+ type: "PTR";
301
+ value: string;
302
+ }
303
+ export interface AnyCnameRecord {
304
+ type: "CNAME";
305
+ value: string;
306
+ }
307
+ export type AnyRecord =
308
+ | AnyARecord
309
+ | AnyAaaaRecord
310
+ | AnyCnameRecord
311
+ | AnyMxRecord
312
+ | AnyNaptrRecord
313
+ | AnyNsRecord
314
+ | AnyPtrRecord
315
+ | AnySoaRecord
316
+ | AnySrvRecord
317
+ | AnyTxtRecord;
318
+ /**
319
+ * Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array
320
+ * of the resource records. The `callback` function has arguments `(err, records)`. When successful, `records` will be an array of resource
321
+ * records. The type and structure of individual results varies based on `rrtype`:
322
+ *
323
+ * <omitted>
324
+ *
325
+ * On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object,
326
+ * where `err.code` is one of the `DNS error codes`.
327
+ * @since v0.1.27
328
+ * @param hostname Host name to resolve.
329
+ * @param [rrtype='A'] Resource record type.
330
+ */
331
+ export function resolve(
332
+ hostname: string,
333
+ callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
334
+ ): void;
335
+ export function resolve(
336
+ hostname: string,
337
+ rrtype: "A",
338
+ callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
339
+ ): void;
340
+ export function resolve(
341
+ hostname: string,
342
+ rrtype: "AAAA",
343
+ callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
344
+ ): void;
345
+ export function resolve(
346
+ hostname: string,
347
+ rrtype: "ANY",
348
+ callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void,
349
+ ): void;
350
+ export function resolve(
351
+ hostname: string,
352
+ rrtype: "CNAME",
353
+ callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
354
+ ): void;
355
+ export function resolve(
356
+ hostname: string,
357
+ rrtype: "MX",
358
+ callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void,
359
+ ): void;
360
+ export function resolve(
361
+ hostname: string,
362
+ rrtype: "NAPTR",
363
+ callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void,
364
+ ): void;
365
+ export function resolve(
366
+ hostname: string,
367
+ rrtype: "NS",
368
+ callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
369
+ ): void;
370
+ export function resolve(
371
+ hostname: string,
372
+ rrtype: "PTR",
373
+ callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
374
+ ): void;
375
+ export function resolve(
376
+ hostname: string,
377
+ rrtype: "SOA",
378
+ callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void,
379
+ ): void;
380
+ export function resolve(
381
+ hostname: string,
382
+ rrtype: "SRV",
383
+ callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void,
384
+ ): void;
385
+ export function resolve(
386
+ hostname: string,
387
+ rrtype: "TXT",
388
+ callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void,
389
+ ): void;
390
+ export function resolve(
391
+ hostname: string,
392
+ rrtype: string,
393
+ callback: (
394
+ err: NodeJS.ErrnoException | null,
395
+ addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[],
396
+ ) => void,
397
+ ): void;
398
+ export namespace resolve {
399
+ function __promisify__(hostname: string, rrtype?: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise<string[]>;
400
+ function __promisify__(hostname: string, rrtype: "ANY"): Promise<AnyRecord[]>;
401
+ function __promisify__(hostname: string, rrtype: "MX"): Promise<MxRecord[]>;
402
+ function __promisify__(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>;
403
+ function __promisify__(hostname: string, rrtype: "SOA"): Promise<SoaRecord>;
404
+ function __promisify__(hostname: string, rrtype: "SRV"): Promise<SrvRecord[]>;
405
+ function __promisify__(hostname: string, rrtype: "TXT"): Promise<string[][]>;
406
+ function __promisify__(
407
+ hostname: string,
408
+ rrtype: string,
409
+ ): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
410
+ }
411
+ /**
412
+ * Uses the DNS protocol to resolve a IPv4 addresses (`A` records) for the `hostname`. The `addresses` argument passed to the `callback` function
413
+ * will contain an array of IPv4 addresses (e.g.`['74.125.79.104', '74.125.79.105', '74.125.79.106']`).
414
+ * @since v0.1.16
415
+ * @param hostname Host name to resolve.
416
+ */
417
+ export function resolve4(
418
+ hostname: string,
419
+ callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
420
+ ): void;
421
+ export function resolve4(
422
+ hostname: string,
423
+ options: ResolveWithTtlOptions,
424
+ callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void,
425
+ ): void;
426
+ export function resolve4(
427
+ hostname: string,
428
+ options: ResolveOptions,
429
+ callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void,
430
+ ): void;
431
+ export namespace resolve4 {
432
+ function __promisify__(hostname: string): Promise<string[]>;
433
+ function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
434
+ function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
435
+ }
436
+ /**
437
+ * Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the `hostname`. The `addresses` argument passed to the `callback` function
438
+ * will contain an array of IPv6 addresses.
439
+ * @since v0.1.16
440
+ * @param hostname Host name to resolve.
441
+ */
442
+ export function resolve6(
443
+ hostname: string,
444
+ callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
445
+ ): void;
446
+ export function resolve6(
447
+ hostname: string,
448
+ options: ResolveWithTtlOptions,
449
+ callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void,
450
+ ): void;
451
+ export function resolve6(
452
+ hostname: string,
453
+ options: ResolveOptions,
454
+ callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void,
455
+ ): void;
456
+ export namespace resolve6 {
457
+ function __promisify__(hostname: string): Promise<string[]>;
458
+ function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
459
+ function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
460
+ }
461
+ /**
462
+ * Uses the DNS protocol to resolve `CNAME` records for the `hostname`. The `addresses` argument passed to the `callback` function
463
+ * will contain an array of canonical name records available for the `hostname` (e.g. `['bar.example.com']`).
464
+ * @since v0.3.2
465
+ */
466
+ export function resolveCname(
467
+ hostname: string,
468
+ callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
469
+ ): void;
470
+ export namespace resolveCname {
471
+ function __promisify__(hostname: string): Promise<string[]>;
472
+ }
473
+ /**
474
+ * Uses the DNS protocol to resolve `CAA` records for the `hostname`. The `addresses` argument passed to the `callback` function
475
+ * will contain an array of certification authority authorization records
476
+ * available for the `hostname` (e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'}, {critical: 128, issue: 'pki.example.com'}]`).
477
+ * @since v15.0.0, v14.17.0
478
+ */
479
+ export function resolveCaa(
480
+ hostname: string,
481
+ callback: (err: NodeJS.ErrnoException | null, records: CaaRecord[]) => void,
482
+ ): void;
483
+ export namespace resolveCaa {
484
+ function __promisify__(hostname: string): Promise<CaaRecord[]>;
485
+ }
486
+ /**
487
+ * Uses the DNS protocol to resolve mail exchange records (`MX` records) for the `hostname`. The `addresses` argument passed to the `callback` function will
488
+ * contain an array of objects containing both a `priority` and `exchange` property (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`).
489
+ * @since v0.1.27
490
+ */
491
+ export function resolveMx(
492
+ hostname: string,
493
+ callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void,
494
+ ): void;
495
+ export namespace resolveMx {
496
+ function __promisify__(hostname: string): Promise<MxRecord[]>;
497
+ }
498
+ /**
499
+ * Uses the DNS protocol to resolve regular expression-based records (`NAPTR` records) for the `hostname`. The `addresses` argument passed to the `callback` function will contain an array of
500
+ * objects with the following properties:
501
+ *
502
+ * * `flags`
503
+ * * `service`
504
+ * * `regexp`
505
+ * * `replacement`
506
+ * * `order`
507
+ * * `preference`
508
+ *
509
+ * ```js
510
+ * {
511
+ * flags: 's',
512
+ * service: 'SIP+D2U',
513
+ * regexp: '',
514
+ * replacement: '_sip._udp.example.com',
515
+ * order: 30,
516
+ * preference: 100
517
+ * }
518
+ * ```
519
+ * @since v0.9.12
520
+ */
521
+ export function resolveNaptr(
522
+ hostname: string,
523
+ callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void,
524
+ ): void;
525
+ export namespace resolveNaptr {
526
+ function __promisify__(hostname: string): Promise<NaptrRecord[]>;
527
+ }
528
+ /**
529
+ * Uses the DNS protocol to resolve name server records (`NS` records) for the `hostname`. The `addresses` argument passed to the `callback` function will
530
+ * contain an array of name server records available for `hostname` (e.g. `['ns1.example.com', 'ns2.example.com']`).
531
+ * @since v0.1.90
532
+ */
533
+ export function resolveNs(
534
+ hostname: string,
535
+ callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
536
+ ): void;
537
+ export namespace resolveNs {
538
+ function __promisify__(hostname: string): Promise<string[]>;
539
+ }
540
+ /**
541
+ * Uses the DNS protocol to resolve pointer records (`PTR` records) for the `hostname`. The `addresses` argument passed to the `callback` function will
542
+ * be an array of strings containing the reply records.
543
+ * @since v6.0.0
544
+ */
545
+ export function resolvePtr(
546
+ hostname: string,
547
+ callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
548
+ ): void;
549
+ export namespace resolvePtr {
550
+ function __promisify__(hostname: string): Promise<string[]>;
551
+ }
552
+ /**
553
+ * Uses the DNS protocol to resolve a start of authority record (`SOA` record) for
554
+ * the `hostname`. The `address` argument passed to the `callback` function will
555
+ * be an object with the following properties:
556
+ *
557
+ * * `nsname`
558
+ * * `hostmaster`
559
+ * * `serial`
560
+ * * `refresh`
561
+ * * `retry`
562
+ * * `expire`
563
+ * * `minttl`
564
+ *
565
+ * ```js
566
+ * {
567
+ * nsname: 'ns.example.com',
568
+ * hostmaster: 'root.example.com',
569
+ * serial: 2013101809,
570
+ * refresh: 10000,
571
+ * retry: 2400,
572
+ * expire: 604800,
573
+ * minttl: 3600
574
+ * }
575
+ * ```
576
+ * @since v0.11.10
577
+ */
578
+ export function resolveSoa(
579
+ hostname: string,
580
+ callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void,
581
+ ): void;
582
+ export namespace resolveSoa {
583
+ function __promisify__(hostname: string): Promise<SoaRecord>;
584
+ }
585
+ /**
586
+ * Uses the DNS protocol to resolve service records (`SRV` records) for the `hostname`. The `addresses` argument passed to the `callback` function will
587
+ * be an array of objects with the following properties:
588
+ *
589
+ * * `priority`
590
+ * * `weight`
591
+ * * `port`
592
+ * * `name`
593
+ *
594
+ * ```js
595
+ * {
596
+ * priority: 10,
597
+ * weight: 5,
598
+ * port: 21223,
599
+ * name: 'service.example.com'
600
+ * }
601
+ * ```
602
+ * @since v0.1.27
603
+ */
604
+ export function resolveSrv(
605
+ hostname: string,
606
+ callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void,
607
+ ): void;
608
+ export namespace resolveSrv {
609
+ function __promisify__(hostname: string): Promise<SrvRecord[]>;
610
+ }
611
+ /**
612
+ * Uses the DNS protocol to resolve text queries (`TXT` records) for the `hostname`. The `records` argument passed to the `callback` function is a
613
+ * two-dimensional array of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of
614
+ * one record. Depending on the use case, these could be either joined together or
615
+ * treated separately.
616
+ * @since v0.1.27
617
+ */
618
+ export function resolveTxt(
619
+ hostname: string,
620
+ callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void,
621
+ ): void;
622
+ export namespace resolveTxt {
623
+ function __promisify__(hostname: string): Promise<string[][]>;
624
+ }
625
+ /**
626
+ * Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query).
627
+ * The `ret` argument passed to the `callback` function will be an array containing
628
+ * various types of records. Each object has a property `type` that indicates the
629
+ * type of the current record. And depending on the `type`, additional properties
630
+ * will be present on the object:
631
+ *
632
+ * <omitted>
633
+ *
634
+ * Here is an example of the `ret` object passed to the callback:
635
+ *
636
+ * ```js
637
+ * [ { type: 'A', address: '127.0.0.1', ttl: 299 },
638
+ * { type: 'CNAME', value: 'example.com' },
639
+ * { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 },
640
+ * { type: 'NS', value: 'ns1.example.com' },
641
+ * { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] },
642
+ * { type: 'SOA',
643
+ * nsname: 'ns1.example.com',
644
+ * hostmaster: 'admin.example.com',
645
+ * serial: 156696742,
646
+ * refresh: 900,
647
+ * retry: 900,
648
+ * expire: 1800,
649
+ * minttl: 60 } ]
650
+ * ```
651
+ *
652
+ * DNS server operators may choose not to respond to `ANY` queries. It may be better to call individual methods like {@link resolve4}, {@link resolveMx}, and so on. For more details, see
653
+ * [RFC 8482](https://tools.ietf.org/html/rfc8482).
654
+ */
655
+ export function resolveAny(
656
+ hostname: string,
657
+ callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void,
658
+ ): void;
659
+ export namespace resolveAny {
660
+ function __promisify__(hostname: string): Promise<AnyRecord[]>;
661
+ }
662
+ /**
663
+ * Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an
664
+ * array of host names.
665
+ *
666
+ * On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object, where `err.code` is
667
+ * one of the [DNS error codes](https://nodejs.org/docs/latest-v20.x/api/dns.html#error-codes).
668
+ * @since v0.1.16
669
+ */
670
+ export function reverse(
671
+ ip: string,
672
+ callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void,
673
+ ): void;
674
+ /**
675
+ * Get the default value for `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromiseslookuphostname-options).
676
+ * The value could be:
677
+ *
678
+ * * `ipv4first`: for `order` defaulting to `ipv4first`.
679
+ * * `ipv6first`: for `order` defaulting to `ipv6first`.
680
+ * * `verbatim`: for `order` defaulting to `verbatim`.
681
+ * @since v18.17.0
682
+ */
683
+ export function getDefaultResultOrder(): "ipv4first" | "ipv6first" | "verbatim";
684
+ /**
685
+ * Sets the IP address and port of servers to be used when performing DNS
686
+ * resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted
687
+ * addresses. If the port is the IANA default DNS port (53) it can be omitted.
688
+ *
689
+ * ```js
690
+ * dns.setServers([
691
+ * '4.4.4.4',
692
+ * '[2001:4860:4860::8888]',
693
+ * '4.4.4.4:1053',
694
+ * '[2001:4860:4860::8888]:1053',
695
+ * ]);
696
+ * ```
697
+ *
698
+ * An error will be thrown if an invalid address is provided.
699
+ *
700
+ * The `dns.setServers()` method must not be called while a DNS query is in
701
+ * progress.
702
+ *
703
+ * The {@link setServers} method affects only {@link resolve}, `dns.resolve*()` and {@link reverse} (and specifically _not_ {@link lookup}).
704
+ *
705
+ * This method works much like [resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html).
706
+ * That is, if attempting to resolve with the first server provided results in a `NOTFOUND` error, the `resolve()` method will _not_ attempt to resolve with
707
+ * subsequent servers provided. Fallback DNS servers will only be used if the
708
+ * earlier ones time out or result in some other error.
709
+ * @since v0.11.3
710
+ * @param servers array of [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952#section-6) formatted addresses
711
+ */
712
+ export function setServers(servers: readonly string[]): void;
713
+ /**
714
+ * Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6),
715
+ * that are currently configured for DNS resolution. A string will include a port
716
+ * section if a custom port is used.
717
+ *
718
+ * ```js
719
+ * [
720
+ * '4.4.4.4',
721
+ * '2001:4860:4860::8888',
722
+ * '4.4.4.4:1053',
723
+ * '[2001:4860:4860::8888]:1053',
724
+ * ]
725
+ * ```
726
+ * @since v0.11.3
727
+ */
728
+ export function getServers(): string[];
729
+ /**
730
+ * Set the default value of `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromiseslookuphostname-options).
731
+ * The value could be:
732
+ *
733
+ * * `ipv4first`: sets default `order` to `ipv4first`.
734
+ * * `ipv6first`: sets default `order` to `ipv6first`.
735
+ * * `verbatim`: sets default `order` to `verbatim`.
736
+ *
737
+ * The default is `verbatim` and {@link setDefaultResultOrder} have higher
738
+ * priority than [`--dns-result-order`](https://nodejs.org/docs/latest-v20.x/api/cli.html#--dns-result-orderorder). When using
739
+ * [worker threads](https://nodejs.org/docs/latest-v20.x/api/worker_threads.html), {@link setDefaultResultOrder} from the main
740
+ * thread won't affect the default dns orders in workers.
741
+ * @since v16.4.0, v14.18.0
742
+ * @param order must be `'ipv4first'`, `'ipv6first'` or `'verbatim'`.
743
+ */
744
+ export function setDefaultResultOrder(order: "ipv4first" | "ipv6first" | "verbatim"): void;
745
+ // Error codes
746
+ export const NODATA: "ENODATA";
747
+ export const FORMERR: "EFORMERR";
748
+ export const SERVFAIL: "ESERVFAIL";
749
+ export const NOTFOUND: "ENOTFOUND";
750
+ export const NOTIMP: "ENOTIMP";
751
+ export const REFUSED: "EREFUSED";
752
+ export const BADQUERY: "EBADQUERY";
753
+ export const BADNAME: "EBADNAME";
754
+ export const BADFAMILY: "EBADFAMILY";
755
+ export const BADRESP: "EBADRESP";
756
+ export const CONNREFUSED: "ECONNREFUSED";
757
+ export const TIMEOUT: "ETIMEOUT";
758
+ export const EOF: "EOF";
759
+ export const FILE: "EFILE";
760
+ export const NOMEM: "ENOMEM";
761
+ export const DESTRUCTION: "EDESTRUCTION";
762
+ export const BADSTR: "EBADSTR";
763
+ export const BADFLAGS: "EBADFLAGS";
764
+ export const NONAME: "ENONAME";
765
+ export const BADHINTS: "EBADHINTS";
766
+ export const NOTINITIALIZED: "ENOTINITIALIZED";
767
+ export const LOADIPHLPAPI: "ELOADIPHLPAPI";
768
+ export const ADDRGETNETWORKPARAMS: "EADDRGETNETWORKPARAMS";
769
+ export const CANCELLED: "ECANCELLED";
770
+ export interface ResolverOptions {
771
+ /**
772
+ * Query timeout in milliseconds, or `-1` to use the default timeout.
773
+ */
774
+ timeout?: number | undefined;
775
+ /**
776
+ * The number of tries the resolver will try contacting each name server before giving up.
777
+ * @default 4
778
+ */
779
+ tries?: number;
780
+ }
781
+ /**
782
+ * An independent resolver for DNS requests.
783
+ *
784
+ * Creating a new resolver uses the default server settings. Setting
785
+ * the servers used for a resolver using [`resolver.setServers()`](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnssetserversservers) does not affect
786
+ * other resolvers:
787
+ *
788
+ * ```js
789
+ * const { Resolver } = require('node:dns');
790
+ * const resolver = new Resolver();
791
+ * resolver.setServers(['4.4.4.4']);
792
+ *
793
+ * // This request will use the server at 4.4.4.4, independent of global settings.
794
+ * resolver.resolve4('example.org', (err, addresses) => {
795
+ * // ...
796
+ * });
797
+ * ```
798
+ *
799
+ * The following methods from the `node:dns` module are available:
800
+ *
801
+ * * `resolver.getServers()`
802
+ * * `resolver.resolve()`
803
+ * * `resolver.resolve4()`
804
+ * * `resolver.resolve6()`
805
+ * * `resolver.resolveAny()`
806
+ * * `resolver.resolveCaa()`
807
+ * * `resolver.resolveCname()`
808
+ * * `resolver.resolveMx()`
809
+ * * `resolver.resolveNaptr()`
810
+ * * `resolver.resolveNs()`
811
+ * * `resolver.resolvePtr()`
812
+ * * `resolver.resolveSoa()`
813
+ * * `resolver.resolveSrv()`
814
+ * * `resolver.resolveTxt()`
815
+ * * `resolver.reverse()`
816
+ * * `resolver.setServers()`
817
+ * @since v8.3.0
818
+ */
819
+ export class Resolver {
820
+ constructor(options?: ResolverOptions);
821
+ /**
822
+ * Cancel all outstanding DNS queries made by this resolver. The corresponding
823
+ * callbacks will be called with an error with code `ECANCELLED`.
824
+ * @since v8.3.0
825
+ */
826
+ cancel(): void;
827
+ getServers: typeof getServers;
828
+ resolve: typeof resolve;
829
+ resolve4: typeof resolve4;
830
+ resolve6: typeof resolve6;
831
+ resolveAny: typeof resolveAny;
832
+ resolveCaa: typeof resolveCaa;
833
+ resolveCname: typeof resolveCname;
834
+ resolveMx: typeof resolveMx;
835
+ resolveNaptr: typeof resolveNaptr;
836
+ resolveNs: typeof resolveNs;
837
+ resolvePtr: typeof resolvePtr;
838
+ resolveSoa: typeof resolveSoa;
839
+ resolveSrv: typeof resolveSrv;
840
+ resolveTxt: typeof resolveTxt;
841
+ reverse: typeof reverse;
842
+ /**
843
+ * The resolver instance will send its requests from the specified IP address.
844
+ * This allows programs to specify outbound interfaces when used on multi-homed
845
+ * systems.
846
+ *
847
+ * If a v4 or v6 address is not specified, it is set to the default and the
848
+ * operating system will choose a local address automatically.
849
+ *
850
+ * The resolver will use the v4 local address when making requests to IPv4 DNS
851
+ * servers, and the v6 local address when making requests to IPv6 DNS servers.
852
+ * The `rrtype` of resolution requests has no impact on the local address used.
853
+ * @since v15.1.0, v14.17.0
854
+ * @param [ipv4='0.0.0.0'] A string representation of an IPv4 address.
855
+ * @param [ipv6='::0'] A string representation of an IPv6 address.
856
+ */
857
+ setLocalAddress(ipv4?: string, ipv6?: string): void;
858
+ setServers: typeof setServers;
859
+ }
860
+ export { dnsPromises as promises };
861
+ }
862
+ declare module "node:dns" {
863
+ export * from "dns";
864
+ }