network-packets
v0.0.1
Published
Parse information from network packets at layers 2 (Ethernet), 3 (IPv4/IPv6, ARP), and 4 (TCP, UDP, ICMP, ICMP6).
Readme
network-packets
Parse information from network packets at layers 2 (Ethernet), 3 (IPv4/IPv6, ARP), and 4 (TCP, UDP, ICMP, ICMP6).
Given a network packet either starting at the Ethernet header or starting at the IP header, parse the packet and return a structure.
Installation
npm install network-packetsAPI
Full API documentation is available.
Example:
import {LINKTYPE_ETHERNET, LINKTYPE_RAW, readPacket} from 'network-packets';
const eth = new Uint8Array([/* Ethernet Bytes... */]);
const ethPacket = readPacket(eth, LINKTYPE_ETHERNET);
const ipv6 = new Uint8Array([/* IPv6 Bytes... */]);
const ipv6Packet = readPacket(ipv6, LINKTYPE_RAW);