recker 1.0.15-next.905f0e7 → 1.0.15-next.b59c9d1
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/README.md +10 -1
- package/dist/ai/providers/anthropic.d.ts.map +1 -1
- package/dist/ai/providers/anthropic.js +4 -1
- package/dist/ai/providers/base.d.ts.map +1 -1
- package/dist/ai/providers/base.js +7 -2
- package/dist/ai/rate-limiter.d.ts.map +1 -1
- package/dist/ai/rate-limiter.js +4 -1
- package/dist/bench/generator.d.ts.map +1 -1
- package/dist/bench/generator.js +7 -3
- package/dist/bench/stats.d.ts.map +1 -1
- package/dist/bench/stats.js +43 -10
- package/dist/cache/memory-storage.d.ts.map +1 -1
- package/dist/cache/memory-storage.js +3 -2
- package/dist/cli/handler.js +14 -14
- package/dist/cli/index.js +582 -49
- package/dist/cli/presets.js +5 -5
- package/dist/cli/tui/ai-chat.js +10 -10
- package/dist/cli/tui/load-dashboard.d.ts.map +1 -1
- package/dist/cli/tui/load-dashboard.js +96 -55
- package/dist/cli/tui/scroll-buffer.d.ts +1 -1
- package/dist/cli/tui/scroll-buffer.d.ts.map +1 -1
- package/dist/cli/tui/scroll-buffer.js +2 -2
- package/dist/cli/tui/shell.d.ts +3 -0
- package/dist/cli/tui/shell.d.ts.map +1 -1
- package/dist/cli/tui/shell.js +166 -4
- package/dist/cli/tui/websocket.js +17 -17
- package/dist/core/client.d.ts.map +1 -1
- package/dist/core/client.js +18 -26
- package/dist/core/errors.d.ts +109 -1
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +214 -1
- package/dist/core/request-promise.d.ts.map +1 -1
- package/dist/core/request-promise.js +5 -6
- package/dist/core/response.d.ts.map +1 -1
- package/dist/core/response.js +5 -6
- package/dist/dns/propagation.d.ts +3 -1
- package/dist/dns/propagation.d.ts.map +1 -1
- package/dist/dns/propagation.js +99 -59
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/mcp/client.d.ts.map +1 -1
- package/dist/mcp/client.js +10 -11
- package/dist/mcp/embeddings-loader.d.ts.map +1 -1
- package/dist/mcp/embeddings-loader.js +12 -2
- package/dist/mcp/geoip-loader.d.ts +11 -0
- package/dist/mcp/geoip-loader.d.ts.map +1 -0
- package/dist/mcp/geoip-loader.js +107 -0
- package/dist/mcp/ip-intel.d.ts +28 -0
- package/dist/mcp/ip-intel.d.ts.map +1 -0
- package/dist/mcp/ip-intel.js +209 -0
- package/dist/mcp/search/hybrid-search.d.ts.map +1 -1
- package/dist/mcp/search/hybrid-search.js +5 -1
- package/dist/mcp/search/math.d.ts.map +1 -1
- package/dist/mcp/search/math.js +5 -1
- package/dist/mcp/server.d.ts +4 -0
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +114 -1
- package/dist/plugins/compression.js +4 -2
- package/dist/plugins/har-player.d.ts.map +1 -1
- package/dist/plugins/har-player.js +8 -11
- package/dist/plugins/odata.d.ts.map +1 -1
- package/dist/plugins/odata.js +5 -2
- package/dist/protocols/ftp.d.ts.map +1 -1
- package/dist/protocols/ftp.js +69 -16
- package/dist/protocols/sftp.d.ts.map +1 -1
- package/dist/protocols/sftp.js +13 -3
- package/dist/protocols/telnet.d.ts.map +1 -1
- package/dist/protocols/telnet.js +25 -6
- package/dist/transport/base-udp.d.ts.map +1 -1
- package/dist/transport/base-udp.js +7 -4
- package/dist/transport/udp-response.d.ts.map +1 -1
- package/dist/transport/udp-response.js +10 -3
- package/dist/transport/udp.d.ts.map +1 -1
- package/dist/transport/udp.js +5 -1
- package/dist/transport/undici.d.ts.map +1 -1
- package/dist/transport/undici.js +75 -63
- package/dist/utils/agent-manager.d.ts +1 -0
- package/dist/utils/agent-manager.d.ts.map +1 -1
- package/dist/utils/agent-manager.js +11 -0
- package/dist/utils/client-pool.d.ts.map +1 -1
- package/dist/utils/client-pool.js +4 -1
- package/dist/utils/dns-toolkit.d.ts +88 -1
- package/dist/utils/dns-toolkit.d.ts.map +1 -1
- package/dist/utils/dns-toolkit.js +704 -6
- package/dist/utils/doh.d.ts.map +1 -1
- package/dist/utils/doh.js +13 -16
- package/dist/utils/download.d.ts.map +1 -1
- package/dist/utils/download.js +10 -11
- package/dist/utils/rdap.d.ts +9 -0
- package/dist/utils/rdap.d.ts.map +1 -1
- package/dist/utils/rdap.js +78 -9
- package/dist/utils/security-grader.d.ts +47 -0
- package/dist/utils/security-grader.d.ts.map +1 -0
- package/dist/utils/security-grader.js +637 -0
- package/dist/utils/sparkline.d.ts +18 -0
- package/dist/utils/sparkline.d.ts.map +1 -0
- package/dist/utils/sparkline.js +55 -0
- package/dist/utils/sse.d.ts.map +1 -1
- package/dist/utils/sse.js +5 -6
- package/dist/utils/system-metrics.d.ts +26 -0
- package/dist/utils/system-metrics.d.ts.map +1 -0
- package/dist/utils/system-metrics.js +81 -0
- package/dist/webrtc/index.d.ts.map +1 -1
- package/dist/webrtc/index.js +21 -7
- package/dist/websocket/client.d.ts.map +1 -1
- package/dist/websocket/client.js +13 -16
- package/package.json +3 -2
package/dist/transport/undici.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { request as undiciRequest, errors as undiciErrors, ProxyAgent, Agent, Client } from 'undici';
|
|
2
2
|
import { HttpResponse } from '../core/response.js';
|
|
3
|
-
import { NetworkError, TimeoutError,
|
|
3
|
+
import { NetworkError, TimeoutError, MaxSizeExceededError } from '../core/errors.js';
|
|
4
4
|
import { performance } from 'perf_hooks';
|
|
5
5
|
import { AsyncLocalStorage } from 'async_hooks';
|
|
6
6
|
import { channel } from 'node:diagnostics_channel';
|
|
@@ -303,7 +303,7 @@ export class UndiciTransport {
|
|
|
303
303
|
connectTimeout: timeouts.connectTimeout,
|
|
304
304
|
headersTimeout: timeouts.headersTimeout,
|
|
305
305
|
bodyTimeout: timeouts.bodyTimeout,
|
|
306
|
-
maxRedirections:
|
|
306
|
+
maxRedirections: 0,
|
|
307
307
|
};
|
|
308
308
|
if (finalBody && (finalBody instanceof ReadableStream ||
|
|
309
309
|
(typeof finalBody.pipe === 'function') ||
|
|
@@ -347,39 +347,49 @@ export class UndiciTransport {
|
|
|
347
347
|
}
|
|
348
348
|
const statusCode = undiciResponse.statusCode;
|
|
349
349
|
const isRedirect = statusCode >= 300 && statusCode < 400;
|
|
350
|
-
if (
|
|
350
|
+
if (isRedirect && followRedirects && redirectCount < maxRedirects) {
|
|
351
351
|
const locationHeader = undiciResponse.headers['location'];
|
|
352
352
|
const location = Array.isArray(locationHeader) ? locationHeader[0] : locationHeader;
|
|
353
353
|
if (location) {
|
|
354
354
|
const nextUrl = new URL(location, currentUrl).toString();
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
if (
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
355
|
+
if (handleRedirectsManually) {
|
|
356
|
+
const responseHeaders = new Headers();
|
|
357
|
+
for (const [key, value] of Object.entries(undiciResponse.headers)) {
|
|
358
|
+
if (value !== undefined) {
|
|
359
|
+
if (Array.isArray(value)) {
|
|
360
|
+
value.forEach(v => responseHeaders.append(key, v));
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
responseHeaders.set(key, value);
|
|
364
|
+
}
|
|
363
365
|
}
|
|
364
366
|
}
|
|
367
|
+
const redirectInfo = {
|
|
368
|
+
from: currentUrl,
|
|
369
|
+
to: nextUrl,
|
|
370
|
+
status: statusCode,
|
|
371
|
+
headers: responseHeaders,
|
|
372
|
+
};
|
|
373
|
+
const hookResult = await req.beforeRedirect(redirectInfo);
|
|
374
|
+
if (hookResult === false) {
|
|
375
|
+
const finalResponse = req.onDownloadProgress
|
|
376
|
+
? wrapDownloadResponse(undiciResponse, req.onDownloadProgress)
|
|
377
|
+
: undiciResponse;
|
|
378
|
+
return new HttpResponse(finalResponse, {
|
|
379
|
+
timings: requestContext.timings,
|
|
380
|
+
connection: requestContext.connection
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
if (typeof hookResult === 'string') {
|
|
384
|
+
currentUrl = hookResult;
|
|
385
|
+
}
|
|
386
|
+
else {
|
|
387
|
+
currentUrl = nextUrl;
|
|
388
|
+
}
|
|
365
389
|
}
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
to: nextUrl,
|
|
369
|
-
status: statusCode,
|
|
370
|
-
headers: responseHeaders,
|
|
371
|
-
};
|
|
372
|
-
const hookResult = await req.beforeRedirect(redirectInfo);
|
|
373
|
-
if (hookResult === false) {
|
|
374
|
-
const finalResponse = req.onDownloadProgress
|
|
375
|
-
? wrapDownloadResponse(undiciResponse, req.onDownloadProgress)
|
|
376
|
-
: undiciResponse;
|
|
377
|
-
return new HttpResponse(finalResponse, {
|
|
378
|
-
timings: requestContext.timings,
|
|
379
|
-
connection: requestContext.connection
|
|
380
|
-
});
|
|
390
|
+
else {
|
|
391
|
+
currentUrl = nextUrl;
|
|
381
392
|
}
|
|
382
|
-
currentUrl = typeof hookResult === 'string' ? hookResult : nextUrl;
|
|
383
393
|
if (statusCode === 303 || ((statusCode === 301 || statusCode === 302) && currentMethod !== 'GET' && currentMethod !== 'HEAD')) {
|
|
384
394
|
currentMethod = 'GET';
|
|
385
395
|
currentBody = null;
|
|
@@ -437,11 +447,7 @@ export class UndiciTransport {
|
|
|
437
447
|
}
|
|
438
448
|
const code = error.code || error?.cause?.code;
|
|
439
449
|
if (code === 'UND_ERR_HEADERS_OVERFLOW') {
|
|
440
|
-
throw new
|
|
441
|
-
'Reduce response header size or adjust maxHeaderSize in agent configuration.',
|
|
442
|
-
'Check for runaway set-cookie or debug headers.',
|
|
443
|
-
'Verify upstream is not sending excessive headers.'
|
|
444
|
-
], false);
|
|
450
|
+
throw new MaxSizeExceededError(16 * 1024, undefined, req);
|
|
445
451
|
}
|
|
446
452
|
throw new NetworkError(error.message, code, req);
|
|
447
453
|
}
|
|
@@ -518,7 +524,7 @@ export class UndiciTransport {
|
|
|
518
524
|
connectTimeout: timeouts.connectTimeout,
|
|
519
525
|
headersTimeout: timeouts.headersTimeout,
|
|
520
526
|
bodyTimeout: timeouts.bodyTimeout,
|
|
521
|
-
maxRedirections:
|
|
527
|
+
maxRedirections: 0,
|
|
522
528
|
};
|
|
523
529
|
if (finalBody && (finalBody instanceof ReadableStream ||
|
|
524
530
|
(typeof finalBody.pipe === 'function') ||
|
|
@@ -562,39 +568,49 @@ export class UndiciTransport {
|
|
|
562
568
|
}
|
|
563
569
|
const statusCode = undiciResponse.statusCode;
|
|
564
570
|
const isRedirect = statusCode >= 300 && statusCode < 400;
|
|
565
|
-
if (
|
|
571
|
+
if (isRedirect && followRedirects && redirectCount < maxRedirects) {
|
|
566
572
|
const locationHeader = undiciResponse.headers['location'];
|
|
567
573
|
const location = Array.isArray(locationHeader) ? locationHeader[0] : locationHeader;
|
|
568
574
|
if (location) {
|
|
569
575
|
const nextUrl = new URL(location, currentUrl).toString();
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
if (
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
576
|
+
if (handleRedirectsManually) {
|
|
577
|
+
const responseHeaders = new Headers();
|
|
578
|
+
for (const [key, value] of Object.entries(undiciResponse.headers)) {
|
|
579
|
+
if (value !== undefined) {
|
|
580
|
+
if (Array.isArray(value)) {
|
|
581
|
+
value.forEach(v => responseHeaders.append(key, v));
|
|
582
|
+
}
|
|
583
|
+
else {
|
|
584
|
+
responseHeaders.set(key, value);
|
|
585
|
+
}
|
|
578
586
|
}
|
|
579
587
|
}
|
|
588
|
+
const redirectInfo = {
|
|
589
|
+
from: currentUrl,
|
|
590
|
+
to: nextUrl,
|
|
591
|
+
status: statusCode,
|
|
592
|
+
headers: responseHeaders,
|
|
593
|
+
};
|
|
594
|
+
const hookResult = await req.beforeRedirect(redirectInfo);
|
|
595
|
+
if (hookResult === false) {
|
|
596
|
+
const finalResponse = req.onDownloadProgress
|
|
597
|
+
? wrapDownloadResponse(undiciResponse, req.onDownloadProgress)
|
|
598
|
+
: undiciResponse;
|
|
599
|
+
return new HttpResponse(finalResponse, {
|
|
600
|
+
timings: {},
|
|
601
|
+
connection: {}
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
if (typeof hookResult === 'string') {
|
|
605
|
+
currentUrl = hookResult;
|
|
606
|
+
}
|
|
607
|
+
else {
|
|
608
|
+
currentUrl = nextUrl;
|
|
609
|
+
}
|
|
580
610
|
}
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
to: nextUrl,
|
|
584
|
-
status: statusCode,
|
|
585
|
-
headers: responseHeaders,
|
|
586
|
-
};
|
|
587
|
-
const hookResult = await req.beforeRedirect(redirectInfo);
|
|
588
|
-
if (hookResult === false) {
|
|
589
|
-
const finalResponse = req.onDownloadProgress
|
|
590
|
-
? wrapDownloadResponse(undiciResponse, req.onDownloadProgress)
|
|
591
|
-
: undiciResponse;
|
|
592
|
-
return new HttpResponse(finalResponse, {
|
|
593
|
-
timings: {},
|
|
594
|
-
connection: {}
|
|
595
|
-
});
|
|
611
|
+
else {
|
|
612
|
+
currentUrl = nextUrl;
|
|
596
613
|
}
|
|
597
|
-
currentUrl = typeof hookResult === 'string' ? hookResult : nextUrl;
|
|
598
614
|
if (statusCode === 303 || ((statusCode === 301 || statusCode === 302) && currentMethod !== 'GET' && currentMethod !== 'HEAD')) {
|
|
599
615
|
currentMethod = 'GET';
|
|
600
616
|
currentBody = null;
|
|
@@ -644,11 +660,7 @@ export class UndiciTransport {
|
|
|
644
660
|
}
|
|
645
661
|
const code = error.code || error?.cause?.code;
|
|
646
662
|
if (code === 'UND_ERR_HEADERS_OVERFLOW') {
|
|
647
|
-
throw new
|
|
648
|
-
'Reduce response header size or adjust maxHeaderSize in agent configuration.',
|
|
649
|
-
'Check for runaway set-cookie or debug headers.',
|
|
650
|
-
'Verify upstream is not sending excessive headers.'
|
|
651
|
-
], false);
|
|
663
|
+
throw new MaxSizeExceededError(16 * 1024, undefined, req);
|
|
652
664
|
}
|
|
653
665
|
throw new NetworkError(error.message, code, req);
|
|
654
666
|
}
|
|
@@ -14,6 +14,7 @@ export declare class AgentManager {
|
|
|
14
14
|
getAgentForDomain(domain: string, options?: Partial<AgentOptions>): Agent;
|
|
15
15
|
getAgentForUrl(url: string): Agent;
|
|
16
16
|
createBatchAgent(concurrency: number, requestCount: number, options?: Partial<AgentOptions>): Agent;
|
|
17
|
+
createStressTestAgent(concurrency: number): Agent;
|
|
17
18
|
private createAgent;
|
|
18
19
|
getStats(): AgentStats;
|
|
19
20
|
closeDomainAgent(domain: string): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-manager.d.ts","sourceRoot":"","sources":["../../src/utils/agent-manager.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,WAAW,UAAU;IAEzB,UAAU,EAAE,MAAM,CAAC;IAGnB,OAAO,EAAE,MAAM,EAAE,CAAC;IAGlB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAOD,qBAAa,YAAY;IACvB,OAAO,CAAC,WAAW,CAAC,CAAQ;IAC5B,OAAO,CAAC,YAAY,CAAqB;IACzC,OAAO,CAAC,OAAO,CAAoJ;gBAEvJ,OAAO,GAAE,YAAiB;IAsBtC,cAAc,IAAI,KAAK;IAavB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,KAAK;IAkBzE,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK;IAmBlC,gBAAgB,CACd,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAC9B,KAAK;
|
|
1
|
+
{"version":3,"file":"agent-manager.d.ts","sourceRoot":"","sources":["../../src/utils/agent-manager.ts"],"names":[],"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GAAG,CAAC,MAAM,CAAC,CAAA;CAAE,CAcxD"}
|
|
@@ -61,6 +61,17 @@ export class AgentManager {
|
|
|
61
61
|
};
|
|
62
62
|
return this.createAgent(batchOptions);
|
|
63
63
|
}
|
|
64
|
+
createStressTestAgent(concurrency) {
|
|
65
|
+
const pipelining = 10;
|
|
66
|
+
const connections = Math.min(Math.ceil(concurrency / pipelining), 100);
|
|
67
|
+
return this.createAgent({
|
|
68
|
+
connections,
|
|
69
|
+
pipelining,
|
|
70
|
+
keepAliveTimeout: 30000,
|
|
71
|
+
keepAliveMaxTimeout: 120000,
|
|
72
|
+
connectTimeout: 5000,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
64
75
|
createAgent(options) {
|
|
65
76
|
return new Agent({
|
|
66
77
|
connections: options.connections,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-pool.d.ts","sourceRoot":"","sources":["../../src/utils/client-pool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"client-pool.d.ts","sourceRoot":"","sources":["../../src/utils/client-pool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAyB/D,qBAAa,UAAU;IACrB,OAAO,CAAC,IAAI,CAAkC;IAC9C,OAAO,CAAC,cAAc,CAAyC;gBAEnD,OAAO,GAAE,IAAI,CAAC,qBAAqB,EAAE,SAAS,CAAM;IAQhE,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAiB5B,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAO7B,IAAI,IAAI,IAAI,MAAM,CAEjB;IAKD,KAAK,IAAI,IAAI;IAOb,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAmB1B,KAAK,CAAC,CAAC,GAAG,OAAO,EACrB,QAAQ,EAAE,KAAK,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACnC,CAAC,GACD,OAAO,CAAC,CAAC,EAAE,CAAC;CAgBhB;AAcD,eAAO,MAAM,UAAU,YAAmB,CAAC;AAW3C,wBAAgB,eAAe,CAAC,OAAO,GAAE,IAAI,CAAC,qBAAqB,EAAE,SAAS,GAAG,OAAO,CAAM,GAAG,UAAU,CAK1G"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Client } from '../core/client.js';
|
|
2
|
+
import { UnsupportedError } from '../core/errors.js';
|
|
2
3
|
export class ClientPool {
|
|
3
4
|
pool = new Map();
|
|
4
5
|
defaultOptions;
|
|
@@ -33,7 +34,9 @@ export class ClientPool {
|
|
|
33
34
|
const client = this.get(baseUrl);
|
|
34
35
|
const methodFn = client[method.toLowerCase()];
|
|
35
36
|
if (typeof methodFn !== 'function') {
|
|
36
|
-
throw new
|
|
37
|
+
throw new UnsupportedError(`Unknown HTTP method: ${method}`, {
|
|
38
|
+
feature: method,
|
|
39
|
+
});
|
|
37
40
|
}
|
|
38
41
|
return methodFn.call(client, path, options).json();
|
|
39
42
|
});
|
|
@@ -1,13 +1,100 @@
|
|
|
1
|
+
export interface DigOptions {
|
|
2
|
+
server?: string;
|
|
3
|
+
short?: boolean;
|
|
4
|
+
type?: string;
|
|
5
|
+
reverse?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface DigResult {
|
|
8
|
+
question: {
|
|
9
|
+
name: string;
|
|
10
|
+
type: string;
|
|
11
|
+
class: string;
|
|
12
|
+
};
|
|
13
|
+
answer: Array<{
|
|
14
|
+
name: string;
|
|
15
|
+
type: string;
|
|
16
|
+
class: string;
|
|
17
|
+
ttl: number;
|
|
18
|
+
data: string;
|
|
19
|
+
}>;
|
|
20
|
+
server: string;
|
|
21
|
+
queryTime: number;
|
|
22
|
+
when: Date;
|
|
23
|
+
}
|
|
1
24
|
export interface DnsSecurityRecords {
|
|
2
25
|
spf?: string[];
|
|
3
26
|
dmarc?: string;
|
|
27
|
+
dkim?: string;
|
|
4
28
|
caa?: {
|
|
5
29
|
issue?: string[];
|
|
6
30
|
issuewild?: string[];
|
|
7
31
|
iodef?: string;
|
|
8
32
|
};
|
|
9
|
-
mx?:
|
|
33
|
+
mx?: Array<{
|
|
34
|
+
priority: number;
|
|
35
|
+
exchange: string;
|
|
36
|
+
}>;
|
|
10
37
|
txt?: string[];
|
|
11
38
|
}
|
|
39
|
+
export interface DnsLookupResult {
|
|
40
|
+
type: string;
|
|
41
|
+
ttl?: number;
|
|
42
|
+
data: string | object;
|
|
43
|
+
}
|
|
44
|
+
export interface DnsHealthReport {
|
|
45
|
+
domain: string;
|
|
46
|
+
score: number;
|
|
47
|
+
grade: string;
|
|
48
|
+
checks: Array<{
|
|
49
|
+
name: string;
|
|
50
|
+
status: 'pass' | 'warn' | 'fail';
|
|
51
|
+
message: string;
|
|
52
|
+
details?: any;
|
|
53
|
+
}>;
|
|
54
|
+
}
|
|
55
|
+
export interface SpfValidation {
|
|
56
|
+
valid: boolean;
|
|
57
|
+
record?: string;
|
|
58
|
+
mechanisms: string[];
|
|
59
|
+
includes: string[];
|
|
60
|
+
lookupCount: number;
|
|
61
|
+
warnings: string[];
|
|
62
|
+
errors: string[];
|
|
63
|
+
}
|
|
64
|
+
export interface DmarcValidation {
|
|
65
|
+
valid: boolean;
|
|
66
|
+
record?: string;
|
|
67
|
+
policy: string;
|
|
68
|
+
subdomainPolicy?: string;
|
|
69
|
+
percentage: number;
|
|
70
|
+
rua?: string[];
|
|
71
|
+
ruf?: string[];
|
|
72
|
+
warnings: string[];
|
|
73
|
+
}
|
|
74
|
+
export declare function dnsLookup(domain: string, type?: string): Promise<DnsLookupResult[]>;
|
|
75
|
+
export declare function dnsLookupAll(domain: string): Promise<DnsLookupResult[]>;
|
|
76
|
+
export declare function reverseLookup(ip: string): Promise<string[]>;
|
|
12
77
|
export declare function getSecurityRecords(domain: string): Promise<DnsSecurityRecords>;
|
|
78
|
+
export declare function validateSpf(domain: string): Promise<SpfValidation>;
|
|
79
|
+
export declare function validateDmarc(domain: string): Promise<DmarcValidation>;
|
|
80
|
+
export declare function checkDkim(domain: string, selector?: string): Promise<{
|
|
81
|
+
found: boolean;
|
|
82
|
+
record?: string;
|
|
83
|
+
publicKey?: string;
|
|
84
|
+
}>;
|
|
85
|
+
export declare function checkDnsHealth(domain: string): Promise<DnsHealthReport>;
|
|
86
|
+
export interface DmarcGeneratorOptions {
|
|
87
|
+
policy: 'none' | 'quarantine' | 'reject';
|
|
88
|
+
subdomainPolicy?: 'none' | 'quarantine' | 'reject';
|
|
89
|
+
percentage?: number;
|
|
90
|
+
aggregateReports?: string[];
|
|
91
|
+
forensicReports?: string[];
|
|
92
|
+
alignmentDkim?: 'relaxed' | 'strict';
|
|
93
|
+
alignmentSpf?: 'relaxed' | 'strict';
|
|
94
|
+
reportInterval?: number;
|
|
95
|
+
failureOptions?: string;
|
|
96
|
+
}
|
|
97
|
+
export declare function generateDmarc(options: DmarcGeneratorOptions): string;
|
|
98
|
+
export declare function dig(domain: string, options?: DigOptions): Promise<DigResult>;
|
|
99
|
+
export declare function formatDigOutput(result: DigResult, short?: boolean): string;
|
|
13
100
|
//# sourceMappingURL=dns-toolkit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dns-toolkit.d.ts","sourceRoot":"","sources":["../../src/utils/dns-toolkit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dns-toolkit.d.ts","sourceRoot":"","sources":["../../src/utils/dns-toolkit.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,EAAE,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