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

ip-stream

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ip-stream

Object stream transform that parses IP headers.

  • 0.2.1
  • npm
  • Socket score

Version published
Weekly downloads
8
decreased by-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

ip-stream

Object stream transform that parses IP headers.

Build Status

Example

var IpStream = require('ip-stream');
var EtherStream = require('ether-stream');
var PcapStream = require('pcap-stream');

var pstream = new PcapStream(PCAP_FILE);
var estream = new EtherStream();
var ipstream = new IpStream();

pstream.pipe(estream).pipe(ipstream);

ipstream.on('readable', function() {
  var msg = ipstream.read();

  msg.ether.src === '12:34:56:65:43:21';  // Ethernet frame is still available

  msg.ip.src === '1.1.1.1';   // IP header data is available at .ip property
  msg.ip.dst === '2.2.2.2';
  msg.ip.protocol === 'udp';

  var payload = msg.data;     // IP packet data is available at .data property
});

// Packets that cannot be parsed as IP are emitted with 'ignored' event
ipstream.on('ignored', function(msg) {
  console.log('Ignored message [' + msg + ']');
});

ipstream.read(0);

// you can also control how fragments are handled
var ipsream2 = new IpStream({fragments: 'reassemble'}); // the default
var ipsream3 = new IpStream({fragments: 'drop'});       // ignore fragments
var ipsream4 = new IpStream({fragments: 'pass'});       // passthrough frags

// When reassembling, unmatched fragments are timed-out after 30 seconds by
// default, but you can configure that:
var ipsream5 = new IpStream({fragmentTimeout: 5000});

Keywords

FAQs

Package last updated on 24 Feb 2013

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