SadeghHayeri / GreenTunnel

GreenTunnel is an anti-censorship utility designed to bypass the DPI system that is put in place by various ISPs to block access to certain websites.
MIT License
4.24k stars 273 forks source link

TypeError when using DNS over TLS #113

Open piratecaveman opened 3 years ago

piratecaveman commented 3 years ago

When using dns type TLS, there is a TypeError and GreenTunnel falls back to use Cloudflare instead

Steps to reproduce the behavior:

  1. Launch Green Tunnel with gt --dns-type tls --dns-server 8622a7.dns.nextdns.io -v "*"
  2. See error:
    2021-07-14T04:45:49.348Z green-tunnel:dns TypeError [ERR_INVALID_ARG_TYPE]: The "string" argument must be of type string or an instance of Buffer or ArrayBuffer. Received undefined
    at new NodeError (node:internal/errors:363:5)
    at Function.byteLength (node:buffer:732:11)
    at Object.name.encodingLength (/home/wraith/.node_modules/lib/node_modules/green-tunnel/node_modules/dns-over-tls/node_modules/dns-packet/index.js:81:17)
    at Object.question.encodingLength (/home/wraith/.node_modules/lib/node_modules/green-tunnel/node_modules/dns-over-tls/node_modules/dns-packet/index.js:1433:15)
    at encodingLengthList (/home/wraith/.node_modules/lib/node_modules/green-tunnel/node_modules/dns-over-tls/node_modules/dns-packet/index.js:1523:52)
    at Object.exports.encodingLength (/home/wraith/.node_modules/lib/node_modules/green-tunnel/node_modules/dns-over-tls/node_modules/dns-packet/index.js:1491:5)
    at Object.exports.encode (/home/wraith/.node_modules/lib/node_modules/green-tunnel/node_modules/dns-over-tls/node_modules/dns-packet/index.js:1445:46)
    at Object.exports.streamEncode (/home/wraith/.node_modules/lib/node_modules/green-tunnel/node_modules/dns-over-tls/node_modules/dns-packet/index.js:1498:23)
    at /home/wraith/.node_modules/lib/node_modules/green-tunnel/node_modules/dns-over-tls/lib/dnstls.js:50:39
    at new Promise (<anonymous>)

Expected behavior No Errors should occur

Desktop (please complete the following information):

Additional context Logs attached green.log