Get the Server Name Indication of a raw TLS stream
npm install sniGet the Server Name Indication of a raw TLS stream (without Node's TLS module)
npm install sni
`Usage
`js
var sni = require("sni")
, net = require("net");net.createServer(function(socket) {
socket.once("data", function(data) { // Listen on the HELLO packet
console.log(sni(data)); // www.example.com or null if no servername was found
});
}).listen(443); // Listen on the HTTPS port
`Benchmark
1,000,000 rounds took me 157 ms.
Test it for yourself with npm run bench`.