npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

node-tcp-syn

v0.1.0

Published

TCP SYN packet collector for Node.js

Readme

TCP SYN packet collector for Node.js

A Node.js N-API addon that collects the initial SYN packet of a client establishing a connection. It seamlessly integrates with built-in Node.js servers and does not require the setup of external packet-capturing interfaces like libpcap or BPF-based ones.

The module's primary purpose is to provide a foundation for in-band passive connection fingerprinting within the standard network processing flow. It returns a SYN packet as a raw Uint8Array, representing the exact bytes as they're seen on a network socket. Further packet parsing and analysis must be performed by dependent modules like fingerprinters.

Compatibility

The distributed npm package contains native code that works only on Linux systems with Kernel 4.2+ and requires installed compiler toolchain to build. Other OSes and kernels are not supported nor planned.

Installation

This package is available for installation from the npm registry:

$ npm install node-tcp-syn

Usage

To collect SYN packets, you must first enable the feature on a net.Server instance using the enable() function. Once enabled, you can retrieve the collected SYN packets by calling the retrieve() function on a client net.Socket instance.

Follow the next example, also available to run as examples/server.js.

import { createServer } from 'node:net';
import { enable, retrieve } from 'node-tcp-syn';

const server = createServer((socket) => {
  console.log('New client is connecting');

  // Retrieve the collected SYN packet
  const synPacket = retrieve(socket);

  console.log('SYN packet:', synPacket);

  socket.end('HTTP/1.1 200 OK\r\n\r\n');
});

server.listen(3000, () => {
  console.log('TCP server is listening on port 3000');

  // Enable SYN packet collection
  const enabled = enable(server);

  if (enabled) {
    console.log('SYN collecting is enabled');
  }
  else {
    console.warn('SYN collecting is not supported');
  }
});

API

enable(server: net.Server): boolean

Enables the server to save the initial SYN packet on its client sockets. A return value indicates whether collecting was enabled.

retrieve(socket: net.Socket, cache: boolean): Uint8Array

Retrieves saved SYN packet from the client socket. Retrieval effectively frees memory and deletes saved packet by the kernel, so if you need to get the same SYN multiple times from the same socket, use cache: true option.

License

This project originally emerged from the R&D process at Antibot LLC. Now it's licensed under the MIT license, allowing free use for any purpose with credit to the original authors.