New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

sni

Package Overview
Dependencies
Maintainers
3
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sni

Get the Server Name Indication of a raw TLS stream

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
848
decreased by-39.56%
Maintainers
3
Weekly downloads
 
Created
Source

sni

Get the Server Name Indication of a raw TLS stream (without Node's TLS module)

Installation

npm install sni

Usage

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.

Why?

Because I wanted to route my HTTPS streams without actually encoding them with Node's TLS module.

Note

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.

License

MIT

Keywords

FAQs

Package last updated on 14 Jun 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc