@cleandns/whois-rdap 1.0.33 → 1.0.35
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 +9 -1
- package/dist/port43.d.ts +1 -1
- package/dist/port43.js +7 -3
- package/dist/port43servers.js +4 -3
- package/package.json +1 -1
- package/src/index.ts +9 -1
- package/src/port43.ts +9 -3
- package/src/port43servers.ts +4 -3
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,9 +27,16 @@ 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
|
-
return port43(domain);
|
|
39
|
+
return port43(domain, _fetch);
|
|
32
40
|
}
|
|
33
41
|
url = "https://rdap.org";
|
|
34
42
|
}
|
package/dist/port43.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { WhoisResponse } from "../whois.js";
|
|
2
2
|
export declare function determinePort43Domain(actor: string): any[];
|
|
3
|
-
export declare function port43(actor: string): Promise<WhoisResponse>;
|
|
3
|
+
export declare function port43(actor: string, _fetch: typeof fetch): Promise<WhoisResponse>;
|
package/dist/port43.js
CHANGED
|
@@ -20,7 +20,7 @@ export function determinePort43Domain(actor) {
|
|
|
20
20
|
}
|
|
21
21
|
return [actor, "", null];
|
|
22
22
|
}
|
|
23
|
-
export async function port43(actor) {
|
|
23
|
+
export async function port43(actor, _fetch) {
|
|
24
24
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
25
25
|
const [domain, tld, whoisServer] = determinePort43Domain(actor);
|
|
26
26
|
const opts = whoisServer;
|
|
@@ -45,12 +45,12 @@ export async function port43(actor) {
|
|
|
45
45
|
let port43response = "";
|
|
46
46
|
try {
|
|
47
47
|
if (isWwww) {
|
|
48
|
-
port43response = (await
|
|
48
|
+
port43response = (await _fetch(opts.url.replace('%%domain%%', domain)).then(r => r.text())).toString().replace(/^[ \t]+/gm, "");
|
|
49
49
|
response.server = (_a = opts.url.match('//(.*?)/')) === null || _a === void 0 ? void 0 : _a[1];
|
|
50
50
|
}
|
|
51
51
|
else {
|
|
52
52
|
response.server = server;
|
|
53
|
-
port43response = await
|
|
53
|
+
port43response = await _fetch(`https://www.whois.com/whois/${domain}`).then(r => r.text()).then((r) => {
|
|
54
54
|
var _a;
|
|
55
55
|
return ((_a = r.match(/<pre class="df-raw" id="registryData">(.*?)<\/pre>/s)) === null || _a === void 0 ? void 0 : _a[1]) || "";
|
|
56
56
|
});
|
|
@@ -102,6 +102,10 @@ export async function port43(actor) {
|
|
|
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);
|
package/dist/port43servers.js
CHANGED
|
@@ -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
|
-
|
|
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",
|
package/package.json
CHANGED
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,9 +36,16 @@ 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
|
-
return port43(domain);
|
|
48
|
+
return port43(domain, _fetch);
|
|
41
49
|
}
|
|
42
50
|
url = "https://rdap.org";
|
|
43
51
|
}
|
package/src/port43.ts
CHANGED
|
@@ -26,7 +26,7 @@ export function determinePort43Domain(actor: string) {
|
|
|
26
26
|
return [actor, "", null];
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export async function port43(actor: string): Promise<WhoisResponse> {
|
|
29
|
+
export async function port43(actor: string, _fetch: typeof fetch): Promise<WhoisResponse> {
|
|
30
30
|
const [domain, tld, whoisServer] = determinePort43Domain(actor);
|
|
31
31
|
const opts = whoisServer;
|
|
32
32
|
const isWwww = opts?.url;
|
|
@@ -55,12 +55,12 @@ export async function port43(actor: string): Promise<WhoisResponse> {
|
|
|
55
55
|
|
|
56
56
|
try {
|
|
57
57
|
if (isWwww) {
|
|
58
|
-
port43response = (await
|
|
58
|
+
port43response = (await _fetch(opts.url.replace('%%domain%%', domain)).then(r => r.text())).toString().replace(/^[ \t]+/gm, "");
|
|
59
59
|
response.server = opts.url.match('//(.*?)/')?.[1];
|
|
60
60
|
}
|
|
61
61
|
else {
|
|
62
62
|
response.server = server;
|
|
63
|
-
port43response = await
|
|
63
|
+
port43response = await _fetch(`https://www.whois.com/whois/${domain}`).then(r => r.text()).then((r) => {
|
|
64
64
|
return r.match(/<pre class="df-raw" id="registryData">(.*?)<\/pre>/s)?.[1] || "";
|
|
65
65
|
});
|
|
66
66
|
|
|
@@ -135,6 +135,12 @@ export async function port43(actor: string): Promise<WhoisResponse> {
|
|
|
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
|
package/src/port43servers.ts
CHANGED
|
@@ -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
|
-
|
|
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",
|