@cleandns/whois-rdap 1.0.34 → 1.0.36

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
@@ -5,6 +5,7 @@ import { fixArrays } from "./utils/fixArrays.js";
5
5
  import { ianaIdToRegistrar } from "./utils/ianaIdToRegistrar.js";
6
6
  import { tldToRdap } from "./utils/tldToRdap.js";
7
7
  import { normalizeWhoisStatus } from "./whoisStatus.js";
8
+ import { resolve4 } from "dns/promises";
8
9
  const eventMap = new Map([
9
10
  ["registration", "created"],
10
11
  ["last changed", "updated"],
@@ -26,6 +27,13 @@ export async function whois(origDomain, options = { fetch: fetch, thinOnly: fals
26
27
  nameservers: [],
27
28
  ts: { created: null, updated: null, expires: null },
28
29
  };
30
+ if (url !== null) {
31
+ const host = new URL(url).host;
32
+ /* check for A record via DNS lookup */
33
+ const isLive = await resolve4(host).then((r) => Boolean(r === null || r === void 0 ? void 0 : r.length)).catch(() => false);
34
+ if (!isLive)
35
+ url = null;
36
+ }
29
37
  if (url === null) {
30
38
  if (determinePort43Domain(domain)[2]) {
31
39
  return port43(domain, _fetch);
package/dist/port43.js CHANGED
@@ -102,6 +102,10 @@ export async function port43(actor, _fetch) {
102
102
  !response.reseller &&
103
103
  (m = port43response.match(/^(?:Reseller(?: Name)?|reseller_name|reseller):[ \t]*(\S.+)/im)) &&
104
104
  (response.reseller = m[1].trim());
105
+ console.log(port43response);
106
+ // Updated Date: 2024-11-21T13:42:54Z
107
+ // Creation Date: 2017-12-16T02:11:08Z
108
+ // Registry Expiry Date: 2031-07-10T02:11:08Z
105
109
  !response.ts.updated &&
106
110
  (m = port43response.match(/^(?:Last Modified|Updated Date|Last updated on|domain_datelastmodified|last-update|modified|last modified)\.*:[ \t]*(\S.+)/im)) &&
107
111
  (response.ts.updated = new Date(reformatDate(m[1])) || null);
@@ -173,9 +173,10 @@ export const port43servers = {
173
173
  "*.lk": {
174
174
  url: `https://www.domains.lk/wp-content/themes/bridge-child/getDomainData.php?domainname=%%domain%%`,
175
175
  },
176
- "it.com": {
177
- url: `https://engine.itcomdomains.com/api/v1/domain/%%domain%%/whois_info`,
178
- },
176
+ "it.com": "whois.it.com",
177
+ // "it.com": {
178
+ // url: `https://engine.itcomdomains.com/api/v1/domain/%%domain%%/whois_info`,
179
+ // },
179
180
  com: {
180
181
  host: "whois.verisign-grs.com",
181
182
  query: "DOMAIN $addr\r\n",
@@ -601,6 +602,7 @@ export const port43servers = {
601
602
  af: "whois.nic.af",
602
603
  ag: "whois.nic.ag",
603
604
  ai: "whois.nic.ai",
605
+ "*.ai": "whois.nic.ai",
604
606
  al: null,
605
607
  am: "whois.amnic.net",
606
608
  an: null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cleandns/whois-rdap",
3
- "version": "1.0.34",
3
+ "version": "1.0.36",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/src/index.ts CHANGED
@@ -6,6 +6,7 @@ import { fixArrays } from "./utils/fixArrays.js";
6
6
  import { ianaIdToRegistrar } from "./utils/ianaIdToRegistrar.js";
7
7
  import { tldToRdap } from "./utils/tldToRdap.js";
8
8
  import { normalizeWhoisStatus } from "./whoisStatus.js";
9
+ import { resolve4 } from "dns/promises";
9
10
 
10
11
  const eventMap = new Map<string, WhoisTimestampFields>([
11
12
  ["registration", "created"],
@@ -35,6 +36,13 @@ export async function whois(
35
36
  ts: { created: null, updated: null, expires: null },
36
37
  };
37
38
 
39
+ if (url !== null) {
40
+ const host = new URL(url).host;
41
+ /* check for A record via DNS lookup */
42
+ const isLive = await resolve4(host).then((r) => Boolean(r?.length)).catch(() => false);
43
+ if (! isLive) url = null;
44
+ }
45
+
38
46
  if (url === null) {
39
47
  if (determinePort43Domain(domain)[2]) {
40
48
  return port43(domain, _fetch);
package/src/port43.ts CHANGED
@@ -135,6 +135,12 @@ export async function port43(actor: string, _fetch: typeof fetch): Promise<Whois
135
135
  )) &&
136
136
  (response.reseller = m[1].trim());
137
137
 
138
+ console.log(port43response)
139
+
140
+ // Updated Date: 2024-11-21T13:42:54Z
141
+ // Creation Date: 2017-12-16T02:11:08Z
142
+ // Registry Expiry Date: 2031-07-10T02:11:08Z
143
+
138
144
  !response.ts.updated &&
139
145
  (m = port43response.match(
140
146
  /^(?:Last Modified|Updated Date|Last updated on|domain_datelastmodified|last-update|modified|last modified)\.*:[ \t]*(\S.+)/im
@@ -217,9 +217,10 @@ export const port43servers: Record<string, any> = {
217
217
  url: `https://www.domains.lk/wp-content/themes/bridge-child/getDomainData.php?domainname=%%domain%%`,
218
218
  },
219
219
 
220
- "it.com": {
221
- url: `https://engine.itcomdomains.com/api/v1/domain/%%domain%%/whois_info`,
222
- },
220
+ "it.com": "whois.it.com",
221
+ // "it.com": {
222
+ // url: `https://engine.itcomdomains.com/api/v1/domain/%%domain%%/whois_info`,
223
+ // },
223
224
 
224
225
  com: {
225
226
  host: "whois.verisign-grs.com",
@@ -653,6 +654,7 @@ export const port43servers: Record<string, any> = {
653
654
  af: "whois.nic.af",
654
655
  ag: "whois.nic.ag",
655
656
  ai: "whois.nic.ai",
657
+ "*.ai": "whois.nic.ai",
656
658
  al: null,
657
659
  am: "whois.amnic.net",
658
660
  an: null,