Get the Server Name Indication of a raw TLS stream (without Node's TLS module)
npm install sni
var sni =net = ;net; // Listen on the HTTPS port
1,000,000 rounds took me 157 ms.
Test it for yourself with
npm run bench.
Because I wanted to route my HTTPS streams without actually encoding them with Node's TLS module.
It is recommended that you attempt to determine if your data actually is a TLS client hello before attempting to extract the SNI. A library to do just such a thing can be found here.