tangerine 1.4.8 → 1.4.9

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 (2) hide show
  1. package/index.js +22 -11
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1847,19 +1847,30 @@ class Tangerine extends dns.promises.Resolver {
1847
1847
  // if it returns answers with `type: TLSA` then recursively lookup
1848
1848
  // 3 1 1 D6FEA64D4E68CAEAB7CBB2E0F905D7F3CA3308B12FD88C5B469F08AD 7E05C7C7
1849
1849
  return result.answers.map((answer) => {
1850
- if (!Buffer.isBuffer(answer.data))
1851
- throw new Error('Buffer was not available');
1852
-
1853
- // <https://www.mailhardener.com/kb/dane>
1854
- return {
1850
+ const obj = {
1855
1851
  name: answer.name,
1856
- ttl: answer.ttl,
1857
- // <https://github.com/rthalley/dnspython/blob/98b12e9e43847dac615bb690355d2fabaff969d2/dns/rdtypes/tlsabase.py#L35>
1858
- usage: answer.data.subarray(0, 1).readUInt8(),
1859
- selector: answer.data.subarray(1, 2).readUInt8(),
1860
- mtype: answer.data.subarray(2, 3).readUInt8(),
1861
- cert: answer.data.subarray(3)
1852
+ ttl: answer.ttl
1862
1853
  };
1854
+
1855
+ // <https://www.mailhardener.com/kb/dane>
1856
+ // <https://github.com/rthalley/dnspython/blob/98b12e9e43847dac615bb690355d2fabaff969d2/dns/rdtypes/tlsabase.py#L35>
1857
+ if (Buffer.isBuffer(answer.data)) {
1858
+ obj.usage = answer.data.subarray(0, 1).readUInt8();
1859
+ obj.selector = answer.data.subarray(1, 2).readUInt8();
1860
+ obj.mtype = answer.data.subarray(2, 3).readUInt8();
1861
+ obj.cert = answer.data.subarray(3);
1862
+ } else {
1863
+ obj.usage = answer.data.usage;
1864
+ obj.selector = answer.data.selector;
1865
+ obj.mtype = answer.data.matchingType;
1866
+ obj.cert = answer.data.certificate;
1867
+ }
1868
+
1869
+ // aliases to match Cloudflare DNS response
1870
+ obj.matchingType = obj.mtype;
1871
+ obj.certificate = obj.cert;
1872
+
1873
+ return obj;
1863
1874
  });
1864
1875
  }
1865
1876
 
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.4.8",
4
+ "version": "1.4.9",
5
5
  "author": "Forward Email (https://forwardemail.net)",
6
6
  "bugs": {
7
7
  "url": "https://github.com/forwardemail/tangerine/issues"