File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed
Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change 1+ # @cldn/ip
2+
3+ IP address utility.
4+
5+ ## Features
6+
7+ - Works in the browser and in Node.js without any polyfills. (A bundler like Webpack or Vite is recommended for the
8+ browser)
9+ - IPv4 and IPv6 classes.
10+ - Get IP address as BigInt, binary or string.
11+ - Extract IPv4-mapped IPv6 addresses.
12+ - Subnet class with methods to check IP membership, create netmask, list addresses, etc.
13+ - Network class for working with multiple subnets.
14+ - Written in TypeScript.
15+
16+ See the [ ** Documentation** ] ( https://ip.cldn.pro )
17+
18+ ## Installation
19+
20+ ``` sh
21+ npm install @cldn/ip
22+ ```
23+
24+ ## Usage
25+
26+ ``` ts
27+ import {IPv4 , IPv6 , Subnet } from " @cldn/ip" ;
28+
29+ const ipv6 = IPv4 .fromString (" ::ffff:192.168.1.42" );
30+ const ipv4 = ipv6 .getMappedIPv4 ();
31+
32+ const subnet = Subnet .fromString (" 192.168.0.0/16" );
33+ subnet .has (ipv4 ); // true
34+ ```
35+
36+ ## Licence
37+
38+ Copyright © 2024 Cloudnode OÜ
39+
40+ This file is part of @cldn/ip .
41+
42+ @cldn/ip is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General
43+ Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
44+ later version.
45+
46+ @cldn/ip is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
47+ warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
48+ details.
You can’t perform that action at this time.
0 commit comments