tangerine 1.5.2 → 1.5.4
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 +15 -24
- package/index.js +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
<h1 align="center">
|
|
2
|
-
<a href="https://github.com/forwardemail/tangerine"><img src="https://raw.githubusercontent.com/forwardemail/tangerine/main/media/header.png" alt="Tangerine" /></a>
|
|
2
|
+
<a href="https://github.com/forwardemail/nodejs-dns-over-https-tangerine"><img src="https://raw.githubusercontent.com/forwardemail/nodejs-dns-over-https-tangerine/main/media/header.png" alt="Tangerine" /></a>
|
|
3
3
|
</h1>
|
|
4
4
|
<div align="center">
|
|
5
|
-
<a href="https://github.com/forwardemail/tangerine/actions/workflows/ci.yml"><img src="https://github.com/forwardemail/tangerine/actions/workflows/ci.yml/badge.svg" alt="build status" /></a>
|
|
5
|
+
<a href="https://github.com/forwardemail/nodejs-dns-over-https-tangerine/actions/workflows/ci.yml"><img src="https://github.com/forwardemail/nodejs-dns-over-https-tangerine/actions/workflows/ci.yml/badge.svg" alt="build status" /></a>
|
|
6
6
|
<a href="https://github.com/sindresorhus/xo"><img src="https://img.shields.io/badge/code_style-XO-5ed9c7.svg" alt="code style" /></a>
|
|
7
7
|
<a href="https://github.com/prettier/prettier"><img src="https://img.shields.io/badge/styled_with-prettier-ff69b4.svg" alt="styled with prettier" /></a>
|
|
8
8
|
<a href="https://lass.js.org"><img src="https://img.shields.io/badge/made_with-lass-95CC28.svg" alt="made with lass" /></a>
|
|
9
|
-
<a href="LICENSE"><img src="https://img.shields.io/github/license/forwardemail/tangerine.svg" alt="license" /></a>
|
|
9
|
+
<a href="LICENSE"><img src="https://img.shields.io/github/license/forwardemail/nodejs-dns-over-https-tangerine.svg" alt="license" /></a>
|
|
10
10
|
<a href="https://npm.im/tangerine"><img src="https://img.shields.io/npm/dt/tangerine.svg" alt="npm downloads" /></a>
|
|
11
11
|
</div>
|
|
12
12
|
<br />
|
|
13
13
|
<div align="center">
|
|
14
|
-
🍊 <a href="https://github.com/forwardemail/tangerine" target="_blank">Tangerine</a> is the best <a href="https://nodejs.org" target="_blank">Node.js</a> drop-in replacement for <a href="https://nodejs.org/api/dns.html#resolveroptions" target="_blank">dns.promises.Resolver</a> using <a href="https://en.wikipedia.org/wiki/DNS_over_HTTPS" target="_blank">DNS over HTTPS</a> ("DoH") via <a href="https://github.com/nodejs/undici" target="_blank">undici</a> with built-in retries, timeouts, smart server rotation, <a href="https://developer.mozilla.org/en-US/docs/Web/API/AbortController" target="_blank">AbortControllers</a>, and caching support for multiple backends (with TTL and purge support).
|
|
14
|
+
🍊 <a href="https://github.com/forwardemail/nodejs-dns-over-https-tangerine" target="_blank">Tangerine</a> is the best <a href="https://nodejs.org" target="_blank">Node.js</a> drop-in replacement for <a href="https://nodejs.org/api/dns.html#resolveroptions" target="_blank">dns.promises.Resolver</a> using <a href="https://en.wikipedia.org/wiki/DNS_over_HTTPS" target="_blank">DNS over HTTPS</a> ("DoH") via <a href="https://github.com/nodejs/undici" target="_blank">undici</a> with built-in retries, timeouts, smart server rotation, <a href="https://developer.mozilla.org/en-US/docs/Web/API/AbortController" target="_blank">AbortControllers</a>, and caching support for multiple backends (with TTL and purge support).
|
|
15
15
|
</div>
|
|
16
16
|
<hr />
|
|
17
17
|
<div align="center">
|
|
@@ -89,8 +89,7 @@ npm install tangerine undici
|
|
|
89
89
|
|
|
90
90
|
Our team at [Forward Email](https://forwardemail.net) (100% open-source and privacy-focused email service) needed a better solution for DNS.
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
<summary>After years of using the Node.js internal DNS module, we ran into these recurring patterns:</summary>
|
|
92
|
+
After years of using the Node.js internal DNS module, we ran into these recurring patterns:
|
|
94
93
|
|
|
95
94
|
* [Cloudflare](https://developers.cloudflare.com/1.1.1.1/encryption/dns-over-https/) and [Google](https://developers.google.com/speed/public-dns/docs/doh/) now have DNS over HTTPS servers ("DoH") available – and browsers such as Mozilla Firefox now have it [enabled by default](https://support.mozilla.org/en-US/kb/firefox-dns-over-https).
|
|
96
95
|
* DNS cache consistency across multiple servers cannot be easily accomplished using packages such as `unbound`, `dnsmasq`, and `bind` – and configuring `/etc/resolv.conf` across multiple Ubuntu versions is not enjoyable (even with Ansible). Maintaining logic at the application layer is much easier from a development, deployment, and maintenance perspective.
|
|
@@ -107,8 +106,6 @@ Our team at [Forward Email](https://forwardemail.net) (100% open-source and priv
|
|
|
107
106
|
* Writing tests against DNS-related infrastructure requires either hacky DNS mocking or a DNS server (manipulating cache is much easier).
|
|
108
107
|
* <u>**The Node.js community is lacking a high-quality and dummy-proof userland DNS package with sensible defaults.**</u>
|
|
109
108
|
|
|
110
|
-
</details>
|
|
111
|
-
|
|
112
109
|
### Why integrate DNS over HTTPS
|
|
113
110
|
|
|
114
111
|
> With DNS over HTTPS (DoH), DNS queries and responses are encrypted and sent via the HTTP or HTTP/2 protocols. DoH ensures that attackers cannot forge or alter DNS traffic. DoH uses port 443, which is the standard HTTPS traffic port, to wrap the DNS query in an HTTPS request. DNS queries and responses are camouflaged within other HTTPS traffic, since it all comes and goes from the same port. – [Cloudflare](https://developers.cloudflare.com/1.1.1.1/encryption/dns-over-https/)
|
|
@@ -133,8 +130,7 @@ Thanks to the authors of [dohdec](https://github.com/hildjj/dohdec), [dns-packet
|
|
|
133
130
|
* HTTP error codes are mapped to DNS error codes (the error `code` and `errno` properties will appear as if they're from `dns` usage). This is a configurable option enabled by default (see `returnHTTPErrors` option).
|
|
134
131
|
* If you need callbacks, then use [util.callbackify](https://nodejs.org/api/util.html#utilcallbackifyoriginal) (e.g. `const resolveTxt = callbackify(tangerine.resolveTxt)`).
|
|
135
132
|
|
|
136
|
-
|
|
137
|
-
<summary>We have also added several improvements and new features:</summary>
|
|
133
|
+
We have also added several improvements and new features:
|
|
138
134
|
|
|
139
135
|
* Default name servers used have been set to [Cloudflare's](https://1.1.1.1/) (`['1.1.1.1', '1.0.0.1']`) (as opposed to the system default – which is often set to a default which is not privacy-focused or simply forgotten to be set by DevOps teams). You may also want to use [Cloudflare's Malware and Adult Content Blocking](https://blog.cloudflare.com/introducing-1-1-1-1-for-families/) DNS server addresses instead.
|
|
140
136
|
* You can pass a custom `servers` option (as opposed to having to invoke `dns.setServers(...)` or `resolver.setServers(...)`).
|
|
@@ -146,10 +142,7 @@ Thanks to the authors of [dohdec](https://github.com/hildjj/dohdec), [dns-packet
|
|
|
146
142
|
* Debug via `NODE_DEBUG=tangerine node app.js` flag (uses [util.debuglog](https://nodejs.org/api/util.html#utildebuglogsection-callback)).
|
|
147
143
|
* The method `setLocalAddress()` will parse the IP address and port properly to pass along for use with the agent as `localAddress` and `localPort`. If you require IPv6 addresses with ports, you must encode it as `[IPv6]:PORT` ([similar to RFC 3986](https://serverfault.com/a/205794)).
|
|
148
144
|
|
|
149
|
-
</
|
|
150
|
-
|
|
151
|
-
<details>
|
|
152
|
-
<summary>All existing <code>syscall</code> values have been preserved:</summary>
|
|
145
|
+
All existing <code>syscall</code> values have been preserved:
|
|
153
146
|
|
|
154
147
|
* `resolveAny` → `queryAny`
|
|
155
148
|
* `resolve4` → `queryA`
|
|
@@ -166,8 +159,6 @@ Thanks to the authors of [dohdec](https://github.com/hildjj/dohdec), [dns-packet
|
|
|
166
159
|
* `resolveSoa` → `querySoa`
|
|
167
160
|
* `reverse` → `getHostByAddr`
|
|
168
161
|
|
|
169
|
-
</details>
|
|
170
|
-
|
|
171
162
|
|
|
172
163
|
## Usage and Examples
|
|
173
164
|
|
|
@@ -228,7 +219,7 @@ tangerine.resolve('forwardemail.net').then(console.log);
|
|
|
228
219
|
|
|
229
220
|
* Specify default request options based off the library under `requestOptions` below
|
|
230
221
|
* Instance methods of [dns.promises.Resolver](https://nodejs.org/api/dns.html) are mirrored to :tangerine: Tangerine.
|
|
231
|
-
* Resolver methods accept an optional `abortController` argument, which is an instance of [AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController). Note that :tangerine: Tangerine manages `AbortController` usage internally – so you most likely won't need to pass your own (see [index.js](https://github.com/forwardemail/tangerine/blob/main/index.js) for more insight).
|
|
222
|
+
* Resolver methods accept an optional `abortController` argument, which is an instance of [AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController). Note that :tangerine: Tangerine manages `AbortController` usage internally – so you most likely won't need to pass your own (see [index.js](https://github.com/forwardemail/nodejs-dns-over-https-tangerine/blob/main/index.js) for more insight).
|
|
232
223
|
* Resolver methods that accept `options` argument also accept an optional `options.purgeCache` option.
|
|
233
224
|
* Resolver methods support a `purgeCache` option as either `options.purgeCache` (Boolean) via `options` argument or `purgeCache` (Boolean) argument – see [API](#api) and [Cache](#cache) for more insight.
|
|
234
225
|
* If set to `true`, then the result will be re-queried and re-cached – see [Cache](#cache) documentation for more insight.
|
|
@@ -295,7 +286,7 @@ This mirrors output from <https://github.com/rthalley/dnspython>.
|
|
|
295
286
|
|
|
296
287
|
### `tangerine.resolveTlsa(hostname[, options, abortController]))`
|
|
297
288
|
|
|
298
|
-
This method was added for DANE and TLSA support. See this [excellent article](https://www.mailhardener.com/kb/dane), [index.js](https://github.com/forwardemail/tangerine/blob/main/index.js), and <https://github.com/nodejs/node/issues/39569> for more insight.
|
|
289
|
+
This method was added for DANE and TLSA support. See this [excellent article](https://www.mailhardener.com/kb/dane), [index.js](https://github.com/forwardemail/nodejs-dns-over-https-tangerine/blob/main/index.js), and <https://github.com/nodejs/node/issues/39569> for more insight.
|
|
299
290
|
|
|
300
291
|
This function returns a Promise that resolves with an Array with parsed values from results:
|
|
301
292
|
|
|
@@ -381,7 +372,7 @@ console.log('mx', mx);
|
|
|
381
372
|
|
|
382
373
|
## Options
|
|
383
374
|
|
|
384
|
-
Similar to the `options` argument from `new dns.promises.Resolver(options)` invocation – :tangerine: Tangerine also has its own options with default `dns` behavior mirrored. See [index.js](https://github.com/forwardemail/tangerine/blob/main/index.js) for more insight into how these options work.
|
|
375
|
+
Similar to the `options` argument from `new dns.promises.Resolver(options)` invocation – :tangerine: Tangerine also has its own options with default `dns` behavior mirrored. See [index.js](https://github.com/forwardemail/nodejs-dns-over-https-tangerine/blob/main/index.js) for more insight into how these options work.
|
|
385
376
|
|
|
386
377
|
| Property | Type | Default Value | Description |
|
|
387
378
|
| ------------------------- | ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
@@ -507,7 +498,7 @@ If you run into issues while using :tangerine: Tangerine, then these recommendat
|
|
|
507
498
|
Contributors can run benchmarks locally by cloning the repository, installing dependencies, and running the benchmarks script:
|
|
508
499
|
|
|
509
500
|
```sh
|
|
510
|
-
git clone https://github.com/forwardemail/tangerine.git
|
|
501
|
+
git clone https://github.com/forwardemail/nodejs-dns-over-https-tangerine.git
|
|
511
502
|
cd tangerine
|
|
512
503
|
npm install
|
|
513
504
|
npm run benchmarks
|
|
@@ -523,9 +514,9 @@ BENCHMARK_PROTOCOL="http" BENCHMARK_HOST="127.0.0.1" BENCHMARK_PORT="4000" BENCH
|
|
|
523
514
|
|
|
524
515
|
We have written extensive benchmarks to show that :tangerine: Tangerine is as fast as the native Node.js DNS module (with the exception of the `lookup` command). Note that performance is opinionated – since rate limiting plays a factor dependent on the DNS servers you are using and since caching is most likely going to takeover.
|
|
525
516
|
|
|
526
|
-
The latest benchmark results are viewable on GitHub under this repository's [GitHub CI actions logs](https://github.com/forwardemail/tangerine/actions?query=event%3Apush):
|
|
517
|
+
The latest benchmark results are viewable on GitHub under this repository's [GitHub CI actions logs](https://github.com/forwardemail/nodejs-dns-over-https-tangerine/actions?query=event%3Apush):
|
|
527
518
|
|
|
528
|
-
> [Node 16 on ubuntu-latest](https://github.com/forwardemail/tangerine/actions/runs/4297805550/jobs/7491228635#step:6:1)
|
|
519
|
+
> [Node 16 on ubuntu-latest](https://github.com/forwardemail/nodejs-dns-over-https-tangerine/actions/runs/4297805550/jobs/7491228635#step:6:1)
|
|
529
520
|
|
|
530
521
|
```diff
|
|
531
522
|
node benchmarks/lookup && node benchmarks/resolve && node benchmarks/reverse
|
|
@@ -562,7 +553,7 @@ dns.promises.reverse with caching x 5,123,900 ops/sec ±0.96% (85 runs sampled)
|
|
|
562
553
|
+Fastest without caching is: tangerine.reverse GET without caching
|
|
563
554
|
```
|
|
564
555
|
|
|
565
|
-
> [Node 18 on ubuntu latest](https://github.com/forwardemail/tangerine/actions/runs/4297805550/jobs/7491228742#step:6:1)
|
|
556
|
+
> [Node 18 on ubuntu latest](https://github.com/forwardemail/nodejs-dns-over-https-tangerine/actions/runs/4297805550/jobs/7491228742#step:6:1)
|
|
566
557
|
|
|
567
558
|
```diff
|
|
568
559
|
node benchmarks/lookup && node benchmarks/resolve && node benchmarks/reverse && node benchmarks/http
|
|
@@ -736,4 +727,4 @@ Fastest is undici GET request
|
|
|
736
727
|
|
|
737
728
|
##
|
|
738
729
|
|
|
739
|
-
<a href="#"><img src="https://raw.githubusercontent.com/forwardemail/tangerine/main/media/footer.png" alt="#" /></a>
|
|
730
|
+
<a href="#"><img src="https://raw.githubusercontent.com/forwardemail/nodejs-dns-over-https-tangerine/main/media/footer.png" alt="#" /></a>
|
package/index.js
CHANGED
|
@@ -1956,7 +1956,7 @@ class Tangerine extends dns.promises.Resolver {
|
|
|
1956
1956
|
default: {
|
|
1957
1957
|
this.options.logger.error(
|
|
1958
1958
|
new Error(
|
|
1959
|
-
`Submit a PR at <https://github.com/forwardemail/tangerine> with proper parsing for ${rrtype} records. You can reference <https://github.com/rthalley/dnspython/tree/master/dns/rdtypes/ANY> for inspiration.`
|
|
1959
|
+
`Submit a PR at <https://github.com/forwardemail/nodejs-dns-over-https-tangerine> with proper parsing for ${rrtype} records. You can reference <https://github.com/rthalley/dnspython/tree/master/dns/rdtypes/ANY> for inspiration.`
|
|
1960
1960
|
)
|
|
1961
1961
|
);
|
|
1962
1962
|
return result.answers;
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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.4",
|
|
5
5
|
"author": "Forward Email (https://forwardemail.net)",
|
|
6
6
|
"bugs": {
|
|
7
|
-
"url": "https://github.com/forwardemail/tangerine/issues"
|
|
7
|
+
"url": "https://github.com/forwardemail/nodejs-dns-over-https-tangerine/issues"
|
|
8
8
|
},
|
|
9
9
|
"contributors": [
|
|
10
10
|
"Forward Email (https://forwardemail.net)"
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"files": [
|
|
63
63
|
"index.js"
|
|
64
64
|
],
|
|
65
|
-
"homepage": "https://github.com/forwardemail/tangerine",
|
|
65
|
+
"homepage": "https://github.com/forwardemail/nodejs-dns-over-https-tangerine",
|
|
66
66
|
"keywords": [
|
|
67
67
|
"1:1",
|
|
68
68
|
"abort",
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
},
|
|
154
154
|
"repository": {
|
|
155
155
|
"type": "git",
|
|
156
|
-
"url": "https://github.com/forwardemail/tangerine"
|
|
156
|
+
"url": "https://github.com/forwardemail/nodejs-dns-over-https-tangerine"
|
|
157
157
|
},
|
|
158
158
|
"scripts": {
|
|
159
159
|
"ava": "cross-env NODE_ENV=test ava",
|