rdapify 0.1.3 → 0.1.7
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/CHANGELOG.md +139 -94
- package/README.md +168 -146
- package/dist/application/client/RDAPClient.d.ts +16 -1
- package/dist/application/client/RDAPClient.d.ts.map +1 -1
- package/dist/application/client/RDAPClient.js +46 -1
- package/dist/application/client/RDAPClient.js.map +1 -1
- package/dist/application/deduplication/QueryDeduplicator.d.ts +20 -0
- package/dist/application/deduplication/QueryDeduplicator.d.ts.map +1 -0
- package/dist/application/deduplication/QueryDeduplicator.js +46 -0
- package/dist/application/deduplication/QueryDeduplicator.js.map +1 -0
- package/dist/application/hooks/MiddlewareHooks.d.ts +48 -0
- package/dist/application/hooks/MiddlewareHooks.d.ts.map +1 -0
- package/dist/application/hooks/MiddlewareHooks.js +46 -0
- package/dist/application/hooks/MiddlewareHooks.js.map +1 -0
- package/dist/application/services/BatchProcessor.d.ts +1 -0
- package/dist/application/services/BatchProcessor.d.ts.map +1 -1
- package/dist/application/services/BatchProcessor.js +9 -0
- package/dist/application/services/BatchProcessor.js.map +1 -1
- package/dist/application/services/QueryOrchestrator.d.ts +14 -1
- package/dist/application/services/QueryOrchestrator.d.ts.map +1 -1
- package/dist/application/services/QueryOrchestrator.js +446 -38
- package/dist/application/services/QueryOrchestrator.js.map +1 -1
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +300 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/index.d.ts +13 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -2
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/cache/CacheManager.d.ts.map +1 -1
- package/dist/infrastructure/cache/CacheManager.js +8 -1
- package/dist/infrastructure/cache/CacheManager.js.map +1 -1
- package/dist/infrastructure/cache/RedisCache.d.ts +35 -0
- package/dist/infrastructure/cache/RedisCache.d.ts.map +1 -0
- package/dist/infrastructure/cache/RedisCache.js +75 -0
- package/dist/infrastructure/cache/RedisCache.js.map +1 -0
- package/dist/infrastructure/cache/index.d.ts +1 -0
- package/dist/infrastructure/cache/index.d.ts.map +1 -1
- package/dist/infrastructure/cache/index.js +3 -1
- package/dist/infrastructure/cache/index.js.map +1 -1
- package/dist/infrastructure/http/BootstrapDiscovery.d.ts +1 -0
- package/dist/infrastructure/http/BootstrapDiscovery.d.ts.map +1 -1
- package/dist/infrastructure/http/BootstrapDiscovery.js +19 -0
- package/dist/infrastructure/http/BootstrapDiscovery.js.map +1 -1
- package/dist/infrastructure/http/Fetcher.d.ts +2 -0
- package/dist/infrastructure/http/Fetcher.d.ts.map +1 -1
- package/dist/infrastructure/http/Fetcher.js +5 -3
- package/dist/infrastructure/http/Fetcher.js.map +1 -1
- package/dist/infrastructure/http/Normalizer.d.ts +2 -0
- package/dist/infrastructure/http/Normalizer.d.ts.map +1 -1
- package/dist/infrastructure/http/Normalizer.js +57 -0
- package/dist/infrastructure/http/Normalizer.js.map +1 -1
- package/dist/infrastructure/logging/AuditLogger.d.ts +114 -0
- package/dist/infrastructure/logging/AuditLogger.d.ts.map +1 -0
- package/dist/infrastructure/logging/AuditLogger.js +195 -0
- package/dist/infrastructure/logging/AuditLogger.js.map +1 -0
- package/dist/infrastructure/logging/Logger.d.ts.map +1 -1
- package/dist/infrastructure/logging/Logger.js +29 -5
- package/dist/infrastructure/logging/Logger.js.map +1 -1
- package/dist/infrastructure/monitoring/MetricsCollector.d.ts +39 -2
- package/dist/infrastructure/monitoring/MetricsCollector.d.ts.map +1 -1
- package/dist/infrastructure/monitoring/MetricsCollector.js +179 -0
- package/dist/infrastructure/monitoring/MetricsCollector.js.map +1 -1
- package/dist/infrastructure/security/PIIRedactor.js +1 -1
- package/dist/infrastructure/security/PIIRedactor.js.map +1 -1
- package/dist/infrastructure/validation/ResponseValidator.d.ts +38 -0
- package/dist/infrastructure/validation/ResponseValidator.d.ts.map +1 -0
- package/dist/infrastructure/validation/ResponseValidator.js +200 -0
- package/dist/infrastructure/validation/ResponseValidator.js.map +1 -0
- package/dist/shared/constants/rdap.constants.d.ts +1 -1
- package/dist/shared/constants/rdap.constants.js +1 -1
- package/dist/shared/errors/base.error.d.ts +8 -0
- package/dist/shared/errors/base.error.d.ts.map +1 -1
- package/dist/shared/errors/base.error.js +30 -1
- package/dist/shared/errors/base.error.js.map +1 -1
- package/dist/shared/types/generics.d.ts +6 -3
- package/dist/shared/types/generics.d.ts.map +1 -1
- package/dist/shared/types/index.d.ts +1 -1
- package/dist/shared/types/index.d.ts.map +1 -1
- package/dist/shared/types/options.d.ts +21 -2
- package/dist/shared/types/options.d.ts.map +1 -1
- package/dist/shared/types/options.js +6 -1
- package/dist/shared/types/options.js.map +1 -1
- package/dist/shared/types/responses.d.ts +42 -2
- package/dist/shared/types/responses.d.ts.map +1 -1
- package/dist/shared/utils/helpers/index.d.ts +1 -1
- package/dist/shared/utils/helpers/index.d.ts.map +1 -1
- package/dist/shared/utils/helpers/index.js +2 -1
- package/dist/shared/utils/helpers/index.js.map +1 -1
- package/dist/shared/utils/helpers/runtime.d.ts +1 -0
- package/dist/shared/utils/helpers/runtime.d.ts.map +1 -1
- package/dist/shared/utils/helpers/runtime.js +11 -1
- package/dist/shared/utils/helpers/runtime.js.map +1 -1
- package/dist/shared/utils/validators/config-validation.d.ts +3 -0
- package/dist/shared/utils/validators/config-validation.d.ts.map +1 -0
- package/dist/shared/utils/validators/config-validation.js +97 -0
- package/dist/shared/utils/validators/config-validation.js.map +1 -0
- package/dist/shared/utils/validators/entity.d.ts +3 -0
- package/dist/shared/utils/validators/entity.d.ts.map +1 -0
- package/dist/shared/utils/validators/entity.js +27 -0
- package/dist/shared/utils/validators/entity.js.map +1 -0
- package/dist/shared/utils/validators/index.d.ts +3 -0
- package/dist/shared/utils/validators/index.d.ts.map +1 -1
- package/dist/shared/utils/validators/index.js +9 -1
- package/dist/shared/utils/validators/index.js.map +1 -1
- package/dist/shared/utils/validators/nameserver.d.ts +3 -0
- package/dist/shared/utils/validators/nameserver.d.ts.map +1 -0
- package/dist/shared/utils/validators/nameserver.js +49 -0
- package/dist/shared/utils/validators/nameserver.js.map +1 -0
- package/package.json +9 -10
package/README.md
CHANGED
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
>
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="website/static/img/logo-512.png" alt="RDAPify" width="80" />
|
|
3
|
+
</p>
|
|
4
|
+
<h1 align="center">RDAPify</h1>
|
|
5
|
+
<p align="center"><strong>Unified, Secure, High-Performance RDAP Client</strong></p>
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/rdapify)
|
|
8
|
+
[](https://www.npmjs.com/package/rdapify)
|
|
8
9
|
[](LICENSE)
|
|
10
|
+
[](https://github.com/rdapify/RDAPify/actions/workflows/ci.yml)
|
|
11
|
+
[](https://codecov.io/gh/rdapify/RDAPify)
|
|
12
|
+
[](https://www.typescriptlang.org/)
|
|
13
|
+
[](https://github.com/rdapify/RDAPify/blob/main/CHANGELOG.md)
|
|
9
14
|
[](SECURITY.md)
|
|
10
|
-
[](#)
|
|
11
15
|
[](https://rdapify.com)
|
|
12
16
|
[](https://github.com/rdapify/RDAPify)
|
|
13
17
|
|
|
18
|
+
> **Alpha software**
|
|
19
|
+
>
|
|
20
|
+
> RDAPify is under active development. Core functionality (RDAP queries, caching, SSRF protection) is stable and tested, but APIs and interfaces may change before v1.0. We welcome [issues](https://github.com/rdapify/RDAPify/issues) and [feedback](https://github.com/rdapify/RDAPify/discussions) from the community while the project evolves.
|
|
21
|
+
|
|
14
22
|
**RDAPify** unifies RDAP queries across all global registries (Verisign, ARIN, RIPE, APNIC, LACNIC) with robust security protection, exceptional performance, and an integrated developer experience. This isn't just another RDAP client — it's a complete platform for processing registration data securely.
|
|
15
23
|
|
|
16
24
|
> **Note:** This project eliminates the need for traditional WHOIS protocol, while maintaining backward compatibility when needed.
|
|
@@ -24,7 +32,7 @@ Direct RDAP queries are complex — each registry uses different formats, rate l
|
|
|
24
32
|
- Manually handling registry differences
|
|
25
33
|
- Constant worry about SSRF vulnerabilities
|
|
26
34
|
- Unpredictable performance without caching
|
|
27
|
-
+ One unified solution, rigorously tested,
|
|
35
|
+
+ One unified solution, rigorously tested, open source
|
|
28
36
|
```
|
|
29
37
|
|
|
30
38
|
RDAPify intelligently addresses these challenges:
|
|
@@ -32,7 +40,7 @@ RDAPify intelligently addresses these challenges:
|
|
|
32
40
|
- ✅ **Data Normalization**: Consistent response regardless of source registry
|
|
33
41
|
- ✅ **SSRF Protection**: Prevent attacks on internal infrastructure
|
|
34
42
|
- ✅ **Exceptional Performance**: Smart caching, parallel processing, memory optimization
|
|
35
|
-
- ✅ **Node.js Compatibility**: Verified working on Node.js
|
|
43
|
+
- ✅ **Node.js Compatibility**: Verified working on Node.js 20+; Bun, Deno, and Cloudflare Workers also supported
|
|
36
44
|
- ✅ **GDPR-ready**: Built-in tools for automatically redacting personal data
|
|
37
45
|
|
|
38
46
|
## 📦 Quick Installation
|
|
@@ -48,9 +56,8 @@ yarn add rdapify
|
|
|
48
56
|
pnpm add rdapify
|
|
49
57
|
```
|
|
50
58
|
|
|
51
|
-
**Experimental (untested):**
|
|
52
59
|
```bash
|
|
53
|
-
# Using Bun
|
|
60
|
+
# Using Bun
|
|
54
61
|
bun add rdapify
|
|
55
62
|
```
|
|
56
63
|
|
|
@@ -93,10 +100,12 @@ const client = new RDAPClient({
|
|
|
93
100
|
},
|
|
94
101
|
});
|
|
95
102
|
|
|
96
|
-
// Query domain, IP, or
|
|
103
|
+
// Query domain, IP, ASN, nameserver, or entity
|
|
97
104
|
const domain = await client.domain('example.com');
|
|
98
105
|
const ip = await client.ip('8.8.8.8');
|
|
99
106
|
const asn = await client.asn('AS15169');
|
|
107
|
+
const ns = await client.nameserver('ns1.example.com');
|
|
108
|
+
const entity = await client.entity('ARIN-HN-1', 'https://rdap.arin.net/registry');
|
|
100
109
|
```
|
|
101
110
|
|
|
102
111
|
**Example Output:**
|
|
@@ -112,6 +121,25 @@ const asn = await client.asn('AS15169');
|
|
|
112
121
|
}
|
|
113
122
|
```
|
|
114
123
|
|
|
124
|
+
### With Nameserver & Entity Queries (v0.1.7+)
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
import { RDAPClient } from 'rdapify';
|
|
128
|
+
|
|
129
|
+
const client = new RDAPClient();
|
|
130
|
+
|
|
131
|
+
// Query a nameserver — auto-discovers server via IANA DNS bootstrap
|
|
132
|
+
const ns = await client.nameserver('ns1.example.com');
|
|
133
|
+
console.log(ns.ldhName); // "ns1.example.com"
|
|
134
|
+
console.log(ns.ipAddresses); // { v4: ['93.184.216.34'], v6: [...] }
|
|
135
|
+
console.log(ns.status); // ['active']
|
|
136
|
+
|
|
137
|
+
// Query an entity — requires explicit server URL (no global IANA bootstrap)
|
|
138
|
+
const entity = await client.entity('ARIN-HN-1', 'https://rdap.arin.net/registry');
|
|
139
|
+
console.log(entity.handle); // "ARIN-HN-1"
|
|
140
|
+
console.log(entity.roles); // ['registrar', 'technical']
|
|
141
|
+
```
|
|
142
|
+
|
|
115
143
|
### With Monitoring & Metrics (v0.1.2+)
|
|
116
144
|
|
|
117
145
|
```typescript
|
|
@@ -237,19 +265,19 @@ const compression = new CompressionManager({
|
|
|
237
265
|
- **Certificate Validation**: Reject insecure connections to RDAP servers
|
|
238
266
|
- **Rate Limiting**: Prevent service blocking due to excessive requests
|
|
239
267
|
- **Secure Data Handling**: PII redaction according to GDPR/CCPA requirements
|
|
240
|
-
- **Authentication Support** (v0.1.
|
|
241
|
-
- **Proxy Support** (v0.1.
|
|
268
|
+
- **Authentication Support** (v0.1.1+): Basic, Bearer Token, API Key, OAuth2
|
|
269
|
+
- **Proxy Support** (v0.1.1+): HTTP/HTTPS/SOCKS4/SOCKS5 with authentication
|
|
242
270
|
- **Full Audit Trail**: Track all critical operations for compliance purposes
|
|
243
271
|
|
|
244
272
|
### ⚡ Exceptional Performance
|
|
245
273
|
|
|
246
274
|
- **Smart Caching**: In-memory LRU cache with configurable TTL
|
|
247
|
-
- **Persistent Cache** (v0.1.
|
|
275
|
+
- **Persistent Cache** (v0.1.1+): File-based cache that survives restarts
|
|
248
276
|
- **Connection Pooling** (v0.1.2+): HTTP connection reuse for 30-40% performance improvement
|
|
249
277
|
- **Batch Processing**: Process multiple queries efficiently (5-10x faster)
|
|
250
|
-
- **Response Compression** (v0.1.
|
|
251
|
-
- **Retry Strategies** (v0.1.
|
|
252
|
-
- **Query Prioritization** (v0.1.
|
|
278
|
+
- **Response Compression** (v0.1.1+): gzip/brotli support for 60-80% bandwidth reduction
|
|
279
|
+
- **Retry Strategies** (v0.1.1+): Circuit breaker with exponential backoff
|
|
280
|
+
- **Query Prioritization** (v0.1.1+): High/normal/low priority queue
|
|
253
281
|
- **Registry Discovery**: Automatic IANA Bootstrap for finding the correct registry
|
|
254
282
|
- **Optimized Parsing**: Fast JSONPath-based normalization
|
|
255
283
|
|
|
@@ -265,10 +293,11 @@ const compression = new CompressionManager({
|
|
|
265
293
|
### 🧩 Seamless Integration
|
|
266
294
|
|
|
267
295
|
- **Full TypeScript Support**: Strongly typed with embedded documentation
|
|
268
|
-
- **Node.js Support**: Verified working (
|
|
269
|
-
- **Enhanced Validation** (v0.1.
|
|
270
|
-
- **
|
|
271
|
-
- **
|
|
296
|
+
- **Node.js 20+ Support**: Verified working (Node.js, Bun, Deno, Cloudflare Workers)
|
|
297
|
+
- **Enhanced Validation** (v0.1.1+): IDN domains, IPv6 zones, ASN ranges
|
|
298
|
+
- **Nameserver & Entity Queries** (v0.1.7+): `client.nameserver()` and `client.entity()` with full RDAP support
|
|
299
|
+
- **CLI Tool** (v0.1.7+): `rdapify domain/ip/asn/nameserver/entity` with `--json`, `--no-cache`, `--timeout`, `--server` flags
|
|
300
|
+
- **Web Playground**: Try RDAPify live at [rdapify.com/playground](https://rdapify.com/playground)
|
|
272
301
|
- **Pre-built Templates**: For AWS Lambda, Azure Functions, Kubernetes, and more (planned)
|
|
273
302
|
|
|
274
303
|
### 📊 Advanced Analytics (Planned)
|
|
@@ -327,7 +356,7 @@ RDAPify provides comprehensive documentation in the repository:
|
|
|
327
356
|
|
|
328
357
|
## 🌐 Interactive Playground
|
|
329
358
|
|
|
330
|
-
|
|
359
|
+
Try RDAPify directly in your browser — no installation required: **[rdapify.com/playground](https://rdapify.com/playground)**
|
|
331
360
|
|
|
332
361
|
## 📊 Performance Benchmarks
|
|
333
362
|
|
|
@@ -352,7 +381,6 @@ RDAPify is an open source project. Get help or contribute:
|
|
|
352
381
|
- **[CONTRIBUTING.md](CONTRIBUTING.md)** - Contribution guidelines
|
|
353
382
|
- **[CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md)** - Community standards
|
|
354
383
|
|
|
355
|
-
> **Enterprise Support**: For SLA-backed support, consulting, or custom features, contact enterprise@rdapify.com
|
|
356
384
|
|
|
357
385
|
## 🤝 Contributing
|
|
358
386
|
|
|
@@ -367,85 +395,88 @@ Start by reading our [Contribution Guide](CONTRIBUTING.md) and [Code of Conduct]
|
|
|
367
395
|
|
|
368
396
|
## 🚧 Project Status
|
|
369
397
|
|
|
370
|
-
**Current Release**: v0.1.
|
|
398
|
+
**Current Release**: v0.1.7 (Alpha)
|
|
371
399
|
|
|
372
|
-
### 🎉 What's New in v0.1.
|
|
400
|
+
### 🎉 What's New in v0.1.7
|
|
373
401
|
|
|
374
|
-
**
|
|
375
|
-
- ✅ **
|
|
376
|
-
- ✅ **
|
|
377
|
-
- ✅ **
|
|
378
|
-
- ✅ **
|
|
379
|
-
- ✅ **
|
|
380
|
-
- ✅ **
|
|
381
|
-
- ✅ **Code Quality**: ESLint errors resolved (6 issues fixed)
|
|
402
|
+
**Nameserver & Entity Query Support**
|
|
403
|
+
- ✅ **Nameserver Queries**: `client.nameserver('ns1.example.com')` — auto-discovery via IANA DNS bootstrap
|
|
404
|
+
- ✅ **Entity Queries**: `client.entity('ARIN-HN-1', serverUrl)` — contact/registrant/registrar lookup
|
|
405
|
+
- ✅ **CLI Extended**: `rdapify nameserver <hostname>`, `rdapify entity <handle> --server <url>`
|
|
406
|
+
- ✅ **New Types**: `NameserverResponse` and `EntityResponse` exported from main entry point
|
|
407
|
+
- ✅ **New Validators**: `validateNameserver`, `validateEntityHandle`, `normalizeNameserver`, `normalizeEntityHandle`
|
|
408
|
+
- ✅ **All query types** now support full pipeline: caching, middleware hooks, metrics, deduplication, PII redaction
|
|
382
409
|
|
|
383
|
-
|
|
410
|
+
### v0.1.6 — CLI Tool & Runtime Support
|
|
411
|
+
- ✅ **CLI Tool**: `rdapify domain <name>`, `rdapify ip <addr>`, `rdapify asn <num>` — zero external dependencies
|
|
412
|
+
- ✅ **CLI Flags**: `--json`, `--no-cache`, `--timeout <ms>`, `--version/-v`, `--help/-h`
|
|
413
|
+
- ✅ **Cloudflare Workers**: Full runtime detection and support (`isCloudflareWorkers()`)
|
|
414
|
+
- ✅ **Critical Redis Fix**: `RedisCache.clear()` no longer wipes the entire database
|
|
384
415
|
|
|
385
|
-
**
|
|
386
|
-
- ✅ **
|
|
387
|
-
- ✅ **
|
|
388
|
-
- ✅ **
|
|
416
|
+
**v0.1.5 — Compliance & Middleware**
|
|
417
|
+
- ✅ **Redis Cache**: Production-ready Redis adapter with peer-dependency pattern
|
|
418
|
+
- ✅ **Middleware Hooks**: `beforeQuery`, `afterQuery`, `onError`, `onCacheHit`, `onCacheMiss`, `onRetry` lifecycle hooks
|
|
419
|
+
- ✅ **Query Deduplicator**: Collapses concurrent identical in-flight requests into a single Promise
|
|
420
|
+
- ✅ **Audit Logger**: GDPR/SOC2/CCPA-compliant audit trail with in-memory and file (NDJSON) adapters
|
|
421
|
+
- ✅ **Response Validator**: RFC 7483 schema validation with strict/lenient/off modes
|
|
389
422
|
|
|
390
|
-
**
|
|
391
|
-
- ✅
|
|
392
|
-
- ✅ **Query Prioritization**: High/normal/low priority queue
|
|
393
|
-
- ✅ **Enhanced Validation**: IDN domains, IPv6 zones, ASN ranges
|
|
394
|
-
- ✅ **Persistent Cache**: File-based storage that survives restarts
|
|
423
|
+
**v0.1.4 — TypeScript Strict Mode**
|
|
424
|
+
- ✅ TypeScript strict mode throughout the entire codebase
|
|
395
425
|
|
|
396
|
-
**
|
|
397
|
-
- ✅
|
|
398
|
-
- ✅
|
|
399
|
-
- ✅
|
|
426
|
+
**v0.1.3 — 15+ Defensive Bug Fixes**
|
|
427
|
+
- ✅ Normalizer null checks, BootstrapDiscovery NaN guard, Fetcher redirect validation
|
|
428
|
+
- ✅ ConnectionPool acquire timeout, PIIRedactor `structuredClone`, SSRFProtection IPv6 brackets
|
|
429
|
+
- ✅ MetricsCollector division-by-zero protection
|
|
400
430
|
|
|
401
|
-
**
|
|
431
|
+
**Previous Releases (v0.1.0–v0.1.2)**
|
|
432
|
+
- ✅ Authentication (Basic/Bearer/API Key/OAuth2), Proxy (HTTP/HTTPS/SOCKS4/SOCKS5), Compression (gzip/brotli/deflate)
|
|
433
|
+
- ✅ Retry strategies with circuit breaker, query prioritization, enhanced validation (IDN, IPv6 zones, ASN ranges)
|
|
434
|
+
- ✅ Connection pooling (30-40% faster), metrics & monitoring, request/response logging
|
|
435
|
+
- ✅ Persistent cache (file-based), interactive playground
|
|
402
436
|
|
|
403
|
-
See [
|
|
437
|
+
See [CHANGELOG.md](CHANGELOG.md) for detailed version history.
|
|
404
438
|
|
|
405
|
-
### ✅
|
|
439
|
+
### ✅ Full Feature Set (v0.1.7)
|
|
406
440
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
- ✅ **
|
|
410
|
-
- ✅ **RDAP Client**: Domain, IP, and ASN queries with automatic bootstrap discovery
|
|
411
|
-
- ✅ **SSRF Protection**: Blocks private IPs, localhost, link-local, with proper CIDR matching (IPv4/IPv6)
|
|
441
|
+
- ✅ **RDAP Client**: Domain, IP, ASN, Nameserver, and Entity queries with automatic IANA bootstrap discovery
|
|
442
|
+
- ✅ **CLI Tool**: Command-line interface with human-readable and JSON output (`domain`, `ip`, `asn`, `nameserver`, `entity`)
|
|
443
|
+
- ✅ **SSRF Protection**: Blocks private IPs, localhost, link-local, CIDR matching (IPv4/IPv6)
|
|
412
444
|
- ✅ **Data Normalization**: Consistent response format across all registries
|
|
413
|
-
- ✅ **PII Redaction**: Automatic redaction of emails, phones, addresses
|
|
414
|
-
- ✅ **
|
|
445
|
+
- ✅ **PII Redaction**: Automatic redaction of emails, phones, addresses (GDPR/CCPA)
|
|
446
|
+
- ✅ **Audit Logging**: Compliance-grade audit trail (GDPR/SOC2/CCPA) with NDJSON file adapter
|
|
447
|
+
- ✅ **In-Memory Cache**: LRU cache with TTL support
|
|
415
448
|
- ✅ **Persistent Cache**: File-based cache that survives restarts
|
|
449
|
+
- ✅ **Redis Cache**: Production-ready Redis adapter
|
|
416
450
|
- ✅ **Connection Pooling**: HTTP connection reuse (30-40% faster)
|
|
417
451
|
- ✅ **Metrics & Monitoring**: Comprehensive query tracking and analysis
|
|
418
|
-
- ✅ **Request/Response Logging**:
|
|
419
|
-
- ✅ **Retry Strategies**: Circuit breaker with exponential backoff
|
|
452
|
+
- ✅ **Request/Response Logging**: Structured logging with configurable levels
|
|
453
|
+
- ✅ **Retry Strategies**: Circuit breaker (closed/open/half-open) with exponential backoff
|
|
420
454
|
- ✅ **Query Prioritization**: High/normal/low priority queue
|
|
455
|
+
- ✅ **Query Deduplication**: Collapse concurrent identical requests into one
|
|
456
|
+
- ✅ **Middleware Hooks**: Lifecycle hooks for query pipeline customization
|
|
457
|
+
- ✅ **Response Validation**: RFC 7483 schema validation
|
|
421
458
|
- ✅ **Enhanced Validation**: IDN domains, IPv6 zones, ASN ranges
|
|
422
|
-
- ✅ **Authentication
|
|
423
|
-
- ✅ **Proxy Support**: HTTP/HTTPS/SOCKS4/SOCKS5
|
|
424
|
-
- ✅ **Response Compression**: gzip, brotli, deflate
|
|
425
|
-
- ✅ **
|
|
426
|
-
- ✅ **TypeScript
|
|
427
|
-
- ✅ **Test Coverage**:
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
- ⏳ **
|
|
435
|
-
- ⏳ **CLI Tool**: Command-line interface planned
|
|
436
|
-
- ⏳ **Bun/Deno/Cloudflare Workers**: Additional runtime support
|
|
437
|
-
- ⏳ **Advanced Analytics**: Dashboard and reporting features
|
|
438
|
-
- ⏳ **Geo-distributed Caching**: Multi-region cache support
|
|
439
|
-
- ⏳ **Smart Caching**: Predictive caching with adaptive TTL
|
|
440
|
-
- ⏳ **Real-time Updates**: WebSocket/SSE support
|
|
459
|
+
- ✅ **Authentication**: Basic, Bearer, API Key, OAuth2
|
|
460
|
+
- ✅ **Proxy Support**: HTTP/HTTPS/SOCKS4/SOCKS5 with bypass patterns
|
|
461
|
+
- ✅ **Response Compression**: gzip, brotli, deflate (60-80% bandwidth reduction)
|
|
462
|
+
- ✅ **Multi-runtime**: Node.js 20+, Bun, Deno, Cloudflare Workers
|
|
463
|
+
- ✅ **TypeScript Strict**: Full type definitions with strict mode
|
|
464
|
+
- ✅ **Test Coverage**: 34 test files, 620+ tests (unit + integration)
|
|
465
|
+
|
|
466
|
+
### 🔜 Coming in v0.1.8
|
|
467
|
+
|
|
468
|
+
- ⏳ **Domain Availability**: `client.checkAvailability('example.com')` — instant availability check via RDAP
|
|
469
|
+
- ⏳ **Bulk Availability**: `client.checkAvailabilityBatch(['a.com', 'b.com'])` — check multiple domains at once
|
|
470
|
+
- ⏳ **Live Integration Tests**: opt-in via `LIVE_TESTS=1` against real RDAP servers
|
|
471
|
+
- ⏳ **Advanced Bootstrap Config**: custom bootstrap servers, TTL overrides, redundancy fallback
|
|
441
472
|
|
|
442
473
|
### 📋 Roadmap to v0.2.0
|
|
443
474
|
|
|
444
|
-
-
|
|
445
|
-
-
|
|
446
|
-
-
|
|
447
|
-
-
|
|
448
|
-
-
|
|
475
|
+
- RDAP Testing CLI (`rdapify test server`, `rdapify test benchmark`)
|
|
476
|
+
- RDAP Extensions Registry (REGEXT support)
|
|
477
|
+
- Bootstrap Store Adapters (File, Redis, Database)
|
|
478
|
+
- Advanced Reporting (`client.generateReport()`)
|
|
479
|
+
- RFC 9083 / RFC 9535 support
|
|
449
480
|
|
|
450
481
|
See [ROADMAP.md](ROADMAP.md) for the complete roadmap and [CHANGELOG.md](CHANGELOG.md) for detailed version history.
|
|
451
482
|
|
|
@@ -455,76 +486,68 @@ RDAPify follows a clean, modular architecture with clear separation of concerns:
|
|
|
455
486
|
|
|
456
487
|
### Source Structure (`/src`)
|
|
457
488
|
|
|
489
|
+
RDAPify follows a hexagonal (ports & adapters) architecture:
|
|
490
|
+
|
|
458
491
|
```
|
|
459
492
|
src/
|
|
460
|
-
├──
|
|
461
|
-
│ ├──
|
|
462
|
-
│ └──
|
|
493
|
+
├── application/ # Application layer
|
|
494
|
+
│ ├── client/
|
|
495
|
+
│ │ └── RDAPClient.ts # Main client entry point
|
|
496
|
+
│ ├── services/
|
|
497
|
+
│ │ ├── QueryOrchestrator.ts # Query pipeline orchestration
|
|
498
|
+
│ │ ├── BatchProcessor.ts # Concurrent batch processing
|
|
499
|
+
│ │ └── QueryPriority.ts # Priority queue (high/normal/low)
|
|
500
|
+
│ ├── hooks/
|
|
501
|
+
│ │ └── MiddlewareHooks.ts # Lifecycle hooks
|
|
502
|
+
│ └── deduplication/
|
|
503
|
+
│ └── QueryDeduplicator.ts # In-flight request deduplication
|
|
463
504
|
│
|
|
464
|
-
├──
|
|
465
|
-
│ ├──
|
|
466
|
-
│ ├──
|
|
467
|
-
│
|
|
505
|
+
├── infrastructure/ # Infrastructure layer
|
|
506
|
+
│ ├── http/
|
|
507
|
+
│ │ ├── Fetcher.ts # HTTP client with SSRF validation
|
|
508
|
+
│ │ ├── BootstrapDiscovery.ts # IANA bootstrap registry discovery
|
|
509
|
+
│ │ ├── Normalizer.ts # Raw → normalized response transform
|
|
510
|
+
│ │ ├── RateLimiter.ts # Token-bucket rate limiter
|
|
511
|
+
│ │ ├── ConnectionPool.ts # HTTP connection reuse
|
|
512
|
+
│ │ ├── RetryStrategy.ts # Retry + circuit breaker
|
|
513
|
+
│ │ ├── AuthenticationManager.ts # Basic/Bearer/APIKey/OAuth2
|
|
514
|
+
│ │ ├── ProxyManager.ts # HTTP/HTTPS/SOCKS proxy support
|
|
515
|
+
│ │ └── CompressionManager.ts # gzip/brotli/deflate
|
|
516
|
+
│ ├── cache/
|
|
517
|
+
│ │ ├── InMemoryCache.ts # LRU in-memory cache with TTL
|
|
518
|
+
│ │ ├── CacheManager.ts # Cache backend dispatcher
|
|
519
|
+
│ │ ├── PersistentCache.ts # File-backed JSON cache
|
|
520
|
+
│ │ └── RedisCache.ts # Redis adapter (peer-dependency)
|
|
521
|
+
│ ├── security/
|
|
522
|
+
│ │ ├── SSRFProtection.ts # RFC 1918 / link-local blocking
|
|
523
|
+
│ │ └── PIIRedactor.ts # GDPR/CCPA PII redaction
|
|
524
|
+
│ ├── logging/
|
|
525
|
+
│ │ ├── Logger.ts # Structured request/response logging
|
|
526
|
+
│ │ └── AuditLogger.ts # Compliance audit trail (NDJSON)
|
|
527
|
+
│ ├── monitoring/
|
|
528
|
+
│ │ └── MetricsCollector.ts # Query latency, success/error rates
|
|
529
|
+
│ └── validation/
|
|
530
|
+
│ └── ResponseValidator.ts # RFC 7483 schema validation
|
|
468
531
|
│
|
|
469
|
-
├──
|
|
470
|
-
│ ├──
|
|
471
|
-
│
|
|
532
|
+
├── shared/ # Shared kernel
|
|
533
|
+
│ ├── types/ # TypeScript types and interfaces
|
|
534
|
+
│ ├── errors/ # Typed error hierarchy (11 error classes)
|
|
535
|
+
│ └── utils/ # Validators, helpers, constants
|
|
472
536
|
│
|
|
473
|
-
├──
|
|
474
|
-
│ ├── CacheManager.ts # Cache orchestration (188 LOC)
|
|
475
|
-
│ └── InMemoryCache.ts # LRU implementation (185 LOC)
|
|
537
|
+
├── core/ports/ # Interface contracts (hexagonal ports)
|
|
476
538
|
│
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
│ ├── entities.ts # Entity interfaces (74 LOC)
|
|
480
|
-
│ ├── responses.ts # Response types (100 LOC)
|
|
481
|
-
│ ├── errors.ts # Error classes (154 LOC)
|
|
482
|
-
│ ├── options.ts # Configuration types (201 LOC)
|
|
483
|
-
│ └── index.ts # Barrel export (36 LOC)
|
|
484
|
-
│
|
|
485
|
-
└── utils/ # Utilities
|
|
486
|
-
├── validators/ # Input validation
|
|
487
|
-
│ ├── domain.ts # Domain validation (55 LOC)
|
|
488
|
-
│ ├── ip.ts # IP validation (86 LOC)
|
|
489
|
-
│ ├── asn.ts # ASN validation (42 LOC)
|
|
490
|
-
│ └── network.ts # Network utilities (76 LOC)
|
|
491
|
-
│
|
|
492
|
-
└── helpers/ # Helper functions
|
|
493
|
-
├── async.ts # Async utilities (77 LOC)
|
|
494
|
-
├── string.ts # String manipulation (38 LOC)
|
|
495
|
-
├── object.ts # Object utilities (33 LOC)
|
|
496
|
-
├── cache.ts # Cache helpers (11 LOC)
|
|
497
|
-
├── http.ts # HTTP utilities (25 LOC)
|
|
498
|
-
├── format.ts # Formatting (27 LOC)
|
|
499
|
-
└── runtime.ts # Runtime detection (47 LOC)
|
|
539
|
+
└── cli/
|
|
540
|
+
└── index.ts # CLI binary (rdapify domain/ip/asn)
|
|
500
541
|
```
|
|
501
542
|
|
|
502
543
|
### Key Design Principles
|
|
503
544
|
|
|
504
|
-
1. **
|
|
505
|
-
2. **
|
|
506
|
-
3. **
|
|
507
|
-
4. **
|
|
508
|
-
5. **
|
|
509
|
-
6. **
|
|
510
|
-
|
|
511
|
-
### Recent Improvements (Phase 2 Refactoring)
|
|
512
|
-
|
|
513
|
-
- ✅ Extracted QueryOrchestrator from RDAPClient (-29% LOC)
|
|
514
|
-
- ✅ Split validators into focused modules (-87% in main file)
|
|
515
|
-
- ✅ Split helpers into focused modules (-80% in main file)
|
|
516
|
-
- ✅ Split types into enums, entities, responses (-87% in main file)
|
|
517
|
-
- ✅ 712 lines of duplication eliminated
|
|
518
|
-
- ✅ 100% backward compatible (re-export shims)
|
|
519
|
-
|
|
520
|
-
See [REFACTOR_STATUS.md](REFACTOR_STATUS.md) for detailed refactoring progress.
|
|
521
|
-
|
|
522
|
-
### 📋 Roadmap to v0.2.0 (Continued)
|
|
523
|
-
- Live integration tests (optional via LIVE_TESTS=1)
|
|
524
|
-
- Performance benchmarks with real data
|
|
525
|
-
- Advanced analytics dashboard
|
|
526
|
-
|
|
527
|
-
**Want to contribute?** Check out our [CONTRIBUTING.md](CONTRIBUTING.md) and [ROADMAP.md](ROADMAP.md)!
|
|
545
|
+
1. **Hexagonal Architecture**: Clean separation between application, infrastructure, and shared layers
|
|
546
|
+
2. **Ports & Adapters**: Interface-driven design for easy testing and swappable backends
|
|
547
|
+
3. **Security First**: SSRF protection and PII redaction built into the query pipeline
|
|
548
|
+
4. **Type Safety**: Strict TypeScript with explicit types throughout
|
|
549
|
+
5. **Compliance Ready**: Audit logging for GDPR/SOC2/CCPA requirements
|
|
550
|
+
6. **Multi-runtime**: Works on Node.js 20+, Bun, Deno, and Cloudflare Workers
|
|
528
551
|
|
|
529
552
|
## 📚 Additional Documentation
|
|
530
553
|
|
|
@@ -592,10 +615,9 @@ We're looking for early adopters and beta testers! If you're interested in:
|
|
|
592
615
|
|
|
593
616
|
### Known Issues & Limitations
|
|
594
617
|
|
|
595
|
-
- Bun/Deno/Cloudflare Workers compatibility not yet tested
|
|
596
618
|
- Live RDAP server tests disabled by default (use `LIVE_TESTS=1` to enable)
|
|
597
|
-
-
|
|
598
|
-
-
|
|
619
|
+
- Advanced analytics dashboard planned for v0.2.0
|
|
620
|
+
- Geo-distributed caching planned for v0.2.0
|
|
599
621
|
|
|
600
622
|
## 📜 License
|
|
601
623
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { RateLimiter } from '../../infrastructure/http/RateLimiter';
|
|
2
2
|
import { Logger } from '../../infrastructure/logging/Logger';
|
|
3
|
-
import type { DomainResponse, IPResponse, ASNResponse } from '../../shared/types';
|
|
3
|
+
import type { DomainResponse, IPResponse, ASNResponse, NameserverResponse, EntityResponse } from '../../shared/types';
|
|
4
4
|
import type { RDAPClientOptions } from '../../shared/types/options';
|
|
5
5
|
import { BatchProcessor } from '../services/BatchProcessor';
|
|
6
|
+
import { MiddlewareManager } from '../hooks/MiddlewareHooks';
|
|
7
|
+
import type { MiddlewareOptions } from '../hooks/MiddlewareHooks';
|
|
6
8
|
export declare class RDAPClient {
|
|
7
9
|
private readonly options;
|
|
8
10
|
private readonly cache;
|
|
@@ -17,10 +19,16 @@ export declare class RDAPClient {
|
|
|
17
19
|
private readonly connectionPool;
|
|
18
20
|
private readonly metricsCollector;
|
|
19
21
|
private readonly logger;
|
|
22
|
+
private readonly middlewareManager;
|
|
23
|
+
private readonly queryDeduplicator;
|
|
24
|
+
private readonly debugEnabled;
|
|
25
|
+
private readonly debugLogger?;
|
|
20
26
|
constructor(options?: RDAPClientOptions);
|
|
21
27
|
domain(domain: string): Promise<DomainResponse>;
|
|
22
28
|
ip(ip: string): Promise<IPResponse>;
|
|
23
29
|
asn(asn: string | number): Promise<ASNResponse>;
|
|
30
|
+
nameserver(nameserver: string): Promise<NameserverResponse>;
|
|
31
|
+
entity(handle: string, serverUrl: string): Promise<EntityResponse>;
|
|
24
32
|
private fetchWithRetry;
|
|
25
33
|
private normalizeOptions;
|
|
26
34
|
clearCache(): Promise<void>;
|
|
@@ -45,6 +53,13 @@ export declare class RDAPClient {
|
|
|
45
53
|
idleConnections: number;
|
|
46
54
|
hosts: number;
|
|
47
55
|
};
|
|
56
|
+
use(hooks: Partial<MiddlewareOptions>): this;
|
|
57
|
+
getMiddlewareManager(): MiddlewareManager;
|
|
58
|
+
getDeduplicatorStats(): {
|
|
59
|
+
enabled: boolean;
|
|
60
|
+
inflight: number;
|
|
61
|
+
windowMs: number;
|
|
62
|
+
};
|
|
48
63
|
getLogger(): Logger;
|
|
49
64
|
getLogs(count?: number): import("../../infrastructure/logging/Logger").LogEntry[];
|
|
50
65
|
clearAll(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RDAPClient.d.ts","sourceRoot":"","sources":["../../../src/application/client/RDAPClient.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAIpE,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"RDAPClient.d.ts","sourceRoot":"","sources":["../../../src/application/client/RDAPClient.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAIpE,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGtH,OAAO,KAAK,EACV,iBAAiB,EAIlB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAyClE,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA8B;IACtD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAe;IACrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;IAClC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;IAChD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAqB;IAC/C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAc;IAC1C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAoB;IACjD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAc;IAC1C,OAAO,CAAC,QAAQ,CAAC,cAA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AsB;;;;;;IActB,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,IAAI;IAQ5C,oBAAoB,IAAI,iBAAiB;IAOzC,oBAAoB;;;;;IAOpB,SAAS,IAAI,MAAM;IAOnB,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM;IAOhB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAU/B,OAAO,IAAI,IAAI;CAIhB"}
|
|
@@ -13,6 +13,8 @@ const options_1 = require("../../shared/types/options");
|
|
|
13
13
|
const helpers_1 = require("../../shared/utils/helpers");
|
|
14
14
|
const services_1 = require("../services");
|
|
15
15
|
const BatchProcessor_1 = require("../services/BatchProcessor");
|
|
16
|
+
const MiddlewareHooks_1 = require("../hooks/MiddlewareHooks");
|
|
17
|
+
const QueryDeduplicator_1 = require("../deduplication/QueryDeduplicator");
|
|
16
18
|
class RDAPClient {
|
|
17
19
|
constructor(options = {}) {
|
|
18
20
|
this.options = this.normalizeOptions(options);
|
|
@@ -33,6 +35,15 @@ class RDAPClient {
|
|
|
33
35
|
followRedirects: this.options.followRedirects,
|
|
34
36
|
maxRedirects: this.options.maxRedirects,
|
|
35
37
|
ssrfProtection: this.ssrfProtection,
|
|
38
|
+
logRedirect: (fromUrl, toUrl) => {
|
|
39
|
+
this.logger?.warn(`Redirect: ${fromUrl} → ${toUrl}`);
|
|
40
|
+
if (this.debugEnabled && this.debugLogger) {
|
|
41
|
+
this.debugLogger.debug('Redirect occurred', {
|
|
42
|
+
fromUrl,
|
|
43
|
+
toUrl,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
},
|
|
36
47
|
});
|
|
37
48
|
this.bootstrap = new http_1.BootstrapDiscovery(this.options.bootstrapUrl, this.fetcher);
|
|
38
49
|
const cacheOptions = typeof this.options.cache === 'boolean'
|
|
@@ -60,12 +71,26 @@ class RDAPClient {
|
|
|
60
71
|
enabled: true,
|
|
61
72
|
maxMetrics: 10000,
|
|
62
73
|
});
|
|
74
|
+
const validLogLevels = ['debug', 'info', 'warn', 'error'];
|
|
75
|
+
const configuredLevel = this.options.logging?.level;
|
|
76
|
+
const logLevel = configuredLevel && validLogLevels.includes(configuredLevel)
|
|
77
|
+
? configuredLevel
|
|
78
|
+
: 'info';
|
|
63
79
|
this.logger = new Logger_1.Logger({
|
|
64
|
-
level:
|
|
80
|
+
level: logLevel,
|
|
65
81
|
enabled: true,
|
|
66
82
|
logRequests: true,
|
|
67
83
|
logResponses: true,
|
|
68
84
|
});
|
|
85
|
+
const debugOptions = this.options.debug;
|
|
86
|
+
this.debugEnabled = typeof debugOptions === 'boolean' ? debugOptions : debugOptions?.enabled ?? false;
|
|
87
|
+
this.debugLogger = typeof debugOptions === 'object' && debugOptions?.logger ? debugOptions.logger : undefined;
|
|
88
|
+
const middlewareOpts = this.options.middleware;
|
|
89
|
+
this.middlewareManager = new MiddlewareHooks_1.MiddlewareManager(middlewareOpts);
|
|
90
|
+
const dedupOpts = this.options.deduplication;
|
|
91
|
+
this.queryDeduplicator = new QueryDeduplicator_1.QueryDeduplicator(typeof dedupOpts === 'boolean'
|
|
92
|
+
? { enabled: dedupOpts }
|
|
93
|
+
: dedupOpts);
|
|
69
94
|
this.batchProcessor = new BatchProcessor_1.BatchProcessor(this);
|
|
70
95
|
this.orchestrator = new services_1.QueryOrchestrator({
|
|
71
96
|
cache: this.cache,
|
|
@@ -78,6 +103,10 @@ class RDAPClient {
|
|
|
78
103
|
rateLimiter: this.rateLimiter,
|
|
79
104
|
metricsCollector: this.metricsCollector,
|
|
80
105
|
logger: this.logger,
|
|
106
|
+
debugEnabled: this.debugEnabled,
|
|
107
|
+
debugLogger: this.debugLogger,
|
|
108
|
+
middleware: this.middlewareManager,
|
|
109
|
+
deduplicator: this.queryDeduplicator,
|
|
81
110
|
});
|
|
82
111
|
}
|
|
83
112
|
async domain(domain) {
|
|
@@ -89,6 +118,12 @@ class RDAPClient {
|
|
|
89
118
|
async asn(asn) {
|
|
90
119
|
return this.orchestrator.queryASN(asn);
|
|
91
120
|
}
|
|
121
|
+
async nameserver(nameserver) {
|
|
122
|
+
return this.orchestrator.queryNameserver(nameserver);
|
|
123
|
+
}
|
|
124
|
+
async entity(handle, serverUrl) {
|
|
125
|
+
return this.orchestrator.queryEntity(handle, serverUrl);
|
|
126
|
+
}
|
|
92
127
|
async fetchWithRetry(url) {
|
|
93
128
|
const retryOptions = typeof this.options.retry === 'boolean'
|
|
94
129
|
? this.options.retry
|
|
@@ -142,6 +177,16 @@ class RDAPClient {
|
|
|
142
177
|
getConnectionPoolStats() {
|
|
143
178
|
return this.connectionPool.getStats();
|
|
144
179
|
}
|
|
180
|
+
use(hooks) {
|
|
181
|
+
this.middlewareManager.use(hooks);
|
|
182
|
+
return this;
|
|
183
|
+
}
|
|
184
|
+
getMiddlewareManager() {
|
|
185
|
+
return this.middlewareManager;
|
|
186
|
+
}
|
|
187
|
+
getDeduplicatorStats() {
|
|
188
|
+
return this.queryDeduplicator.getStats();
|
|
189
|
+
}
|
|
145
190
|
getLogger() {
|
|
146
191
|
return this.logger;
|
|
147
192
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RDAPClient.js","sourceRoot":"","sources":["../../../src/application/client/RDAPClient.ts"],"names":[],"mappings":";;;AAKA,sDAA0D;AAC1D,oDAAoF;AACpF,uEAAoE;AACpE,6EAA0E;AAC1E,4DAA4E;AAC5E,uFAAoF;AACpF,gEAA6D;
|
|
1
|
+
{"version":3,"file":"RDAPClient.js","sourceRoot":"","sources":["../../../src/application/client/RDAPClient.ts"],"names":[],"mappings":";;;AAKA,sDAA0D;AAC1D,oDAAoF;AACpF,uEAAoE;AACpE,6EAA0E;AAC1E,4DAA4E;AAC5E,uFAAoF;AACpF,gEAA6D;AAG7D,gDAAsD;AACtD,wDAA6D;AAO7D,wDAAgF;AAChF,0CAAgD;AAChD,+DAA4D;AAC5D,8DAA6D;AAE7D,0EAAuE;AAwCvE,MAAa,UAAU;IAuBrB,YAAY,UAA6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