🚀 DAY 2 OF LAUNCH WEEK: Unify Your Security Stack with Socket Basics.Learn more →
Socket
Book a DemoInstallSign in
Socket

ip-packet

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ip-packet

Encode/decode raw ip packets

latest
Source
npmnpm
Version
2.2.1
Version published
Weekly downloads
93
-13.08%
Maintainers
2
Weekly downloads
 
Created
Source

ip-packet

Encode/decode raw ip packets

npm install ip-packet

Usage

// compact-encoder
const ip = require('ip-packet')

ip.encode(state, { version, ... })
console.log(ip.decode(state))

API

ip.encode(state, packet)

Encode a packet. A packet should look like this

{
  version: 4,
  dscp: 0,
  ecn: 0,
  identification: 0,
  flags: 0,
  fragmentOffset: 0,
  ttl: 0,
  protocol: 0,
  checksum: 0,
  sourceIp: '127.0.0.1',
  destinationIp: '127.0.0.1',
  data: <Buffer>
}

`packet = ip.decode(state)

Decode a packet.

ip.preencode(state, packet)

Preencode a packet.

License

Apache-2.0

FAQs

Package last updated on 05 Jul 2024

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