@stacksjs/whois 0.70.87 → 0.70.88

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/whois",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.70.87",
5
+ "version": "0.70.88",
6
6
  "description": "Easily get whois info.",
7
7
  "author": "Chris Breuer",
8
8
  "contributors": [
@@ -1,327 +0,0 @@
1
- export declare const IANA_CHK_URL: string;
2
- /** @defaultValue `{ 'whois.denic.de': '-T dn,ace', 'whois.nic.fr': '-V Md5.2' }` */
3
- export declare const PARAMETERS: Record<string, string>;
4
- /**
5
- * @defaultValue
6
- * ```ts
7
- * {
8
- * 'br.com': 'whois.centralnic.net',
9
- * 'cn.com': 'whois.centralnic.net',
10
- * 'de.com': 'whois.centralnic.net',
11
- * 'eu.com': 'whois.centralnic.net',
12
- * 'gb.com': 'whois.centralnic.net',
13
- * 'gb.net': 'whois.centralnic.net',
14
- * 'gr.com': 'whois.centralnic.net',
15
- * 'hu.com': 'whois.centralnic.net',
16
- * 'in.net': 'whois.centralnic.net',
17
- * 'no.com': 'whois.centralnic.net',
18
- * 'qc.com': 'whois.centralnic.net',
19
- * 'ru.com': 'whois.centralnic.net',
20
- * 'sa.com': 'whois.centralnic.net',
21
- * 'se.com': 'whois.centralnic.net',
22
- * 'se.net': 'whois.centralnic.net',
23
- * 'uk.com': 'whois.centralnic.net',
24
- * 'uk.net': 'whois.centralnic.net',
25
- * 'us.com': 'whois.centralnic.net',
26
- * 'uy.com': 'whois.centralnic.net',
27
- * 'za.com': 'whois.centralnic.net',
28
- * 'jpn.com': 'whois.centralnic.ne',
29
- * 'web.com': 'whois.centralnic.ne',
30
- * 'com': 'whois.verisign-grs.com',
31
- * 'za.net': 'whois.za.net',
32
- * 'net': 'whois.verisign-grs.com',
33
- * 'eu.org': 'whois.eu.org',
34
- * 'za.org': 'whois.za.org',
35
- * 'org': 'whois.pir.org',
36
- * 'llyw.cymru': 'whois.nic.llyw.cymru',
37
- * 'gov.scot': 'whois.nic.gov.scot',
38
- * 'gov.wales': 'whois.nic.gov.wales',
39
- * 'edu': 'whois.educause.edu',
40
- * 'gov': 'whois.dotgov.gov',
41
- * 'int': 'whois.iana.org',
42
- * 'e164.arpa': 'whois.ripe.net',
43
- * 'arpa': 'whois.iana.org',
44
- * 'aero': 'whois.aero',
45
- * 'asia': 'whois.nic.asia',
46
- * 'biz': 'whois.nic.biz',
47
- * 'cat': 'whois.nic.cat',
48
- * 'coop': 'whois.nic.coop',
49
- * 'info': 'whois.afilias.net',
50
- * 'jobs': 'whois.nic.jobs',
51
- * 'mobi': 'whois.afilias.net',
52
- * 'museum': 'whois.nic.museum',
53
- * 'name': 'whois.nic.name',
54
- * 'post': 'whois.dotpostregistry.net',
55
- * 'pro': 'whois.nic.pro',
56
- * 'tel': 'whois.nic.tel',
57
- * 'travel': 'whois.nic.travel',
58
- * 'xxx': 'whois.nic.xxx',
59
- * 'ac': 'whois.nic.ac',
60
- * 'ae': 'whois.aeda.net.ae',
61
- * 'af': 'whois.nic.af',
62
- * 'ag': 'whois.nic.ag',
63
- * 'ai': 'whois.nic.ai',
64
- * 'am': 'whois.amnic.net',
65
- * 'ar': 'whois.nic.ar',
66
- * 'as': 'whois.nic.as',
67
- * 'priv.at': 'whois.nic.priv.at',
68
- * 'at': 'whois.nic.at',
69
- * 'au': 'whois.auda.org.au',
70
- * 'aw': 'whois.nic.aw',
71
- * 'ax': 'whois.ax',
72
- * 'be': 'whois.dns.be',
73
- * 'bf': 'whois.registre.bf',
74
- * 'bg': 'whois.register.bg',
75
- * 'bh': 'whois.nic.bh',
76
- * 'bi': 'whois1.nic.bi',
77
- * 'bj': 'whois.nic.bj',
78
- * 'bm': 'whois.afilias-srs.net',
79
- * 'bn': 'whois.bnnic.bn',
80
- * 'bo': 'whois.nic.bo',
81
- * 'br': 'whois.registro.br',
82
- * 'by': 'whois.cctld.by',
83
- * 'bw': 'whois.nic.net.bw',
84
- * 'bz': 'whois.afilias-grs.info',
85
- * 'co.ca': 'whois.co.ca',
86
- * 'ca': 'whois.cira.ca',
87
- * 'cc': 'ccwhois.verisign-grs.com',
88
- * 'cd': 'whois.nic.cd',
89
- * 'ch': 'whois.nic.ch',
90
- * 'ci': 'whois.nic.ci',
91
- * 'cl': 'whois.nic.cl',
92
- * 'cm': 'whois.netcom.cm',
93
- * 'edu.cn': 'whois.edu.cn',
94
- * 'cn': 'whois.cnnic.cn',
95
- * 'uk.co': 'whois.uk.co',
96
- * 'co': 'whois.nic.co',
97
- * 'cr': 'whois.nic.cr',
98
- * 'cx': 'whois.nic.cx',
99
- * 'cz': 'whois.nic.cz',
100
- * 'de': 'whois.denic.de',
101
- * 'dk': 'whois.dk-hostmaster.dk',
102
- * 'dm': 'whois.dmdomains.dm',
103
- * 'do': 'whois.nic.do',
104
- * 'dz': 'whois.nic.dz',
105
- * 'ec': 'whois.nic.ec',
106
- * 'ee': 'whois.tld.ee',
107
- * 'eu': 'whois.eu',
108
- * 'fi': 'whois.fi',
109
- * 'fj': 'www.whois.fj',
110
- * 'fm': 'whois.nic.fm',
111
- * 'fo': 'whois.nic.fo',
112
- * 'fr': 'whois.nic.fr',
113
- * 'gd': 'whois.nic.gd',
114
- * 'ge': 'whois.nic.ge',
115
- * 'gf': 'whois.mediaserv.net',
116
- * 'gg': 'whois.gg',
117
- * 'gh': 'whois.nic.gh',
118
- * 'gi': 'whois2.afilias-grs.net',
119
- * 'gl': 'whois.nic.gl',
120
- * 'gp': 'whois.nic.gp',
121
- * 'gq': 'whois.dominio.gq',
122
- * 'gs': 'whois.nic.gs',
123
- * 'gy': 'whois.registry.gy',
124
- * 'hk': 'whois.hkirc.hk',
125
- * 'hm': 'whois.registry.hm',
126
- * 'hn': 'whois.nic.hn',
127
- * 'hr': 'whois.dns.hr',
128
- * 'ht': 'whois.nic.ht',
129
- * 'hu': 'whois.nic.hu',
130
- * 'id': 'whois.id',
131
- * 'ie': 'whois.weare.ie',
132
- * 'il': 'whois.isoc.org.il',
133
- * 'im': 'whois.nic.im',
134
- * 'in': 'whois.registry.in',
135
- * 'io': 'whois.nic.io',
136
- * 'iq': 'whois.cmc.iq',
137
- * 'ir': 'whois.nic.ir',
138
- * 'is': 'whois.isnic.is',
139
- * 'it': 'whois.nic.it',
140
- * 'je': 'whois.je',
141
- * 'jp': 'whois.jprs.jp',
142
- * 'ke': 'whois.kenic.or.ke',
143
- * 'kg': 'whois.kg',
144
- * 'ki': 'whois.nic.ki',
145
- * 'kn': 'whois.nic.kn',
146
- * 'kr': 'whois.kr',
147
- * 'kw': 'whois.nic.kw',
148
- * 'ky': 'whois.kyregistry.ky',
149
- * 'kz': 'whois.nic.kz',
150
- * 'la': 'whois.nic.la',
151
- * 'lb': 'whois.lbdr.org.lb',
152
- * 'lc': 'whois2.afilias-grs.net',
153
- * 'li': 'whois.nic.li',
154
- * 'lk': 'whois.nic.lk',
155
- * 'ls': 'whois.nic.ls',
156
- * 'lt': 'whois.domreg.lt',
157
- * 'lu': 'whois.dns.lu',
158
- * 'lv': 'whois.nic.lv',
159
- * 'ly': 'whois.nic.ly',
160
- * 'ma': 'whois.registre.ma',
161
- * 'md': 'whois.nic.md',
162
- * 'me': 'whois.nic.me',
163
- * 'mg': 'whois.nic.mg',
164
- * 'mk': 'whois.marnet.mk',
165
- * 'ml': 'whois.dot.ml',
166
- * 'mm': 'whois.registry.gov.mm',
167
- * 'mn': 'whois.nic.mn',
168
- * 'mq': 'whois.mediaserv.net',
169
- * 'mr': 'whois.nic.mr',
170
- * 'ms': 'whois.nic.ms',
171
- * 'mt': 'whois.nic.org.mt',
172
- * 'mu': 'whois.nic.mu',
173
- * 'mw': 'whois.nic.mw',
174
- * 'mx': 'whois.mx',
175
- * 'my': 'whois.mynic.my',
176
- * 'mz': 'whois.nic.mz',
177
- * 'na': 'whois.na-nic.com.na',
178
- * 'nc': 'whois.nc',
179
- * 'nf': 'whois.nic.nf',
180
- * 'ng': 'whois.nic.net.ng',
181
- * 'nl': 'whois.domain-registry.nl',
182
- * 'no': 'whois.norid.no',
183
- * 'nu': 'whois.iis.nu',
184
- * 'nz': 'whois.irs.net.nz',
185
- * 'om': 'whois.registry.om',
186
- * 'pe': 'kero.yachay.pe',
187
- * 'pf': 'whois.registry.pf',
188
- * 'pk': 'whois.pknic.net.pk',
189
- * 'co.pl': 'whois.co.pl',
190
- * 'pl': 'whois.dns.pl',
191
- * 'pm': 'whois.nic.pm',
192
- * 'pr': 'whois.afilias-srs.net',
193
- * 'ps': 'whois.pnina.ps',
194
- * 'pt': 'whois.dns.pt',
195
- * 'pw': 'whois.nic.pw',
196
- * 'qa': 'whois.registry.qa',
197
- * 're': 'whois.nic.re',
198
- * 'ro': 'whois.rotld.ro',
199
- * 'rs': 'whois.rnids.rs',
200
- * 'ac.ru': 'whois.free.net',
201
- * 'edu.ru': 'whois.informika.ru',
202
- * 'com.ru': 'whois.flexireg.net',
203
- * 'msk.ru': 'whois.flexireg.net',
204
- * 'net.ru': 'whois.nic.net.ru',
205
- * 'nov.ru': 'whois.flexireg.net',
206
- * 'org.ru': 'whois.nic.net.ru',
207
- * 'pp.ru': 'whois.nic.net.ru',
208
- * 'spb.ru': 'whois.flexireg.net',
209
- * 'ru': 'whois.tcinet.ru',
210
- * 'rw': 'whois.ricta.org.rw',
211
- * 'sa': 'whois.nic.net.sa',
212
- * 'sb': 'whois.nic.net.sb',
213
- * 'sc': 'whois2.afilias-grs.net',
214
- * 'sd': 'whois.sdnic.sd',
215
- * 'se': 'whois.iis.se',
216
- * 'sg': 'whois.sgnic.sg',
217
- * 'sh': 'whois.nic.sh',
218
- * 'si': 'whois.register.si',
219
- * 'sk': 'whois.sk-nic.sk',
220
- * 'sl': 'whois.nic.sl',
221
- * 'sm': 'whois.nic.sm',
222
- * 'sn': 'whois.nic.sn',
223
- * 'so': 'whois.nic.so',
224
- * 'ss': 'whois.nic.ss',
225
- * 'st': 'whois.nic.st',
226
- * 'msk.su': 'whois.flexireg.net',
227
- * 'nov.su': 'whois.flexireg.net',
228
- * 'spb.su': 'whois.flexireg.net',
229
- * 'su': 'whois.tcinet.ru',
230
- * 'sx': 'whois.sx',
231
- * 'sy': 'whois.tld.sy',
232
- * 'tc': 'whois.nic.tc',
233
- * 'td': 'whois.nic.td',
234
- * 'tf': 'whois.nic.tf',
235
- * 'tg': 'whois.nic.tg',
236
- * 'th': 'whois.thnic.co.th',
237
- * 'tk': 'whois.dot.tk',
238
- * 'tl': 'whois.nic.tl',
239
- * 'tm': 'whois.nic.tm',
240
- * 'tn': 'whois.ati.tn',
241
- * 'to': 'whois.tonic.to',
242
- * 'tr': 'whois.trabis.gov.tr',
243
- * 'tv': 'whois.nic.tv',
244
- * 'tw': 'whois.twnic.net.tw',
245
- * 'tz': 'whois.tznic.or.tz',
246
- * 'biz.ua': 'whois.biz.ua',
247
- * 'co.ua': 'whois.co.ua',
248
- * 'pp.ua': 'whois.pp.ua',
249
- * 'ua': 'whois.ua',
250
- * 'ug': 'whois.co.ug',
251
- * 'ac.uk': 'whois.nic.ac.uk',
252
- * 'gov.uk': 'whois.gov.uk',
253
- * 'uk': 'whois.nic.uk',
254
- * 'fed.us': 'whois.nic.gov',
255
- * 'us': 'whois.nic.us',
256
- * 'uy': 'whois.nic.org.uy',
257
- * 'uz': 'whois.cctld.uz',
258
- * 'vc': 'whois2.afilias-grs.net',
259
- * 've': 'whois.nic.ve',
260
- * 'vg': 'whois.nic.vg',
261
- * 'vu': 'whois.dnrs.vu',
262
- * 'wf': 'whois.nic.wf',
263
- * 'ws': 'whois.website.ws',
264
- * 'yt': 'whois.nic.yt',
265
- * 'ac.za': 'whois.ac.za',
266
- * 'co.za': 'whois.registry.net.za',
267
- * 'gov.za': 'whois.gov.za',
268
- * 'net.za': 'net-whois.registry.net.za',
269
- * 'org.za': 'org-whois.registry.net.za',
270
- * 'web.za': 'web-whois.registry.net.za',
271
- * 'zm': 'whois.zicta.zm',
272
- * 'xn--2scrj9c': 'whois.registry.in',
273
- * 'xn--3e0b707e': 'whois.kr',
274
- * 'xn--3hcrj9c': 'whois.registry.in',
275
- * 'xn--45br5cyl': 'whois.registry.in',
276
- * 'xn--45brj9c': 'whois.registry.in',
277
- * 'xn--4dbrk0ce': 'whois.isoc.org.il',
278
- * 'xn--80ao21a': 'whois.nic.kz',
279
- * 'xn--90a3ac': 'whois.rnids.rs',
280
- * 'xn--90ae': 'whois.imena.bg',
281
- * 'xn--90ais': 'whois.cctld.by',
282
- * 'xn--clchc0ea0b2g2a9gcd': 'whois.sgnic.sg',
283
- * 'xn--d1alf': 'whois.marnet.mk',
284
- * 'xn--e1a4c': 'whois.eu',
285
- * 'xn--fiqs8s': 'cwhois.cnnic.cn',
286
- * 'xn--fiqz9s': 'cwhois.cnnic.cn',
287
- * 'xn--fpcrj9c3d': 'whois.registry.in',
288
- * 'xn--fzc2c9e2c': 'whois.nic.lk',
289
- * 'xn--gecrj9c': 'whois.registry.in',
290
- * 'xn--h2breg3eve': 'whois.registry.in',
291
- * 'xn--h2brj9c8c': 'whois.registry.in',
292
- * 'xn--h2brj9c': 'whois.registry.in',
293
- * 'xn--j1amh': 'whois.dotukr.com',
294
- * 'xn--j6w193g': 'whois.hkirc.hk',
295
- * 'xn--kprw13d': 'whois.twnic.net.tw',
296
- * 'xn--kpry57d': 'whois.twnic.net.tw',
297
- * 'xn--lgbbat1ad8j': 'whois.nic.dz',
298
- * 'xn--mgb9awbf': 'whois.registry.om',
299
- * 'xn--mgba3a4f16a': 'whois.nic.ir',
300
- * 'xn--mgbaam7a8h': 'whois.aeda.net.ae',
301
- * 'xn--mgbah1a3hjkrd': 'whois.nic.mr',
302
- * 'xn--mgbbh1a71e': 'whois.registry.in',
303
- * 'xn--mgbbh1a': 'whois.registry.in',
304
- * 'xn--mgberp4a5d4ar': 'whois.nic.net.sa',
305
- * 'xn--mgbgu82a': 'whois.registry.in',
306
- * 'xn--mgbtx2b': 'whois.cmc.iq',
307
- * 'xn--mgbx4cd0ab': 'whois.mynic.my',
308
- * 'xn--node': 'whois.itdc.ge',
309
- * 'xn--o3cw4h': 'whois.thnic.co.th',
310
- * 'xn--ogbpf8fl': 'whois.tld.sy',
311
- * 'xn--p1ai': 'whois.tcinet.ru',
312
- * 'xn--pgbs0dh': 'whois.ati.tn',
313
- * 'xn--q7ce6a': 'whois.nic.la',
314
- * 'xn--qxa6a': 'whois.eu',
315
- * 'xn--rvc1e0am3e': 'whois.registry.in',
316
- * 'xn--s9brj9c': 'whois.registry.in',
317
- * 'xn--wgbh1c': 'whois.dotmasr.eg',
318
- * 'xn--wgbl6a': 'whois.registry.qa',
319
- * 'xn--xkc2al3hye2a': 'whois.nic.lk',
320
- * 'xn--xkc2dl3a5ee0h': 'whois.registry.in',
321
- * 'xn--y9a3aq': 'whois.amnic.net',
322
- * 'xn--yfro4i67o': 'whois.sgnic.sg',
323
- * 'xn--ygbi2ammx': 'whois.pnina.ps'
324
- * }
325
- * ```
326
- */
327
- export declare const SERVERS: Record<string, string>;
package/dist/index.d.ts DELETED
@@ -1,76 +0,0 @@
1
- import { SERVERS } from './constants';
2
- import { SocksClient } from './socks';
3
- import type { ProxyData, WhoIsOptions, WhoIsResponse } from './types';
4
- import type { SocksClientOptions } from './socks';
5
- export type { SocksClientOptions } from './socks';
6
- /**
7
- * Find the WhoIs server for the TLD from IANA WhoIs service. The TLD is be searched and the HTML response is parsed to extract the WhoIs server
8
- *
9
- * @param tld TLD of the domain
10
- * @returns WhoIs server which hosts the information for the domains of the TLD
11
- */
12
- export declare function findWhoIsServer(tld: string): Promise<string>;
13
- /**
14
- * Get whois server of the tld from servers list
15
- *
16
- * @param tld TLD of the domain
17
- * @returns WhoIs server which hosts the information for the domains of the TLD
18
- */
19
- export declare function getWhoIsServer(tld: keyof typeof SERVERS): string | undefined;
20
- /**
21
- * Extract TLD from domain name.
22
- * If the TLD is in whois-servers.json file, then the TLD is returned.
23
- * If TLD is not found within the file, then determined by taking the last element after splitting the domain name from '.'
24
- *
25
- * @param domain Domain name
26
- * @returns TLD
27
- */
28
- export declare function getTLD(domain: string): keyof typeof SERVERS;
29
- // get whois query parameters if exist on parameters.json for whois server
30
- export declare function getParameters(server: string): string | undefined;
31
- /**
32
- * Connects to the provided {@link server}:{@link port} through TCP (through a proxy if a proxy is given), run the WhoIs query and returns the response
33
- *
34
- * @param domain Domain name
35
- * @param queryOptions Query options which can be used with the specific WhoIs server to get the complete response
36
- * @param server WhoIs server
37
- * @param port WhoIs server port
38
- * @param encoding Encoding used by the WhoIs server
39
- * @param proxy {@link ProxyData}
40
- * @returns The {string} WhoIs response for the query. Empty string is returned for errors
41
- */
42
- export declare function tcpWhois(domain: string, queryOptions: string, server: string, port: number, encoding: string, proxy: ProxyData | null): Promise<string>;
43
- /**
44
- * Collect WhoIs data for the mentioned {@link domain}. Parse the received response if {@link parse} is true, accordingly.
45
- *
46
- * @param domain Domain name
47
- * @param parse Whether the raw text needs to be parsed/formatted or not
48
- * @param options {@link WhoIsOptions}
49
- * @returns {@link WhoIsResponse} Returns a {@link WhoIsResponse} object which contains the raw text and parsed data (if parse is true)
50
- */
51
- export declare function whois(domain: string, parse?: boolean, options?: WhoIsOptions | null): Promise<WhoIsResponse>;
52
- export declare function lookup(domain: string, options?: WhoIsOptions | null): Promise<WhoIsResponse>;
53
- /**
54
- * Collects (and parse/format if set to be true) for the provided {@link domains}. If {@link parallel} is set to be true, multiple threads will be used to batch process the domains according to {@link threads} mentioned.
55
- * If <i>options.parsedData</i> is mentioned, then it will be used to parse <b>all</b> the responses.
56
- * If a proxy is mentioned in {@link options}, then the proxy will be used to collect <b>all</b> the WhoIs data.
57
- *
58
- * @param domains Domains Names
59
- * @param parallel Whether data should be collected parallally or not
60
- * @param threads Batch size (for parallel processing)
61
- * @param parse Whether the raw text needs to be parsed/formatted or not
62
- * @param options {@link WhoIsOptions}
63
- * @returns Array of {@link WhoIsResponse} for all the domains. Order is not guaranteed
64
- */
65
- export declare function batchWhois(domains: string[], parallel?: boolean, threads?: number, parse?: boolean, options?: WhoIsOptions | null): Promise<WhoIsResponse[]>;
66
- /**
67
- * Parse collected raw WhoIs data
68
- *
69
- * @class
70
- */
71
- export declare class WhoIsParser {
72
- static parseData(rawData: string, outputData: any | null): any;
73
- }
74
- export * from './constants';
75
- export * from './types';
76
- export { SocksClient } from './socks';
package/dist/index.js DELETED
@@ -1,7 +0,0 @@
1
- // @bun
2
- import E from"net";import{log as q}from"@stacksjs/logging";var Y="https://www.iana.org/whois?q=",Z={"whois.denic.de":"-T dn,ace","whois.nic.fr":"-V Md5.2"},K={"br.com":"whois.centralnic.net","cn.com":"whois.centralnic.net","de.com":"whois.centralnic.net","eu.com":"whois.centralnic.net","gb.com":"whois.centralnic.net","gb.net":"whois.centralnic.net","gr.com":"whois.centralnic.net","hu.com":"whois.centralnic.net","in.net":"whois.centralnic.net","no.com":"whois.centralnic.net","qc.com":"whois.centralnic.net","ru.com":"whois.centralnic.net","sa.com":"whois.centralnic.net","se.com":"whois.centralnic.net","se.net":"whois.centralnic.net","uk.com":"whois.centralnic.net","uk.net":"whois.centralnic.net","us.com":"whois.centralnic.net","uy.com":"whois.centralnic.net","za.com":"whois.centralnic.net","jpn.com":"whois.centralnic.ne","web.com":"whois.centralnic.ne",com:"whois.verisign-grs.com","za.net":"whois.za.net",net:"whois.verisign-grs.com","eu.org":"whois.eu.org","za.org":"whois.za.org",org:"whois.pir.org","llyw.cymru":"whois.nic.llyw.cymru","gov.scot":"whois.nic.gov.scot","gov.wales":"whois.nic.gov.wales",edu:"whois.educause.edu",gov:"whois.dotgov.gov",int:"whois.iana.org","e164.arpa":"whois.ripe.net",arpa:"whois.iana.org",aero:"whois.aero",asia:"whois.nic.asia",biz:"whois.nic.biz",cat:"whois.nic.cat",coop:"whois.nic.coop",info:"whois.afilias.net",jobs:"whois.nic.jobs",mobi:"whois.afilias.net",museum:"whois.nic.museum",name:"whois.nic.name",post:"whois.dotpostregistry.net",pro:"whois.nic.pro",tel:"whois.nic.tel",travel:"whois.nic.travel",xxx:"whois.nic.xxx",ac:"whois.nic.ac",ae:"whois.aeda.net.ae",af:"whois.nic.af",ag:"whois.nic.ag",ai:"whois.nic.ai",am:"whois.amnic.net",ar:"whois.nic.ar",as:"whois.nic.as","priv.at":"whois.nic.priv.at",at:"whois.nic.at",au:"whois.auda.org.au",aw:"whois.nic.aw",ax:"whois.ax",be:"whois.dns.be",bf:"whois.registre.bf",bg:"whois.register.bg",bh:"whois.nic.bh",bi:"whois1.nic.bi",bj:"whois.nic.bj",bm:"whois.afilias-srs.net",bn:"whois.bnnic.bn",bo:"whois.nic.bo",br:"whois.registro.br",by:"whois.cctld.by",bw:"whois.nic.net.bw",bz:"whois.afilias-grs.info","co.ca":"whois.co.ca",ca:"whois.cira.ca",cc:"ccwhois.verisign-grs.com",cd:"whois.nic.cd",ch:"whois.nic.ch",ci:"whois.nic.ci",cl:"whois.nic.cl",cm:"whois.netcom.cm","edu.cn":"whois.edu.cn",cn:"whois.cnnic.cn","uk.co":"whois.uk.co",co:"whois.nic.co",cr:"whois.nic.cr",cx:"whois.nic.cx",cz:"whois.nic.cz",de:"whois.denic.de",dk:"whois.dk-hostmaster.dk",dm:"whois.dmdomains.dm",do:"whois.nic.do",dz:"whois.nic.dz",ec:"whois.nic.ec",ee:"whois.tld.ee",eu:"whois.eu",fi:"whois.fi",fj:"www.whois.fj",fm:"whois.nic.fm",fo:"whois.nic.fo",fr:"whois.nic.fr",gd:"whois.nic.gd",ge:"whois.nic.ge",gf:"whois.mediaserv.net",gg:"whois.gg",gh:"whois.nic.gh",gi:"whois2.afilias-grs.net",gl:"whois.nic.gl",gp:"whois.nic.gp",gq:"whois.dominio.gq",gs:"whois.nic.gs",gy:"whois.registry.gy",hk:"whois.hkirc.hk",hm:"whois.registry.hm",hn:"whois.nic.hn",hr:"whois.dns.hr",ht:"whois.nic.ht",hu:"whois.nic.hu",id:"whois.id",ie:"whois.weare.ie",il:"whois.isoc.org.il",im:"whois.nic.im",in:"whois.registry.in",io:"whois.nic.io",iq:"whois.cmc.iq",ir:"whois.nic.ir",is:"whois.isnic.is",it:"whois.nic.it",je:"whois.je",jp:"whois.jprs.jp",ke:"whois.kenic.or.ke",kg:"whois.kg",ki:"whois.nic.ki",kn:"whois.nic.kn",kr:"whois.kr",kw:"whois.nic.kw",ky:"whois.kyregistry.ky",kz:"whois.nic.kz",la:"whois.nic.la",lb:"whois.lbdr.org.lb",lc:"whois2.afilias-grs.net",li:"whois.nic.li",lk:"whois.nic.lk",ls:"whois.nic.ls",lt:"whois.domreg.lt",lu:"whois.dns.lu",lv:"whois.nic.lv",ly:"whois.nic.ly",ma:"whois.registre.ma",md:"whois.nic.md",me:"whois.nic.me",mg:"whois.nic.mg",mk:"whois.marnet.mk",ml:"whois.dot.ml",mm:"whois.registry.gov.mm",mn:"whois.nic.mn",mq:"whois.mediaserv.net",mr:"whois.nic.mr",ms:"whois.nic.ms",mt:"whois.nic.org.mt",mu:"whois.nic.mu",mw:"whois.nic.mw",mx:"whois.mx",my:"whois.mynic.my",mz:"whois.nic.mz",na:"whois.na-nic.com.na",nc:"whois.nc",nf:"whois.nic.nf",ng:"whois.nic.net.ng",nl:"whois.domain-registry.nl",no:"whois.norid.no",nu:"whois.iis.nu",nz:"whois.irs.net.nz",om:"whois.registry.om",pe:"kero.yachay.pe",pf:"whois.registry.pf",pk:"whois.pknic.net.pk","co.pl":"whois.co.pl",pl:"whois.dns.pl",pm:"whois.nic.pm",pr:"whois.afilias-srs.net",ps:"whois.pnina.ps",pt:"whois.dns.pt",pw:"whois.nic.pw",qa:"whois.registry.qa",re:"whois.nic.re",ro:"whois.rotld.ro",rs:"whois.rnids.rs","ac.ru":"whois.free.net","edu.ru":"whois.informika.ru","com.ru":"whois.flexireg.net","msk.ru":"whois.flexireg.net","net.ru":"whois.nic.net.ru","nov.ru":"whois.flexireg.net","org.ru":"whois.nic.net.ru","pp.ru":"whois.nic.net.ru","spb.ru":"whois.flexireg.net",ru:"whois.tcinet.ru",rw:"whois.ricta.org.rw",sa:"whois.nic.net.sa",sb:"whois.nic.net.sb",sc:"whois2.afilias-grs.net",sd:"whois.sdnic.sd",se:"whois.iis.se",sg:"whois.sgnic.sg",sh:"whois.nic.sh",si:"whois.register.si",sk:"whois.sk-nic.sk",sl:"whois.nic.sl",sm:"whois.nic.sm",sn:"whois.nic.sn",so:"whois.nic.so",ss:"whois.nic.ss",st:"whois.nic.st","msk.su":"whois.flexireg.net","nov.su":"whois.flexireg.net","spb.su":"whois.flexireg.net",su:"whois.tcinet.ru",sx:"whois.sx",sy:"whois.tld.sy",tc:"whois.nic.tc",td:"whois.nic.td",tf:"whois.nic.tf",tg:"whois.nic.tg",th:"whois.thnic.co.th",tk:"whois.dot.tk",tl:"whois.nic.tl",tm:"whois.nic.tm",tn:"whois.ati.tn",to:"whois.tonic.to",tr:"whois.trabis.gov.tr",tv:"whois.nic.tv",tw:"whois.twnic.net.tw",tz:"whois.tznic.or.tz","biz.ua":"whois.biz.ua","co.ua":"whois.co.ua","pp.ua":"whois.pp.ua",ua:"whois.ua",ug:"whois.co.ug","ac.uk":"whois.nic.ac.uk","gov.uk":"whois.gov.uk",uk:"whois.nic.uk","fed.us":"whois.nic.gov",us:"whois.nic.us",uy:"whois.nic.org.uy",uz:"whois.cctld.uz",vc:"whois2.afilias-grs.net",ve:"whois.nic.ve",vg:"whois.nic.vg",vu:"whois.dnrs.vu",wf:"whois.nic.wf",ws:"whois.website.ws",yt:"whois.nic.yt","ac.za":"whois.ac.za","co.za":"whois.registry.net.za","gov.za":"whois.gov.za","net.za":"net-whois.registry.net.za","org.za":"org-whois.registry.net.za","web.za":"web-whois.registry.net.za",zm:"whois.zicta.zm","xn--2scrj9c":"whois.registry.in","xn--3e0b707e":"whois.kr","xn--3hcrj9c":"whois.registry.in","xn--45br5cyl":"whois.registry.in","xn--45brj9c":"whois.registry.in","xn--4dbrk0ce":"whois.isoc.org.il","xn--80ao21a":"whois.nic.kz","xn--90a3ac":"whois.rnids.rs","xn--90ae":"whois.imena.bg","xn--90ais":"whois.cctld.by","xn--clchc0ea0b2g2a9gcd":"whois.sgnic.sg","xn--d1alf":"whois.marnet.mk","xn--e1a4c":"whois.eu","xn--fiqs8s":"cwhois.cnnic.cn","xn--fiqz9s":"cwhois.cnnic.cn","xn--fpcrj9c3d":"whois.registry.in","xn--fzc2c9e2c":"whois.nic.lk","xn--gecrj9c":"whois.registry.in","xn--h2breg3eve":"whois.registry.in","xn--h2brj9c8c":"whois.registry.in","xn--h2brj9c":"whois.registry.in","xn--j1amh":"whois.dotukr.com","xn--j6w193g":"whois.hkirc.hk","xn--kprw13d":"whois.twnic.net.tw","xn--kpry57d":"whois.twnic.net.tw","xn--lgbbat1ad8j":"whois.nic.dz","xn--mgb9awbf":"whois.registry.om","xn--mgba3a4f16a":"whois.nic.ir","xn--mgbaam7a8h":"whois.aeda.net.ae","xn--mgbah1a3hjkrd":"whois.nic.mr","xn--mgbbh1a71e":"whois.registry.in","xn--mgbbh1a":"whois.registry.in","xn--mgberp4a5d4ar":"whois.nic.net.sa","xn--mgbgu82a":"whois.registry.in","xn--mgbtx2b":"whois.cmc.iq","xn--mgbx4cd0ab":"whois.mynic.my","xn--node":"whois.itdc.ge","xn--o3cw4h":"whois.thnic.co.th","xn--ogbpf8fl":"whois.tld.sy","xn--p1ai":"whois.tcinet.ru","xn--pgbs0dh":"whois.ati.tn","xn--q7ce6a":"whois.nic.la","xn--qxa6a":"whois.eu","xn--rvc1e0am3e":"whois.registry.in","xn--s9brj9c":"whois.registry.in","xn--wgbh1c":"whois.dotmasr.eg","xn--wgbl6a":"whois.registry.qa","xn--xkc2al3hye2a":"whois.nic.lk","xn--xkc2dl3a5ee0h":"whois.registry.in","xn--y9a3aq":"whois.amnic.net","xn--yfro4i67o":"whois.sgnic.sg","xn--ygbi2ammx":"whois.pnina.ps"};import H from"net";class G{options;constructor(i){this.options=i}static createConnection(i,h){new G(i).connect(h)}connect(i){let h=new H.Socket,{proxy:w,destination:n}=this.options;h.connect({port:w.port,host:w.host},()=>{if(w.type===5)this.connectSocks5(h,i);else this.connectSocks4(h,i)}),h.on("error",(g)=>{i(g)})}connectSocks4(i,h){let{destination:w,proxy:n}=this.options,g=w.port,c=n.userId||"",s;if(this.isIPv4(w.host)){let m=w.host.split(".").map(Number);s=Buffer.from(m)}else s=Buffer.from([0,0,0,1]);let o=Buffer.concat([Buffer.from([4]),Buffer.from([1]),Buffer.from([g>>8&255,g&255]),s,Buffer.from(c),Buffer.from([0])]);if(!this.isIPv4(w.host)){let m=Buffer.concat([o,Buffer.from(w.host),Buffer.from([0])]);i.write(m)}else i.write(o);i.once("data",(m)=>{if(m.length<8){h(Error("Invalid SOCKS4 response"));return}let x=m[1];if(x!==90){h(Error(`SOCKS4 connection failed with status: ${x}`));return}h(null,{socket:i})})}connectSocks5(i,h){let{destination:w,proxy:n}=this.options,g;if(n.userId&&n.password)g=[0,2];else g=[0];let c=Buffer.from([5,g.length,...g]);i.write(c),i.once("data",(s)=>{if(s.length<2||s[0]!==5){h(Error("Invalid SOCKS5 greeting response"));return}let o=s[1];if(o===255){h(Error("No acceptable authentication methods"));return}if(o===2)this.authenticateSocks5(i,h);else this.sendConnectRequest(i,h)})}authenticateSocks5(i,h){let{proxy:w}=this.options,n=w.userId||"",g=w.password||"",c=Buffer.concat([Buffer.from([1]),Buffer.from([n.length]),Buffer.from(n),Buffer.from([g.length]),Buffer.from(g)]);i.write(c),i.once("data",(s)=>{if(s.length<2||s[0]!==1){h(Error("Invalid SOCKS5 auth response"));return}if(s[1]!==0){h(Error("SOCKS5 authentication failed"));return}this.sendConnectRequest(i,h)})}sendConnectRequest(i,h){let{destination:w}=this.options,n=w.port,g,c;if(this.isIPv4(w.host)){c=1;let o=w.host.split(".").map(Number);g=Buffer.from(o)}else if(this.isIPv6(w.host)){c=4;let o=w.host.split(":"),m=[];for(let x of o){let z=Number.parseInt(x,16);m.push(z>>8&255,z&255)}g=Buffer.from(m)}else c=3,g=Buffer.concat([Buffer.from([w.host.length]),Buffer.from(w.host)]);let s=Buffer.concat([Buffer.from([5,1,0,c]),g,Buffer.from([n>>8&255,n&255])]);i.write(s),i.once("data",(o)=>{if(o.length<10||o[0]!==5){h(Error("Invalid SOCKS5 connect response"));return}let m=o[1];if(m!==0){let z=m===void 0?"No SOCKS5 status returned":{1:"General SOCKS server failure",2:"Connection not allowed by ruleset",3:"Network unreachable",4:"Host unreachable",5:"Connection refused",6:"TTL expired",7:"Command not supported",8:"Address type not supported"}[m]||`Unknown error (${m})`;h(Error(`SOCKS5 connection failed: ${z}`));return}h(null,{socket:i})})}isIPv4(i){if(!/^(?:\d{1,3}\.){3}\d{1,3}$/.test(i))return!1;return i.split(".").map(Number).every((n)=>n>=0&&n<=255)}isIPv6(i){return i.includes(":")&&i.split(":").length>=3}}var U;((w)=>{w[w.SOCKS4=0]="SOCKS4";w[w.SOCKS5=1]="SOCKS5"})(U||={});function Q(i){if(Array.isArray(i))return i.slice();if(typeof i==="object"&&i!==null){let h={};for(let w in i)if(Object.prototype.hasOwnProperty.call(i,w))h[w]=Q(i[w]);return h}return i}async function A(i){let h=Y+i;try{let w=await fetch(h);if(w.ok){let g=(await w.text()).match(/whois:\s+(\S+)/);if(g?.[1])return g[1]}}catch(w){console.error("Error in getting WhoIs server data from IANA",w)}return""}function N(i){if(i==="com")return"whois.verisign-grs.com";return K[i]}function _(i){let h=i.split(".");for(let w=h.length-1;w>0;w--){let n=h.slice(w).join(".");if(K[n])return n}return h[h.length-1]}function y(i){return Z[i]}class J{static iterParse(i,h){let w="",n=null,g="";for(let c=0;c<i.length;c++){let s=i[c];if(s===`
3
- `||g===":"&&s===" "){if(w.trim()in h)n=w.trim();else if(n!==null){let o=w.trim();if(o!==""){let m=h[n];if(Array.isArray(m))m.push(o);else h[n]=o;n=null}}w=""}else if(s!==":")w=w+s;if(g=s,w==="Record maintained by"||w===">>>")break}return h}static parseData(i,h){if(!h)h={"Domain Name":"","Creation Date":"","Updated Date":"","Registry Expiry Date":"","Domain Status":[],Registrar:""};return h=J.iterParse(i,h),h}}async function R(i,h,w,n,g,c){let s=new TextDecoder(g),o=new TextEncoder;if(!c){let x=new E.Socket;return x.setTimeout(30000),new Promise((z,f)=>{try{x.connect({port:n,host:w},()=>{if(h!=="")x.write(o.encode(`${h} ${i}\r
4
- `));else x.write(o.encode(`${i}\r
5
- `))}),x.on("data",(b)=>{z(s.decode(b))}),x.on("error",(b)=>{f(b)}),x.on("timeout",()=>{x.destroy(),f(Error(`WHOIS request to ${w}:${n} timed out after 30s`))})}catch(b){f(b)}})}let m={proxy:{host:c.ip,port:c.port,type:c.type===1?5:4},command:"connect",destination:{host:w,port:n}};if(c.username&&c.password)m.proxy.userId=c.username,m.proxy.password=c.password;return new Promise((x,z)=>{G.createConnection(m,(f,b)=>{if(f)z(f);else{if(!b)z(Error("No socket info received!"));if(h!=="")b?.socket.write(o.encode(`${h} ${i}\r
6
- `));else b?.socket.write(o.encode(`${i}\r
7
- `));b?.socket.on("data",($)=>{x(s.decode($))}),b?.socket.resume()}})})}async function X(i,h=!1,w=null){let n,g=43,c="",s,o="utf-8";if(!w)n=_(i),s=null;else n=w.tld?w.tld:_(i),o=w.encoding?w.encoding:"utf-8",s=w.proxy?w.proxy:null,c=w.server?w.server:"",g=w.serverPort?w.serverPort:43;if(c===""){let z=N(n);if(!z){if(q.debug(`No WhoIs server found for TLD: ${n}! Attempting IANA WhoIs database for server!`),z=await A(n),!z)return q.debug("WhoIs server could not be found!"),{_raw:"",parsedData:null};q.debug(`WhoIs sever found for ${n}: ${c}`)}c=z}let x=y(c)||"";try{q.debug(`Attempting WHOIS lookup for ${i} on server ${c}`);let z=await R(i,x,c,g,o,s);if(q.debug("Raw WHOIS data received:",z),!h){let b=J.parseData(z,null);return{_raw:z,parsedData:b}}let f=null;if(w?.parseData)f=Q(w.parseData);try{let b=J.parseData(z,f);return{_raw:z,parsedData:b}}catch(b){return console.error("Error in parsing WhoIs data!",b),{_raw:z,parsedData:null}}}catch(z){return q.debug(`Error in WHOIS lookup for ${i} on server ${c}`,z),{_raw:"",parsedData:null}}}function I(i,h=null){return q.debug(`Lookup called for ${i}`),X(i,!0,h)}async function T(i,h=!1,w=1,n=!1,g=null){let c=[];if(h){if(w>i.length)w=i.length;for(let s=0;s<i.length;s+=w){let o=i.slice(s,s+w),m=await Promise.all(o.map(async(x)=>{return await X(x,n,g)}));c.push(...m)}}else for(let s=0;s<i.length;s++){let o=await X(i[s],n,g);c.push(o)}return c}export{X as whois,R as tcpWhois,I as lookup,N as getWhoIsServer,_ as getTLD,y as getParameters,A as findWhoIsServer,T as batchWhois,J as WhoIsParser,G as SocksClient,K as SERVERS,U as ProxyType,Z as PARAMETERS,Y as IANA_CHK_URL};
package/dist/socks.d.ts DELETED
@@ -1,33 +0,0 @@
1
- import Net from 'node:net';
2
- export declare interface SocksProxy {
3
- host: string
4
- port: number
5
- type: 4 | 5
6
- userId?: string
7
- password?: string
8
- }
9
- export declare interface SocksDestination {
10
- host: string
11
- port: number
12
- }
13
- export declare interface SocksClientOptions {
14
- proxy: SocksProxy
15
- command: 'connect' | 'bind' | 'associate'
16
- destination: SocksDestination
17
- }
18
- export declare interface SocksClientEstablishedEvent {
19
- socket: Net.Socket
20
- remoteHost?: string
21
- remotePort?: number
22
- }
23
- /**
24
- * Native SOCKS client implementation
25
- */
26
- export declare class SocksClient {
27
- constructor(options: SocksClientOptions);
28
- static createConnection(options: SocksClientOptions, callback: (err: Error | null, info?: SocksClientEstablishedEvent) => void): void;
29
- }
30
- export declare enum SocksVersion {
31
- SOCKS4 = 4,
32
- SOCKS5 = 5,
33
- }
package/dist/types.d.ts DELETED
@@ -1,47 +0,0 @@
1
- /**
2
- * Response returned from whois function. Contains the raw text from WhoIs server and parsed/fornatted WhoIs data (if parsed is true)
3
- *
4
- * @interface
5
- */
6
- export declare interface WhoIsResponse {
7
- _raw: string
8
- parsedData: any | null
9
- }
10
- /**
11
- * Proxy related data
12
- * @interface
13
- *
14
- */
15
- export declare interface ProxyData {
16
- ip: string
17
- port: number
18
- username?: string | null
19
- password?: string | null
20
- type: ProxyType
21
- }
22
- /**
23
- * WhoIs options
24
- * @interface
25
- */
26
- export declare interface WhoIsOptions {
27
- tld?: string | null
28
- encoding?: string | null
29
- proxy?: ProxyData | null
30
- server?: string | null
31
- serverPort?: number | null
32
- parseData?: object | null
33
- }
34
- /**
35
- * Type of the proxy. Either SOCKS4 or SOCKS5
36
- * @enum
37
- */
38
- export declare enum ProxyType {
39
- /**
40
- * SOCKS4 type of proxy
41
- */
42
- SOCKS4 = 0,
43
- /**
44
- * SOCKS5 type of proxy
45
- */
46
- SOCKS5 = 1,
47
- }
package/dist/utils.d.ts DELETED
@@ -1,7 +0,0 @@
1
- /**
2
- * Copy an Object with its values
3
- *
4
- * @param obj Object which needs to be copied
5
- * @returns A copy of the object
6
- */
7
- export declare function shallowCopy<T>(obj: T): T;