sagi/dns-over-https-node

ERR_OUT_OF_RANGE

camhart opened this issue · 0 comments

const doh = require('@sagi.io/dns-over-https')

async function run() {
let r1 = await doh.query({
name: 'google.com',
method: 'GET',
hostname: 'dns.google.com',
path: '/dns-query',
port: 443,
userAgent: '@sagi.io/dns-over-https',
type: 'A',
klass: 'IN',
useHttps: true,
}).catch(err => { console.log(err)})

console.log(rl)
}

run()

That explodes with:

C:\Users\Cam\projects\playground\base64url>node bug.js
internal/buffer.js:77
  throw new ERR_OUT_OF_RANGE(type || 'offset',
  ^

RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 785. Received 858
�[90m    at boundsError (internal/buffer.js:77:9)�[39m
�[90m    at Buffer.readUInt16BE (internal/buffer.js:323:5)�[39m
    at Object.question.decode (C:\Users\Cam\projects\playground\base64url\node_modules\�[4mdns-packet�[24m\index.js:1417:31)
    at decodeList (C:\Users\Cam\projects\playground\base64url\node_modules\�[4mdns-packet�[24m\index.js:1537:19)
    at Object.exports.decode (C:\Users\Cam\projects\playground\base64url\node_modules\�[4mdns-packet�[24m\index.js:1477:12)
    at IncomingMessage.<anonymous> (C:\Users\Cam\projects\playground\base64url\node_modules\�[4m@sagi.io�[24m\dns-over-https\index.js:78:31)
�[90m    at IncomingMessage.emit (events.js:321:20)�[39m
�[90m    at IncomingMessage.Readable.read (_stream_readable.js:508:10)�[39m
�[90m    at flow (_stream_readable.js:979:34)�[39m
�[90m    at resume_ (_stream_readable.js:960:3)�[39m {
  code: �[32m'ERR_OUT_OF_RANGE'�[39m
}