@stacksjs/whois 0.70.22 → 0.70.25

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.
@@ -0,0 +1,323 @@
1
+ export declare const IANA_CHK_URL: string;
2
+ export declare const PARAMETERS: {
3
+ 'whois.denic.de': '-T dn,ace';
4
+ 'whois.nic.fr': '-V Md5.2'
5
+ };
6
+ export declare const SERVERS: {
7
+ 'br.com': 'whois.centralnic.net';
8
+ 'cn.com': 'whois.centralnic.net';
9
+ 'de.com': 'whois.centralnic.net';
10
+ 'eu.com': 'whois.centralnic.net';
11
+ 'gb.com': 'whois.centralnic.net';
12
+ 'gb.net': 'whois.centralnic.net';
13
+ 'gr.com': 'whois.centralnic.net';
14
+ 'hu.com': 'whois.centralnic.net';
15
+ 'in.net': 'whois.centralnic.net';
16
+ 'no.com': 'whois.centralnic.net';
17
+ 'qc.com': 'whois.centralnic.net';
18
+ 'ru.com': 'whois.centralnic.net';
19
+ 'sa.com': 'whois.centralnic.net';
20
+ 'se.com': 'whois.centralnic.net';
21
+ 'se.net': 'whois.centralnic.net';
22
+ 'uk.com': 'whois.centralnic.net';
23
+ 'uk.net': 'whois.centralnic.net';
24
+ 'us.com': 'whois.centralnic.net';
25
+ 'uy.com': 'whois.centralnic.net';
26
+ 'za.com': 'whois.centralnic.net';
27
+ 'jpn.com': 'whois.centralnic.ne';
28
+ 'web.com': 'whois.centralnic.ne';
29
+ 'com': 'whois.verisign-grs.com';
30
+ 'za.net': 'whois.za.net';
31
+ 'net': 'whois.verisign-grs.com';
32
+ 'eu.org': 'whois.eu.org';
33
+ 'za.org': 'whois.za.org';
34
+ 'org': 'whois.pir.org';
35
+ 'llyw.cymru': 'whois.nic.llyw.cymru';
36
+ 'gov.scot': 'whois.nic.gov.scot';
37
+ 'gov.wales': 'whois.nic.gov.wales';
38
+ 'edu': 'whois.educause.edu';
39
+ 'gov': 'whois.dotgov.gov';
40
+ 'int': 'whois.iana.org';
41
+ 'e164.arpa': 'whois.ripe.net';
42
+ 'arpa': 'whois.iana.org';
43
+ 'aero': 'whois.aero';
44
+ 'asia': 'whois.nic.asia';
45
+ 'biz': 'whois.nic.biz';
46
+ 'cat': 'whois.nic.cat';
47
+ 'coop': 'whois.nic.coop';
48
+ 'info': 'whois.afilias.net';
49
+ 'jobs': 'whois.nic.jobs';
50
+ 'mobi': 'whois.afilias.net';
51
+ 'museum': 'whois.nic.museum';
52
+ 'name': 'whois.nic.name';
53
+ 'post': 'whois.dotpostregistry.net';
54
+ 'pro': 'whois.nic.pro';
55
+ 'tel': 'whois.nic.tel';
56
+ 'travel': 'whois.nic.travel';
57
+ 'xxx': 'whois.nic.xxx';
58
+ 'ac': 'whois.nic.ac';
59
+ 'ae': 'whois.aeda.net.ae';
60
+ 'af': 'whois.nic.af';
61
+ 'ag': 'whois.nic.ag';
62
+ 'ai': 'whois.nic.ai';
63
+ 'am': 'whois.amnic.net';
64
+ 'ar': 'whois.nic.ar';
65
+ 'as': 'whois.nic.as';
66
+ 'priv.at': 'whois.nic.priv.at';
67
+ 'at': 'whois.nic.at';
68
+ 'au': 'whois.auda.org.au';
69
+ 'aw': 'whois.nic.aw';
70
+ 'ax': 'whois.ax';
71
+ 'be': 'whois.dns.be';
72
+ 'bf': 'whois.registre.bf';
73
+ 'bg': 'whois.register.bg';
74
+ 'bh': 'whois.nic.bh';
75
+ 'bi': 'whois1.nic.bi';
76
+ 'bj': 'whois.nic.bj';
77
+ 'bm': 'whois.afilias-srs.net';
78
+ 'bn': 'whois.bnnic.bn';
79
+ 'bo': 'whois.nic.bo';
80
+ 'br': 'whois.registro.br';
81
+ 'by': 'whois.cctld.by';
82
+ 'bw': 'whois.nic.net.bw';
83
+ 'bz': 'whois.afilias-grs.info';
84
+ 'co.ca': 'whois.co.ca';
85
+ 'ca': 'whois.cira.ca';
86
+ 'cc': 'ccwhois.verisign-grs.com';
87
+ 'cd': 'whois.nic.cd';
88
+ 'ch': 'whois.nic.ch';
89
+ 'ci': 'whois.nic.ci';
90
+ 'cl': 'whois.nic.cl';
91
+ 'cm': 'whois.netcom.cm';
92
+ 'edu.cn': 'whois.edu.cn';
93
+ 'cn': 'whois.cnnic.cn';
94
+ 'uk.co': 'whois.uk.co';
95
+ 'co': 'whois.nic.co';
96
+ 'cr': 'whois.nic.cr';
97
+ 'cx': 'whois.nic.cx';
98
+ 'cz': 'whois.nic.cz';
99
+ 'de': 'whois.denic.de';
100
+ 'dk': 'whois.dk-hostmaster.dk';
101
+ 'dm': 'whois.dmdomains.dm';
102
+ 'do': 'whois.nic.do';
103
+ 'dz': 'whois.nic.dz';
104
+ 'ec': 'whois.nic.ec';
105
+ 'ee': 'whois.tld.ee';
106
+ 'eu': 'whois.eu';
107
+ 'fi': 'whois.fi';
108
+ 'fj': 'www.whois.fj';
109
+ 'fm': 'whois.nic.fm';
110
+ 'fo': 'whois.nic.fo';
111
+ 'fr': 'whois.nic.fr';
112
+ 'gd': 'whois.nic.gd';
113
+ 'ge': 'whois.nic.ge';
114
+ 'gf': 'whois.mediaserv.net';
115
+ 'gg': 'whois.gg';
116
+ 'gh': 'whois.nic.gh';
117
+ 'gi': 'whois2.afilias-grs.net';
118
+ 'gl': 'whois.nic.gl';
119
+ 'gp': 'whois.nic.gp';
120
+ 'gq': 'whois.dominio.gq';
121
+ 'gs': 'whois.nic.gs';
122
+ 'gy': 'whois.registry.gy';
123
+ 'hk': 'whois.hkirc.hk';
124
+ 'hm': 'whois.registry.hm';
125
+ 'hn': 'whois.nic.hn';
126
+ 'hr': 'whois.dns.hr';
127
+ 'ht': 'whois.nic.ht';
128
+ 'hu': 'whois.nic.hu';
129
+ 'id': 'whois.id';
130
+ 'ie': 'whois.weare.ie';
131
+ 'il': 'whois.isoc.org.il';
132
+ 'im': 'whois.nic.im';
133
+ 'in': 'whois.registry.in';
134
+ 'io': 'whois.nic.io';
135
+ 'iq': 'whois.cmc.iq';
136
+ 'ir': 'whois.nic.ir';
137
+ 'is': 'whois.isnic.is';
138
+ 'it': 'whois.nic.it';
139
+ 'je': 'whois.je';
140
+ 'jp': 'whois.jprs.jp';
141
+ 'ke': 'whois.kenic.or.ke';
142
+ 'kg': 'whois.kg';
143
+ 'ki': 'whois.nic.ki';
144
+ 'kn': 'whois.nic.kn';
145
+ 'kr': 'whois.kr';
146
+ 'kw': 'whois.nic.kw';
147
+ 'ky': 'whois.kyregistry.ky';
148
+ 'kz': 'whois.nic.kz';
149
+ 'la': 'whois.nic.la';
150
+ 'lb': 'whois.lbdr.org.lb';
151
+ 'lc': 'whois2.afilias-grs.net';
152
+ 'li': 'whois.nic.li';
153
+ 'lk': 'whois.nic.lk';
154
+ 'ls': 'whois.nic.ls';
155
+ 'lt': 'whois.domreg.lt';
156
+ 'lu': 'whois.dns.lu';
157
+ 'lv': 'whois.nic.lv';
158
+ 'ly': 'whois.nic.ly';
159
+ 'ma': 'whois.registre.ma';
160
+ 'md': 'whois.nic.md';
161
+ 'me': 'whois.nic.me';
162
+ 'mg': 'whois.nic.mg';
163
+ 'mk': 'whois.marnet.mk';
164
+ 'ml': 'whois.dot.ml';
165
+ 'mm': 'whois.registry.gov.mm';
166
+ 'mn': 'whois.nic.mn';
167
+ 'mq': 'whois.mediaserv.net';
168
+ 'mr': 'whois.nic.mr';
169
+ 'ms': 'whois.nic.ms';
170
+ 'mt': 'whois.nic.org.mt';
171
+ 'mu': 'whois.nic.mu';
172
+ 'mw': 'whois.nic.mw';
173
+ 'mx': 'whois.mx';
174
+ 'my': 'whois.mynic.my';
175
+ 'mz': 'whois.nic.mz';
176
+ 'na': 'whois.na-nic.com.na';
177
+ 'nc': 'whois.nc';
178
+ 'nf': 'whois.nic.nf';
179
+ 'ng': 'whois.nic.net.ng';
180
+ 'nl': 'whois.domain-registry.nl';
181
+ 'no': 'whois.norid.no';
182
+ 'nu': 'whois.iis.nu';
183
+ 'nz': 'whois.irs.net.nz';
184
+ 'om': 'whois.registry.om';
185
+ 'pe': 'kero.yachay.pe';
186
+ 'pf': 'whois.registry.pf';
187
+ 'pk': 'whois.pknic.net.pk';
188
+ 'co.pl': 'whois.co.pl';
189
+ 'pl': 'whois.dns.pl';
190
+ 'pm': 'whois.nic.pm';
191
+ 'pr': 'whois.afilias-srs.net';
192
+ 'ps': 'whois.pnina.ps';
193
+ 'pt': 'whois.dns.pt';
194
+ 'pw': 'whois.nic.pw';
195
+ 'qa': 'whois.registry.qa';
196
+ 're': 'whois.nic.re';
197
+ 'ro': 'whois.rotld.ro';
198
+ 'rs': 'whois.rnids.rs';
199
+ 'ac.ru': 'whois.free.net';
200
+ 'edu.ru': 'whois.informika.ru';
201
+ 'com.ru': 'whois.flexireg.net';
202
+ 'msk.ru': 'whois.flexireg.net';
203
+ 'net.ru': 'whois.nic.net.ru';
204
+ 'nov.ru': 'whois.flexireg.net';
205
+ 'org.ru': 'whois.nic.net.ru';
206
+ 'pp.ru': 'whois.nic.net.ru';
207
+ 'spb.ru': 'whois.flexireg.net';
208
+ 'ru': 'whois.tcinet.ru';
209
+ 'rw': 'whois.ricta.org.rw';
210
+ 'sa': 'whois.nic.net.sa';
211
+ 'sb': 'whois.nic.net.sb';
212
+ 'sc': 'whois2.afilias-grs.net';
213
+ 'sd': 'whois.sdnic.sd';
214
+ 'se': 'whois.iis.se';
215
+ 'sg': 'whois.sgnic.sg';
216
+ 'sh': 'whois.nic.sh';
217
+ 'si': 'whois.register.si';
218
+ 'sk': 'whois.sk-nic.sk';
219
+ 'sl': 'whois.nic.sl';
220
+ 'sm': 'whois.nic.sm';
221
+ 'sn': 'whois.nic.sn';
222
+ 'so': 'whois.nic.so';
223
+ 'ss': 'whois.nic.ss';
224
+ 'st': 'whois.nic.st';
225
+ 'msk.su': 'whois.flexireg.net';
226
+ 'nov.su': 'whois.flexireg.net';
227
+ 'spb.su': 'whois.flexireg.net';
228
+ 'su': 'whois.tcinet.ru';
229
+ 'sx': 'whois.sx';
230
+ 'sy': 'whois.tld.sy';
231
+ 'tc': 'whois.nic.tc';
232
+ 'td': 'whois.nic.td';
233
+ 'tf': 'whois.nic.tf';
234
+ 'tg': 'whois.nic.tg';
235
+ 'th': 'whois.thnic.co.th';
236
+ 'tk': 'whois.dot.tk';
237
+ 'tl': 'whois.nic.tl';
238
+ 'tm': 'whois.nic.tm';
239
+ 'tn': 'whois.ati.tn';
240
+ 'to': 'whois.tonic.to';
241
+ 'tr': 'whois.trabis.gov.tr';
242
+ 'tv': 'whois.nic.tv';
243
+ 'tw': 'whois.twnic.net.tw';
244
+ 'tz': 'whois.tznic.or.tz';
245
+ 'biz.ua': 'whois.biz.ua';
246
+ 'co.ua': 'whois.co.ua';
247
+ 'pp.ua': 'whois.pp.ua';
248
+ 'ua': 'whois.ua';
249
+ 'ug': 'whois.co.ug';
250
+ 'ac.uk': 'whois.nic.ac.uk';
251
+ 'gov.uk': 'whois.gov.uk';
252
+ 'uk': 'whois.nic.uk';
253
+ 'fed.us': 'whois.nic.gov';
254
+ 'us': 'whois.nic.us';
255
+ 'uy': 'whois.nic.org.uy';
256
+ 'uz': 'whois.cctld.uz';
257
+ 'vc': 'whois2.afilias-grs.net';
258
+ 've': 'whois.nic.ve';
259
+ 'vg': 'whois.nic.vg';
260
+ 'vu': 'whois.dnrs.vu';
261
+ 'wf': 'whois.nic.wf';
262
+ 'ws': 'whois.website.ws';
263
+ 'yt': 'whois.nic.yt';
264
+ 'ac.za': 'whois.ac.za';
265
+ 'co.za': 'whois.registry.net.za';
266
+ 'gov.za': 'whois.gov.za';
267
+ 'net.za': 'net-whois.registry.net.za';
268
+ 'org.za': 'org-whois.registry.net.za';
269
+ 'web.za': 'web-whois.registry.net.za';
270
+ 'zm': 'whois.zicta.zm';
271
+ 'xn--2scrj9c': 'whois.registry.in';
272
+ 'xn--3e0b707e': 'whois.kr';
273
+ 'xn--3hcrj9c': 'whois.registry.in';
274
+ 'xn--45br5cyl': 'whois.registry.in';
275
+ 'xn--45brj9c': 'whois.registry.in';
276
+ 'xn--4dbrk0ce': 'whois.isoc.org.il';
277
+ 'xn--80ao21a': 'whois.nic.kz';
278
+ 'xn--90a3ac': 'whois.rnids.rs';
279
+ 'xn--90ae': 'whois.imena.bg';
280
+ 'xn--90ais': 'whois.cctld.by';
281
+ 'xn--clchc0ea0b2g2a9gcd': 'whois.sgnic.sg';
282
+ 'xn--d1alf': 'whois.marnet.mk';
283
+ 'xn--e1a4c': 'whois.eu';
284
+ 'xn--fiqs8s': 'cwhois.cnnic.cn';
285
+ 'xn--fiqz9s': 'cwhois.cnnic.cn';
286
+ 'xn--fpcrj9c3d': 'whois.registry.in';
287
+ 'xn--fzc2c9e2c': 'whois.nic.lk';
288
+ 'xn--gecrj9c': 'whois.registry.in';
289
+ 'xn--h2breg3eve': 'whois.registry.in';
290
+ 'xn--h2brj9c8c': 'whois.registry.in';
291
+ 'xn--h2brj9c': 'whois.registry.in';
292
+ 'xn--j1amh': 'whois.dotukr.com';
293
+ 'xn--j6w193g': 'whois.hkirc.hk';
294
+ 'xn--kprw13d': 'whois.twnic.net.tw';
295
+ 'xn--kpry57d': 'whois.twnic.net.tw';
296
+ 'xn--lgbbat1ad8j': 'whois.nic.dz';
297
+ 'xn--mgb9awbf': 'whois.registry.om';
298
+ 'xn--mgba3a4f16a': 'whois.nic.ir';
299
+ 'xn--mgbaam7a8h': 'whois.aeda.net.ae';
300
+ 'xn--mgbah1a3hjkrd': 'whois.nic.mr';
301
+ 'xn--mgbbh1a71e': 'whois.registry.in';
302
+ 'xn--mgbbh1a': 'whois.registry.in';
303
+ 'xn--mgberp4a5d4ar': 'whois.nic.net.sa';
304
+ 'xn--mgbgu82a': 'whois.registry.in';
305
+ 'xn--mgbtx2b': 'whois.cmc.iq';
306
+ 'xn--mgbx4cd0ab': 'whois.mynic.my';
307
+ 'xn--node': 'whois.itdc.ge';
308
+ 'xn--o3cw4h': 'whois.thnic.co.th';
309
+ 'xn--ogbpf8fl': 'whois.tld.sy';
310
+ 'xn--p1ai': 'whois.tcinet.ru';
311
+ 'xn--pgbs0dh': 'whois.ati.tn';
312
+ 'xn--q7ce6a': 'whois.nic.la';
313
+ 'xn--qxa6a': 'whois.eu';
314
+ 'xn--rvc1e0am3e': 'whois.registry.in';
315
+ 'xn--s9brj9c': 'whois.registry.in';
316
+ 'xn--wgbh1c': 'whois.dotmasr.eg';
317
+ 'xn--wgbl6a': 'whois.registry.qa';
318
+ 'xn--xkc2al3hye2a': 'whois.nic.lk';
319
+ 'xn--xkc2dl3a5ee0h': 'whois.registry.in';
320
+ 'xn--y9a3aq': 'whois.amnic.net';
321
+ 'xn--yfro4i67o': 'whois.sgnic.sg';
322
+ 'xn--ygbi2ammx': 'whois.pnina.ps'
323
+ };
@@ -0,0 +1,76 @@
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';
@@ -0,0 +1,33 @@
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
+ }
@@ -1,11 +1,17 @@
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
+ */
1
6
  export declare interface WhoIsResponse {
2
7
  _raw: string
3
8
  parsedData: any | null
4
9
  }
5
- export declare enum ProxyType {
6
- SOCKS4 = 0,
7
- SOCKS5 = 1,
8
- }
10
+ /**
11
+ * Proxy related data
12
+ * @interface
13
+ *
14
+ */
9
15
  export declare interface ProxyData {
10
16
  ip: string
11
17
  port: number
@@ -13,12 +19,29 @@ export declare interface ProxyData {
13
19
  password?: string | null
14
20
  type: ProxyType
15
21
  }
22
+ /**
23
+ * WhoIs options
24
+ * @interface
25
+ */
16
26
  export declare interface WhoIsOptions {
17
27
  tld?: string | null
18
28
  encoding?: string | null
19
-
20
29
  proxy?: ProxyData | null
21
30
  server?: string | null
22
31
  serverPort?: number | null
23
32
  parseData?: object | null
24
- }
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/package.json CHANGED
@@ -1,10 +1,12 @@
1
1
  {
2
2
  "name": "@stacksjs/whois",
3
3
  "type": "module",
4
- "version": "0.70.22",
4
+ "version": "0.70.25",
5
5
  "description": "Easily get whois info.",
6
6
  "author": "Chris Breuer",
7
- "contributors": ["Chris Breuer <chris@stacksjs.org>"],
7
+ "contributors": [
8
+ "Chris Breuer <chris@stacksjs.com>"
9
+ ],
8
10
  "license": "MIT",
9
11
  "funding": "https://github.com/sponsors/chrisbbreuer",
10
12
  "homepage": "https://github.com/stacksjs/stacks/tree/main/storage/framework/core/whois#readme",
@@ -27,15 +29,20 @@
27
29
  ],
28
30
  "exports": {
29
31
  ".": {
32
+ "bun": "./src/index.ts",
30
33
  "types": "./dist/index.d.ts",
31
34
  "import": "./dist/index.js"
32
35
  },
33
36
  "./*": {
37
+ "bun": "./src/*",
34
38
  "import": "./dist/*"
35
39
  }
36
40
  },
37
41
  "types": "./dist/index.d.ts",
38
- "files": ["README.md", "dist"],
42
+ "files": [
43
+ "README.md",
44
+ "dist"
45
+ ],
39
46
  "scripts": {
40
47
  "build": "bun build.ts",
41
48
  "typecheck": "bun tsc --noEmit",
@@ -43,8 +50,6 @@
43
50
  "prepublishOnly": "bun run build"
44
51
  },
45
52
  "devDependencies": {
46
- "@stacksjs/development": "0.70.18",
47
- "node-fetch": "^3.3.2",
48
- "socks": "^2.8.4"
53
+ "better-dx": "^0.2.12"
49
54
  }
50
55
  }
@@ -1,3 +0,0 @@
1
- export declare const IANA_CHK_URL: string;
2
- export declare const PARAMETERS: Record<string, string>;
3
- export declare const SERVERS: Record<string, string>;
package/dist/index.d.ts DELETED
@@ -1,71 +0,0 @@
1
- import type { ProxyData, WhoIsOptions, WhoIsResponse } from './types';
2
- import type { SocksClientOptions } from 'socks';
3
- import { SocksClient } from 'socks';
4
-
5
- export type { SocksClientOptions } from 'socks'
6
- export declare function findWhoIsServer(tld: string): Promise<string>;
7
- export declare function getWhoIsServer(tld: keyof typeof SERVERS): string | undefined;
8
- export declare function getTLD(domain: string): keyof typeof SERVERS;
9
- export declare function getParameters(server: string): string | undefined;
10
- export declare class WhoIsParser {
11
- private static iterParse(rawData: string, outputData: any) {
12
- let lastStr = ''
13
- let lastField: string | null = null
14
- let lastLetter = ''
15
-
16
- for (let i = 0; i < rawData.length; i++) {
17
- const letter = rawData[i]
18
- if (letter === '\n' || (lastLetter === ':' && letter === ' ')) {
19
- if (lastStr.trim() in outputData) {
20
- lastField = lastStr.trim()
21
- }
22
- else if (lastField !== null) {
23
- const x = lastStr.trim()
24
- if (x !== '') {
25
- const obj = outputData[lastField]
26
- if (Array.isArray(obj))
27
- obj.push(x)
28
- else outputData[lastField] = x
29
-
30
- lastField = null
31
- }
32
- }
33
- lastStr = ''
34
- }
35
- else if (letter !== ':') {
36
- lastStr = lastStr + letter
37
- }
38
- lastLetter = letter as string
39
- if (lastStr === 'Record maintained by' || lastStr === '>>>')
40
- break
41
- }
42
-
43
- return outputData
44
- }
45
-
46
- public static parseData(rawData: string, outputData: any | null): any {
47
- if (!outputData) {
48
- outputData = {
49
- 'Domain Name': '',
50
- 'Creation Date': '',
51
- 'Updated Date': '',
52
- 'Registry Expiry Date': '',
53
- 'Domain Status': [],
54
- 'Registrar': '',
55
- }
56
- }
57
-
58
- outputData = WhoIsParser.iterParse(rawData, outputData)
59
-
60
- return outputData
61
- }
62
- }
63
- export declare function tcpWhois(domain: string, queryOptions: string, server: string, port: number, encoding: string, proxy: ProxyData | null): Promise<string>;
64
- export declare function whois(domain: string, parse, options: WhoIsOptions | null): Promise<WhoIsResponse>;
65
- export declare function lookup(domain: string, options: WhoIsOptions | null): Promise<WhoIsResponse>;
66
- export declare function batchWhois(domains: string[], parallel, threads, parse, options: WhoIsOptions | null): Promise<WhoIsResponse[]>;
67
-
68
- export { SocksClient } from 'socks'
69
-
70
- export * from './constants'
71
- export * from './types'
package/dist/utils.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare function shallowCopy<T>(obj: T): T;