domain-alive 0.1.10 → 0.1.12

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.
Files changed (3) hide show
  1. package/dist/index.js +14 -18
  2. package/dist/index.mjs +14 -18
  3. package/package.json +10 -10
package/dist/index.js CHANGED
@@ -1181,7 +1181,8 @@ const whoiserNoWhoisSymbol = Symbol('"whoiser" library returns "No WHOIS data fo
1181
1181
  throw error;
1182
1182
  }), retryOption);
1183
1183
  } catch (e) {
1184
- errorLog$1('[whois] %s %O', registerableDomain, e);
1184
+ const errorMessage = extractErrorMessage.extractErrorMessage(e, true, false) || 'unknown error';
1185
+ errorLog$1('[whois] %s %s', registerableDomain, errorMessage);
1185
1186
  return whoisErrorCountAsAlive;
1186
1187
  }
1187
1188
  if (whois === whoiserTLDNotSupportedSymbol) {
@@ -1319,6 +1320,7 @@ const sharedNullResponse = Object.freeze({
1319
1320
  factor: retryFactor
1320
1321
  };
1321
1322
  const mutex = createAsyncMutex();
1323
+ const dnsClients = getDnsClients(dnsServers);
1322
1324
  return async function isRegisterableDomainAlive(domain) {
1323
1325
  domain = url.domainToASCII(domain);
1324
1326
  return mutex(domain, ()=>cacheApply(registerableDomainResultCache, domain, async ()=>{
@@ -1349,9 +1351,9 @@ tencentcloud.com. 86400 IN SOA ns-tel1.qq.com. webmaster.qq.com. 165111089
1349
1351
  ;; WHEN: Fri Aug 22 00:26:29 CST 2025
1350
1352
  ;; MSG SIZE rcvd: 468
1351
1353
  */ // dns servers get shuffled every time called
1352
- const shuffledDnsClients = getDnsClients(shuffleArray.shuffleArray(dnsServers, {
1354
+ const shuffledDnsClients = shuffleArray.shuffleArray(dnsClients, {
1353
1355
  copy: true
1354
- }));
1356
+ });
1355
1357
  let attempts = 0;
1356
1358
  let confirmations = 0;
1357
1359
  while(attempts < maxAttempts){
@@ -1370,7 +1372,8 @@ tencentcloud.com. 86400 IN SOA ns-tel1.qq.com. webmaster.qq.com. 165111089
1370
1372
  confirmations++;
1371
1373
  }
1372
1374
  } catch (e) {
1373
- errorNsLog('[NS] %s error (%s) %O', domain, resolve.server, e);
1375
+ const errorMessage = extractErrorMessage.extractErrorMessage(e, true, false) || 'unknown error';
1376
+ errorNsLog('[NS] %s error (%s) %s', domain, resolve.server, errorMessage);
1374
1377
  } finally{
1375
1378
  attempts++;
1376
1379
  log$1('[NS] %s %d %d/%d', domain, confirmations, attempts, maxAttempts);
@@ -1423,6 +1426,7 @@ function createDomainAliveChecker(options = {}) {
1423
1426
  factor: retryFactor
1424
1427
  };
1425
1428
  const mutex = createAsyncMutex();
1429
+ const dnsClients = getDnsClients(dnsServers);
1426
1430
  return async function isDomainAlive(domain) {
1427
1431
  domain = url.domainToASCII(domain);
1428
1432
  const registerableDomainAliveResult = await isRegisterableDomainAlive(domain);
@@ -1446,9 +1450,9 @@ function createDomainAliveChecker(options = {}) {
1446
1450
  }
1447
1451
  return mutex(domain, ()=>cacheApply(resultCache, domain, async ()=>{
1448
1452
  // shuffle every time is called
1449
- const shuffledDnsClients = getDnsClients(shuffleArray.shuffleArray(dnsServers, {
1453
+ const shuffledDnsClients = shuffleArray.shuffleArray(dnsClients, {
1450
1454
  copy: true
1451
- }));
1455
+ });
1452
1456
  {
1453
1457
  // IPv4
1454
1458
  let attempts = 0;
@@ -1470,12 +1474,8 @@ function createDomainAliveChecker(options = {}) {
1470
1474
  confirmations++;
1471
1475
  }
1472
1476
  } catch (e) {
1473
- if (typeof e === 'object' && e !== null) {
1474
- Object.assign(e, {
1475
- dns: resolve.server
1476
- });
1477
- }
1478
- errorLog('[A] %s error %O', domain, e);
1477
+ const errorMessage = extractErrorMessage.extractErrorMessage(e, true, false) || 'unknown error';
1478
+ errorLog('[A] %s error (%s) %s', domain, resolve.server, errorMessage);
1479
1479
  } finally{
1480
1480
  attempts++;
1481
1481
  log('[A] %s %d %d/%d', domain, confirmations, attempts, maxAttempts);
@@ -1503,12 +1503,8 @@ function createDomainAliveChecker(options = {}) {
1503
1503
  confirmations++;
1504
1504
  }
1505
1505
  } catch (e) {
1506
- if (typeof e === 'object' && e !== null) {
1507
- Object.assign(e, {
1508
- dns: resolve.server
1509
- });
1510
- }
1511
- errorLog('[AAAA] %s error %O', domain, e);
1506
+ const errorMessage = extractErrorMessage.extractErrorMessage(e, true, false) || 'unknown error';
1507
+ errorLog('[AAAA] %s error (%s) %s', domain, resolve.server, errorMessage);
1512
1508
  } finally{
1513
1509
  attempts++;
1514
1510
  log('[AAAA] %s %d %d/%d', domain, confirmations, attempts, maxAttempts);
package/dist/index.mjs CHANGED
@@ -1174,7 +1174,8 @@ const whoiserNoWhoisSymbol = Symbol('"whoiser" library returns "No WHOIS data fo
1174
1174
  throw error;
1175
1175
  }), retryOption);
1176
1176
  } catch (e) {
1177
- errorLog$1('[whois] %s %O', registerableDomain, e);
1177
+ const errorMessage = extractErrorMessage(e, true, false) || 'unknown error';
1178
+ errorLog$1('[whois] %s %s', registerableDomain, errorMessage);
1178
1179
  return whoisErrorCountAsAlive;
1179
1180
  }
1180
1181
  if (whois === whoiserTLDNotSupportedSymbol) {
@@ -1312,6 +1313,7 @@ const sharedNullResponse = Object.freeze({
1312
1313
  factor: retryFactor
1313
1314
  };
1314
1315
  const mutex = createAsyncMutex();
1316
+ const dnsClients = getDnsClients(dnsServers);
1315
1317
  return async function isRegisterableDomainAlive(domain) {
1316
1318
  domain = domainToASCII(domain);
1317
1319
  return mutex(domain, ()=>cacheApply(registerableDomainResultCache, domain, async ()=>{
@@ -1342,9 +1344,9 @@ tencentcloud.com. 86400 IN SOA ns-tel1.qq.com. webmaster.qq.com. 165111089
1342
1344
  ;; WHEN: Fri Aug 22 00:26:29 CST 2025
1343
1345
  ;; MSG SIZE rcvd: 468
1344
1346
  */ // dns servers get shuffled every time called
1345
- const shuffledDnsClients = getDnsClients(shuffleArray(dnsServers, {
1347
+ const shuffledDnsClients = shuffleArray(dnsClients, {
1346
1348
  copy: true
1347
- }));
1349
+ });
1348
1350
  let attempts = 0;
1349
1351
  let confirmations = 0;
1350
1352
  while(attempts < maxAttempts){
@@ -1363,7 +1365,8 @@ tencentcloud.com. 86400 IN SOA ns-tel1.qq.com. webmaster.qq.com. 165111089
1363
1365
  confirmations++;
1364
1366
  }
1365
1367
  } catch (e) {
1366
- errorNsLog('[NS] %s error (%s) %O', domain, resolve.server, e);
1368
+ const errorMessage = extractErrorMessage(e, true, false) || 'unknown error';
1369
+ errorNsLog('[NS] %s error (%s) %s', domain, resolve.server, errorMessage);
1367
1370
  } finally{
1368
1371
  attempts++;
1369
1372
  log$1('[NS] %s %d %d/%d', domain, confirmations, attempts, maxAttempts);
@@ -1416,6 +1419,7 @@ function createDomainAliveChecker(options = {}) {
1416
1419
  factor: retryFactor
1417
1420
  };
1418
1421
  const mutex = createAsyncMutex();
1422
+ const dnsClients = getDnsClients(dnsServers);
1419
1423
  return async function isDomainAlive(domain) {
1420
1424
  domain = domainToASCII(domain);
1421
1425
  const registerableDomainAliveResult = await isRegisterableDomainAlive(domain);
@@ -1439,9 +1443,9 @@ function createDomainAliveChecker(options = {}) {
1439
1443
  }
1440
1444
  return mutex(domain, ()=>cacheApply(resultCache, domain, async ()=>{
1441
1445
  // shuffle every time is called
1442
- const shuffledDnsClients = getDnsClients(shuffleArray(dnsServers, {
1446
+ const shuffledDnsClients = shuffleArray(dnsClients, {
1443
1447
  copy: true
1444
- }));
1448
+ });
1445
1449
  {
1446
1450
  // IPv4
1447
1451
  let attempts = 0;
@@ -1463,12 +1467,8 @@ function createDomainAliveChecker(options = {}) {
1463
1467
  confirmations++;
1464
1468
  }
1465
1469
  } catch (e) {
1466
- if (typeof e === 'object' && e !== null) {
1467
- Object.assign(e, {
1468
- dns: resolve.server
1469
- });
1470
- }
1471
- errorLog('[A] %s error %O', domain, e);
1470
+ const errorMessage = extractErrorMessage(e, true, false) || 'unknown error';
1471
+ errorLog('[A] %s error (%s) %s', domain, resolve.server, errorMessage);
1472
1472
  } finally{
1473
1473
  attempts++;
1474
1474
  log('[A] %s %d %d/%d', domain, confirmations, attempts, maxAttempts);
@@ -1496,12 +1496,8 @@ function createDomainAliveChecker(options = {}) {
1496
1496
  confirmations++;
1497
1497
  }
1498
1498
  } catch (e) {
1499
- if (typeof e === 'object' && e !== null) {
1500
- Object.assign(e, {
1501
- dns: resolve.server
1502
- });
1503
- }
1504
- errorLog('[AAAA] %s error %O', domain, e);
1499
+ const errorMessage = extractErrorMessage(e, true, false) || 'unknown error';
1500
+ errorLog('[AAAA] %s error (%s) %s', domain, resolve.server, errorMessage);
1505
1501
  } finally{
1506
1502
  attempts++;
1507
1503
  log('[AAAA] %s %d %d/%d', domain, confirmations, attempts, maxAttempts);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "domain-alive",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
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": "^4.1.0",
36
- "tldts": "^7.0.16"
35
+ "foxts": "^5.0.2",
36
+ "tldts": "^7.0.19"
37
37
  },
38
38
  "devDependencies": {
39
- "@eslint-sukka/node": "^7.2.1",
39
+ "@eslint-sukka/node": "^8.0.5",
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.6.2",
44
- "bumpp": "^10.2.3",
45
- "bunchee": "^6.6.0",
46
- "eslint": "^9.37.0",
47
- "eslint-config-sukka": "^7.2.1",
48
- "eslint-formatter-sukka": "^7.2.1",
43
+ "@types/node": "^24.10.1",
44
+ "bumpp": "^10.3.2",
45
+ "bunchee": "^6.6.2",
46
+ "eslint": "^9.39.1",
47
+ "eslint-config-sukka": "^8.0.5",
48
+ "eslint-formatter-sukka": "^8.0.5",
49
49
  "typescript": "^5.9.3",
50
50
  "whoiser": "2.0.0-beta.8"
51
51
  },