tangerine 1.5.1 → 1.5.2
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 +4 -2
- package/index.js +4 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
* [`tangerine.reverse(ip[, abortController, purgeCache])`](#tangerinereverseip-abortcontroller-purgecache)
|
|
57
57
|
* [`tangerine.setDefaultResultOrder(order)`](#tangerinesetdefaultresultorderorder)
|
|
58
58
|
* [`tangerine.setServers(servers)`](#tangerinesetserversservers)
|
|
59
|
-
* [`tangerine.spoofPacket(hostname, rrtype, answers[, json])`](#tangerinespoofpackethostname-rrtype-answers-json)
|
|
59
|
+
* [`tangerine.spoofPacket(hostname, rrtype, answers[, json, expires = 30000])`](#tangerinespoofpackethostname-rrtype-answers-json-expires--30000)
|
|
60
60
|
* [Options](#options)
|
|
61
61
|
* [Cache](#cache)
|
|
62
62
|
* [Compatibility](#compatibility)
|
|
@@ -332,7 +332,7 @@ This mirrors output from <https://github.com/rthalley/dnspython>.
|
|
|
332
332
|
|
|
333
333
|
### `tangerine.setServers(servers)`
|
|
334
334
|
|
|
335
|
-
### `tangerine.spoofPacket(hostname, rrtype, answers[, json])`
|
|
335
|
+
### `tangerine.spoofPacket(hostname, rrtype, answers[, json, expires = 30000])`
|
|
336
336
|
|
|
337
337
|
This method is useful for writing tests to spoof DNS packets in-memory.
|
|
338
338
|
|
|
@@ -340,6 +340,8 @@ The `rrtype` must be either `"TXT"` or `"MX"`, and `answers` must be an Array of
|
|
|
340
340
|
|
|
341
341
|
If you pass `json` as `true`, then value returned will be converted to JSON via `JSON.stringify`.
|
|
342
342
|
|
|
343
|
+
The last argument `expires` can either be a `Date` or `Number`. This is the value used for calculating the DNS packet expiration. If it is a `Number`, then the `expires` value will be `Date.now() + expires`. The default value is `30000`, which means it will expire in 30 seconds.
|
|
344
|
+
|
|
343
345
|
For example, if you want to spoof TXT and MX records:
|
|
344
346
|
|
|
345
347
|
```js
|
package/index.js
CHANGED
|
@@ -1425,7 +1425,8 @@ class Tangerine extends dns.promises.Resolver {
|
|
|
1425
1425
|
this.options.servers = new Set(servers);
|
|
1426
1426
|
}
|
|
1427
1427
|
|
|
1428
|
-
|
|
1428
|
+
// eslint-disable-next-line max-params
|
|
1429
|
+
spoofPacket(name, rrtype, answers = [], json = false, expires = 30000) {
|
|
1429
1430
|
if (typeof name !== 'string') {
|
|
1430
1431
|
const err = new TypeError('The "name" argument must be of type string.');
|
|
1431
1432
|
err.code = 'ERR_INVALID_ARG_TYPE';
|
|
@@ -1489,7 +1490,8 @@ class Tangerine extends dns.promises.Resolver {
|
|
|
1489
1490
|
}
|
|
1490
1491
|
],
|
|
1491
1492
|
ttl: 300,
|
|
1492
|
-
expires:
|
|
1493
|
+
expires:
|
|
1494
|
+
expires instanceof Date ? expires.getTime() : Date.now() + expires
|
|
1493
1495
|
};
|
|
1494
1496
|
|
|
1495
1497
|
return json ? JSON.stringify(obj) : obj;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tangerine",
|
|
3
3
|
"description": "Tangerine is the best Node.js drop-in replacement for dns.promises.Resolver using DNS over HTTPS (\"DoH\") via undici with built-in retries, timeouts, smart server rotation, AbortControllers, and caching support for multiple backends (with TTL and purge support).",
|
|
4
|
-
"version": "1.5.
|
|
4
|
+
"version": "1.5.2",
|
|
5
5
|
"author": "Forward Email (https://forwardemail.net)",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/forwardemail/tangerine/issues"
|