IP address utility.
See the Documentation
npm install @cldn/ip
import {IPv4, IPv6, Subnet} from "@cldn/ip";
const ipv6 = IPv4.fromString("::ffff:192.168.1.42");
const ipv4 = ipv6.getMappedIPv4();
const subnet = Subnet.fromString("192.168.0.0/16");
subnet.has(ipv4); // true
Copyright © 2024–2025 Cloudnode OÜ
This file is part of @cldn/ip.
@cldn/ip is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
@cldn/ip is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.