rdapper 0.10.0 → 0.10.2
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 +18 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -547,14 +547,25 @@ function parseVcard(vcardArray) {
|
|
|
547
547
|
//#endregion
|
|
548
548
|
//#region src/whois/client.ts
|
|
549
549
|
/**
|
|
550
|
+
* Some WHOIS servers default to non-English responses. This mapping allows automatic
|
|
551
|
+
* query transformation to request English-only output for easier parsing.
|
|
552
|
+
*
|
|
553
|
+
* To add new servers: Add an entry with the hostname and transformation function:
|
|
554
|
+
* "whois.example.org": (query) => `${query}/english`,
|
|
555
|
+
*/
|
|
556
|
+
const WHOIS_QUERY_TRANSFORMERS = { "whois.jprs.jp": (query) => `${query}/e` };
|
|
557
|
+
/**
|
|
550
558
|
* Perform a WHOIS query against an RFC 3912 server over TCP 43.
|
|
551
559
|
* Returns the raw text and the server used.
|
|
552
560
|
*/
|
|
553
561
|
async function whoisQuery(server, query, options) {
|
|
554
562
|
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
563
|
+
const port = 43;
|
|
564
|
+
const host = server.replace(/^whois:\/\//i, "");
|
|
565
|
+
const transformer = WHOIS_QUERY_TRANSFORMERS[host];
|
|
555
566
|
return {
|
|
556
567
|
serverQueried: server,
|
|
557
|
-
text: await withTimeout(queryTcp(
|
|
568
|
+
text: await withTimeout(queryTcp(host, port, transformer ? transformer(query) : query, options), timeoutMs, "WHOIS timeout")
|
|
558
569
|
};
|
|
559
570
|
}
|
|
560
571
|
async function queryTcp(host, port, query, options) {
|
|
@@ -861,8 +872,10 @@ function normalizeWhois(domain, tld, whoisText, whoisServer, includeRaw = false)
|
|
|
861
872
|
"domain create date",
|
|
862
873
|
"created",
|
|
863
874
|
"registered",
|
|
875
|
+
"domain name commencement date",
|
|
864
876
|
"registration time",
|
|
865
|
-
"domain record activated"
|
|
877
|
+
"domain record activated",
|
|
878
|
+
"assigned"
|
|
866
879
|
]);
|
|
867
880
|
const updatedDate = anyValue(map, [
|
|
868
881
|
"updated date",
|
|
@@ -887,7 +900,9 @@ function normalizeWhois(domain, tld, whoisText, whoisServer, includeRaw = false)
|
|
|
887
900
|
"paid-till",
|
|
888
901
|
"expires on",
|
|
889
902
|
"expires",
|
|
890
|
-
"
|
|
903
|
+
"expire",
|
|
904
|
+
"renewal date",
|
|
905
|
+
"validity"
|
|
891
906
|
]);
|
|
892
907
|
const registrar = (() => {
|
|
893
908
|
const name = anyValue(map, [
|