ipaddr-js
Installation
SKILL.md
ipaddr.js
Use this skill for ipaddr.js v2 IPv4 and IPv6 parsing, validation, CIDR matching, and range classification. Snapshot 2.5.0 (2026-08). MIT license. CommonJS with bundled types; Node.js 10+ and browsers. Express (proxy-addr) depends on it.
Workflow
- Inspect the local surface:
ipaddr.jsversion (2.x; 1.x is for Node < 10), import style, and whether input comes from sockets, headers, or user text. - Pick the entry point:
- Untrusted text, strict:
ipaddr.IPv4.isValidFourPartDecimal(s)oripaddr.IPv6.isValid(s), thenipaddr.parse(s). - Socket / dual-stack address:
ipaddr.process(s)to unwrap::ffff:a.b.c.dto IPv4. - CIDR config:
ipaddr.parseCIDR(s)once at startup, thenaddr.match(range)oripaddr.subnetMatch.
- Untrusted text, strict:
- Route detail:
- Full API, range names, TypeScript notes: api.md
- Verified edge cases, SSRF and proxy recipes: pitfalls-recipes.md
- Prefer
bun/bunxin command examples. Import asimport ipaddr from 'ipaddr.js'(ESM interop withesModuleInterop) orconst ipaddr = require('ipaddr.js'). Match the project.