isTruncatedLayerError

new isTruncatedLayerError(dataopt)

Represents a network packet with protocol layer support Provides fluent interface for packet crafting and parsing
Parameters:
NameTypeAttributesDescription
dataObject<optional>
Packet data, options object, or existing packet
Properties
NameTypeAttributesDescription
bufferBuffer<optional>
Raw packet buffer for parsing existing packets
ifaceObject<optional>
Network interface configuration
Examples
// Create an ICMP echo request packet
const packet = new Packet({ iface: 'eth0' })
  .ethernet({ dst: 'ff:ff:ff:ff:ff:ff', src: '00:11:22:33:44:55' })
  .ipv4({ src: '192.168.1.1', dst: '8.8.8.8', timeToLive: 64 })
  .icmp({ type: 8, code: 0, id: 12345, sequence: 1 });
// Parse existing packet
const packet = new Packet({ buffer: rawBuffer });
console.log(packet.layers.IPv4.src);

Extends

  • LayersList