domain-alive 0.1.11 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -29,7 +29,9 @@ function getDnsClients(servers) {
29
29
  const port = _port ? Number.parseInt(_port, 10) : 0;
30
30
  let client;
31
31
  switch(protocol){
32
+ // case 'http':
32
33
  case 'https':
34
+ case 'h2':
33
35
  {
34
36
  const u = new URL(dns);
35
37
  if (!server.includes('/')) {
@@ -1320,6 +1322,7 @@ const sharedNullResponse = Object.freeze({
1320
1322
  factor: retryFactor
1321
1323
  };
1322
1324
  const mutex = createAsyncMutex();
1325
+ const dnsClients = getDnsClients(dnsServers);
1323
1326
  return async function isRegisterableDomainAlive(domain) {
1324
1327
  domain = url.domainToASCII(domain);
1325
1328
  return mutex(domain, ()=>cacheApply(registerableDomainResultCache, domain, async ()=>{
@@ -1350,9 +1353,9 @@ tencentcloud.com. 86400 IN SOA ns-tel1.qq.com. webmaster.qq.com. 165111089
1350
1353
  ;; WHEN: Fri Aug 22 00:26:29 CST 2025
1351
1354
  ;; MSG SIZE rcvd: 468
1352
1355
  */ // dns servers get shuffled every time called
1353
- const shuffledDnsClients = getDnsClients(shuffleArray.shuffleArray(dnsServers, {
1356
+ const shuffledDnsClients = shuffleArray.shuffleArray(dnsClients, {
1354
1357
  copy: true
1355
- }));
1358
+ });
1356
1359
  let attempts = 0;
1357
1360
  let confirmations = 0;
1358
1361
  while(attempts < maxAttempts){
@@ -1425,6 +1428,7 @@ function createDomainAliveChecker(options = {}) {
1425
1428
  factor: retryFactor
1426
1429
  };
1427
1430
  const mutex = createAsyncMutex();
1431
+ const dnsClients = getDnsClients(dnsServers);
1428
1432
  return async function isDomainAlive(domain) {
1429
1433
  domain = url.domainToASCII(domain);
1430
1434
  const registerableDomainAliveResult = await isRegisterableDomainAlive(domain);
@@ -1448,9 +1452,9 @@ function createDomainAliveChecker(options = {}) {
1448
1452
  }
1449
1453
  return mutex(domain, ()=>cacheApply(resultCache, domain, async ()=>{
1450
1454
  // shuffle every time is called
1451
- const shuffledDnsClients = getDnsClients(shuffleArray.shuffleArray(dnsServers, {
1455
+ const shuffledDnsClients = shuffleArray.shuffleArray(dnsClients, {
1452
1456
  copy: true
1453
- }));
1457
+ });
1454
1458
  {
1455
1459
  // IPv4
1456
1460
  let attempts = 0;
package/dist/index.mjs CHANGED
@@ -22,7 +22,9 @@ function getDnsClients(servers) {
22
22
  const port = _port ? Number.parseInt(_port, 10) : 0;
23
23
  let client;
24
24
  switch(protocol){
25
+ // case 'http':
25
26
  case 'https':
27
+ case 'h2':
26
28
  {
27
29
  const u = new URL(dns);
28
30
  if (!server.includes('/')) {
@@ -1313,6 +1315,7 @@ const sharedNullResponse = Object.freeze({
1313
1315
  factor: retryFactor
1314
1316
  };
1315
1317
  const mutex = createAsyncMutex();
1318
+ const dnsClients = getDnsClients(dnsServers);
1316
1319
  return async function isRegisterableDomainAlive(domain) {
1317
1320
  domain = domainToASCII(domain);
1318
1321
  return mutex(domain, ()=>cacheApply(registerableDomainResultCache, domain, async ()=>{
@@ -1343,9 +1346,9 @@ tencentcloud.com. 86400 IN SOA ns-tel1.qq.com. webmaster.qq.com. 165111089
1343
1346
  ;; WHEN: Fri Aug 22 00:26:29 CST 2025
1344
1347
  ;; MSG SIZE rcvd: 468
1345
1348
  */ // dns servers get shuffled every time called
1346
- const shuffledDnsClients = getDnsClients(shuffleArray(dnsServers, {
1349
+ const shuffledDnsClients = shuffleArray(dnsClients, {
1347
1350
  copy: true
1348
- }));
1351
+ });
1349
1352
  let attempts = 0;
1350
1353
  let confirmations = 0;
1351
1354
  while(attempts < maxAttempts){
@@ -1418,6 +1421,7 @@ function createDomainAliveChecker(options = {}) {
1418
1421
  factor: retryFactor
1419
1422
  };
1420
1423
  const mutex = createAsyncMutex();
1424
+ const dnsClients = getDnsClients(dnsServers);
1421
1425
  return async function isDomainAlive(domain) {
1422
1426
  domain = domainToASCII(domain);
1423
1427
  const registerableDomainAliveResult = await isRegisterableDomainAlive(domain);
@@ -1441,9 +1445,9 @@ function createDomainAliveChecker(options = {}) {
1441
1445
  }
1442
1446
  return mutex(domain, ()=>cacheApply(resultCache, domain, async ()=>{
1443
1447
  // shuffle every time is called
1444
- const shuffledDnsClients = getDnsClients(shuffleArray(dnsServers, {
1448
+ const shuffledDnsClients = shuffleArray(dnsClients, {
1445
1449
  copy: true
1446
- }));
1450
+ });
1447
1451
  {
1448
1452
  // IPv4
1449
1453
  let attempts = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "domain-alive",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "A Node.js library for checking if an FQDN (Fully Qualified Domain Name) is alive or not, uses a combination techniques of `NS` records, WHOIS/RDAP lookups, `A/AAAA` records",
5
5
  "repository": {
6
6
  "type": "git",
@@ -32,20 +32,20 @@
32
32
  "dependencies": {
33
33
  "debug": "4.4.1",
34
34
  "dns2": "github:lsongdev/node-dns#3adb7e91b3101c0e4f43ebaca3a568269ea04d11",
35
- "foxts": "^5.0.0",
36
- "tldts": "^7.0.17"
35
+ "foxts": "^5.0.4",
36
+ "tldts": "^7.0.19"
37
37
  },
38
38
  "devDependencies": {
39
- "@eslint-sukka/node": "^8.0.2",
39
+ "@eslint-sukka/node": "^8.0.6",
40
40
  "@swc-node/register": "^1.11.1",
41
41
  "@types/debug": "^4.1.12",
42
42
  "@types/dns2": "^2.0.10",
43
- "@types/node": "^24.10.0",
44
- "bumpp": "^10.3.1",
45
- "bunchee": "^6.6.2",
46
- "eslint": "^9.39.1",
47
- "eslint-config-sukka": "^8.0.2",
48
- "eslint-formatter-sukka": "^8.0.2",
43
+ "@types/node": "^24.10.4",
44
+ "bumpp": "^10.3.2",
45
+ "bunchee": "^6.9.3",
46
+ "eslint": "^9.39.2",
47
+ "eslint-config-sukka": "^8.0.6",
48
+ "eslint-formatter-sukka": "^8.0.6",
49
49
  "typescript": "^5.9.3",
50
50
  "whoiser": "2.0.0-beta.8"
51
51
  },