1.0.1 • Published 8 years ago
ethernet v1.0.1
ethernet
Decodes Ethernet headers
Supports:
- Plain Ethernet (
destination
,source
,ethertype
,payload
) - 802.1Q tag (above properties, plus
tag
) - 802.1ad and QinQ double tag (
stag
andctag
)
Usage
Install:
npm install --save ethernet
Use (ES6 or TypeScript):
import decode from "ethernet";
let rawData = getRawFrameSomehow();
let headers = decode(rawData);
console.log(headers);
// {
// destination: '010203040506',
// source: '0a0b0c0d0e0f',
// tag: { tpid: 33024, tci: { pcp: 0, dei: 0, vid: 16 } }
// ethertype: 2048,
// payload: ...,
// }
Notes
Bugs? Please, file an issue, or submit a pull request!
License: PDDL-1.0