recker 1.0.15-next.0dab95d → 1.0.15-next.0eabd39

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.
Files changed (108) hide show
  1. package/README.md +10 -1
  2. package/dist/ai/providers/anthropic.d.ts.map +1 -1
  3. package/dist/ai/providers/anthropic.js +4 -1
  4. package/dist/ai/providers/base.d.ts.map +1 -1
  5. package/dist/ai/providers/base.js +7 -2
  6. package/dist/ai/rate-limiter.d.ts.map +1 -1
  7. package/dist/ai/rate-limiter.js +4 -1
  8. package/dist/bench/generator.d.ts.map +1 -1
  9. package/dist/bench/generator.js +7 -3
  10. package/dist/bench/stats.d.ts.map +1 -1
  11. package/dist/bench/stats.js +43 -10
  12. package/dist/cache/memory-storage.d.ts.map +1 -1
  13. package/dist/cache/memory-storage.js +3 -2
  14. package/dist/cli/handler.js +14 -14
  15. package/dist/cli/index.js +582 -49
  16. package/dist/cli/presets.js +5 -5
  17. package/dist/cli/tui/ai-chat.js +10 -10
  18. package/dist/cli/tui/load-dashboard.d.ts.map +1 -1
  19. package/dist/cli/tui/load-dashboard.js +96 -55
  20. package/dist/cli/tui/scroll-buffer.d.ts +1 -1
  21. package/dist/cli/tui/scroll-buffer.d.ts.map +1 -1
  22. package/dist/cli/tui/scroll-buffer.js +2 -2
  23. package/dist/cli/tui/shell.d.ts +3 -0
  24. package/dist/cli/tui/shell.d.ts.map +1 -1
  25. package/dist/cli/tui/shell.js +188 -6
  26. package/dist/cli/tui/websocket.js +17 -17
  27. package/dist/core/client.d.ts.map +1 -1
  28. package/dist/core/client.js +18 -26
  29. package/dist/core/errors.d.ts +109 -1
  30. package/dist/core/errors.d.ts.map +1 -1
  31. package/dist/core/errors.js +214 -1
  32. package/dist/core/request-promise.d.ts.map +1 -1
  33. package/dist/core/request-promise.js +5 -6
  34. package/dist/core/response.d.ts.map +1 -1
  35. package/dist/core/response.js +5 -6
  36. package/dist/dns/propagation.d.ts +3 -1
  37. package/dist/dns/propagation.d.ts.map +1 -1
  38. package/dist/dns/propagation.js +99 -59
  39. package/dist/index.d.ts +1 -0
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.js +1 -0
  42. package/dist/mcp/client.d.ts.map +1 -1
  43. package/dist/mcp/client.js +10 -11
  44. package/dist/mcp/embeddings-loader.d.ts.map +1 -1
  45. package/dist/mcp/embeddings-loader.js +12 -2
  46. package/dist/mcp/geoip-loader.d.ts +11 -0
  47. package/dist/mcp/geoip-loader.d.ts.map +1 -0
  48. package/dist/mcp/geoip-loader.js +107 -0
  49. package/dist/mcp/ip-intel.d.ts +28 -0
  50. package/dist/mcp/ip-intel.d.ts.map +1 -0
  51. package/dist/mcp/ip-intel.js +209 -0
  52. package/dist/mcp/search/hybrid-search.d.ts.map +1 -1
  53. package/dist/mcp/search/hybrid-search.js +5 -1
  54. package/dist/mcp/search/math.d.ts.map +1 -1
  55. package/dist/mcp/search/math.js +5 -1
  56. package/dist/mcp/server.d.ts +4 -0
  57. package/dist/mcp/server.d.ts.map +1 -1
  58. package/dist/mcp/server.js +114 -1
  59. package/dist/plugins/compression.js +4 -2
  60. package/dist/plugins/har-player.d.ts.map +1 -1
  61. package/dist/plugins/har-player.js +8 -11
  62. package/dist/plugins/odata.d.ts.map +1 -1
  63. package/dist/plugins/odata.js +5 -2
  64. package/dist/protocols/ftp.d.ts.map +1 -1
  65. package/dist/protocols/ftp.js +69 -16
  66. package/dist/protocols/sftp.d.ts.map +1 -1
  67. package/dist/protocols/sftp.js +13 -3
  68. package/dist/protocols/telnet.d.ts.map +1 -1
  69. package/dist/protocols/telnet.js +25 -6
  70. package/dist/transport/base-udp.d.ts.map +1 -1
  71. package/dist/transport/base-udp.js +7 -4
  72. package/dist/transport/udp-response.d.ts.map +1 -1
  73. package/dist/transport/udp-response.js +10 -3
  74. package/dist/transport/udp.d.ts.map +1 -1
  75. package/dist/transport/udp.js +5 -1
  76. package/dist/transport/undici.d.ts.map +1 -1
  77. package/dist/transport/undici.js +75 -63
  78. package/dist/utils/agent-manager.d.ts +1 -0
  79. package/dist/utils/agent-manager.d.ts.map +1 -1
  80. package/dist/utils/agent-manager.js +11 -0
  81. package/dist/utils/client-pool.d.ts.map +1 -1
  82. package/dist/utils/client-pool.js +4 -1
  83. package/dist/utils/dns-toolkit.d.ts +88 -1
  84. package/dist/utils/dns-toolkit.d.ts.map +1 -1
  85. package/dist/utils/dns-toolkit.js +704 -6
  86. package/dist/utils/doh.d.ts.map +1 -1
  87. package/dist/utils/doh.js +13 -16
  88. package/dist/utils/download.d.ts.map +1 -1
  89. package/dist/utils/download.js +10 -11
  90. package/dist/utils/rdap.d.ts +9 -0
  91. package/dist/utils/rdap.d.ts.map +1 -1
  92. package/dist/utils/rdap.js +78 -9
  93. package/dist/utils/security-grader.d.ts +47 -0
  94. package/dist/utils/security-grader.d.ts.map +1 -0
  95. package/dist/utils/security-grader.js +637 -0
  96. package/dist/utils/sparkline.d.ts +18 -0
  97. package/dist/utils/sparkline.d.ts.map +1 -0
  98. package/dist/utils/sparkline.js +55 -0
  99. package/dist/utils/sse.d.ts.map +1 -1
  100. package/dist/utils/sse.js +5 -6
  101. package/dist/utils/system-metrics.d.ts +26 -0
  102. package/dist/utils/system-metrics.d.ts.map +1 -0
  103. package/dist/utils/system-metrics.js +81 -0
  104. package/dist/webrtc/index.d.ts.map +1 -1
  105. package/dist/webrtc/index.js +21 -7
  106. package/dist/websocket/client.d.ts.map +1 -1
  107. package/dist/websocket/client.js +13 -16
  108. package/package.json +3 -2
@@ -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, ReckerError } from '../core/errors.js';
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: handleRedirectsManually ? 0 : this.options.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 (handleRedirectsManually && isRedirect && followRedirects && redirectCount < maxRedirects) {
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
- const responseHeaders = new Headers();
356
- for (const [key, value] of Object.entries(undiciResponse.headers)) {
357
- if (value !== undefined) {
358
- if (Array.isArray(value)) {
359
- value.forEach(v => responseHeaders.append(key, v));
360
- }
361
- else {
362
- responseHeaders.set(key, value);
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
- const redirectInfo = {
367
- from: currentUrl,
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 ReckerError('Response headers exceeded the maximum allowed size', req, undefined, [
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: handleRedirectsManually ? 0 : this.options.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 (handleRedirectsManually && isRedirect && followRedirects && redirectCount < maxRedirects) {
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
- const responseHeaders = new Headers();
571
- for (const [key, value] of Object.entries(undiciResponse.headers)) {
572
- if (value !== undefined) {
573
- if (Array.isArray(value)) {
574
- value.forEach(v => responseHeaders.append(key, v));
575
- }
576
- else {
577
- responseHeaders.set(key, value);
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
- const redirectInfo = {
582
- from: currentUrl,
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 ReckerError('Response headers exceeded the maximum allowed size', req, undefined, [
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,OAA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lB,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;IA4CR,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,KAAK;IAmBjD,OAAO,CAAC,WAAW;IAyBnB,QAAQ,IAAI,UAAU;IAWhB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAW/C,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAoBzB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAgB/B;AAOD,wBAAgB,WAAW,CAAC,OAAO,GAAE,YAAiB,GAAG,KAAK,CAG7D;AAKD,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOxD;AASD,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EAAE,GACb;IAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC;IAAC,OAAO,EAAE,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;AAwB/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;CAchB;AAcD,eAAO,MAAM,UAAU,YAAmB,CAAC;AAW3C,wBAAgB,eAAe,CAAC,OAAO,GAAE,IAAI,CAAC,qBAAqB,EAAE,SAAS,GAAG,OAAO,CAAM,GAAG,UAAU,CAK1G"}
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 Error(`Unknown HTTP method: ${method}`);
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?: string[];
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":"AAEA,MAAM,WAAW,kBAAkB;IACjC,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACjE,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA+DpF"}
1
+ {"version":3,"file":"dns-toolkit.d.ts","sourceRoot":"","sources":["../../src/utils/dns-toolkit.ts"],"names":[],"mappings":"AAQA,MAAM,W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