is-tls

check if a socket's first packet is secure

Usage no npm install needed!

<script type="module">
  import isTls from 'https://cdn.skypack.dev/is-tls';
</script>

README

isTLS

check if a socket's first packet is secure

Example

server.on('connection', function(socket){
  socket.once('data', function(packet){
    if (isTLS(packet)) {
      doSecureStuff()
    } else {
      doInsecureStuff();
    }
  });
});

License

MIT