Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cloudnode-pro/ip
IP address utility
https://github.com/cloudnode-pro/ip
cidr ip ipcalc ipv4 ipv6 net netmask network subnet
Last synced: about 2 months ago
JSON representation
IP address utility
- Host: GitHub
- URL: https://github.com/cloudnode-pro/ip
- Owner: cloudnode-pro
- License: lgpl-3.0
- Created: 2024-11-01T17:10:04.000Z (3 months ago)
- Default Branch: master
- Last Pushed: 2024-11-27T09:40:53.000Z (about 2 months ago)
- Last Synced: 2024-11-27T10:31:40.273Z (about 2 months ago)
- Topics: cidr, ip, ipcalc, ipv4, ipv6, net, netmask, network, subnet
- Language: TypeScript
- Homepage:
- Size: 144 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# @cldn/ip
IP address utility.
## Features
- Works in the browser and in Node.js without any polyfills. (A bundler like Webpack or Vite is recommended for the
browser)
- IPv4 and IPv6 classes.
- Get IP address as BigInt, binary or string.
- Extract IPv4-mapped IPv6 addresses.
- Subnet class with methods to check IP membership, create netmask, list addresses, etc.
- Network class for working with multiple subnets.
- Written in TypeScript.See the [**Documentation**](https://ip.cldn.pro)
## Installation
```sh
npm install @cldn/ip
```## Usage
```ts
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
```## Licence
Copyright © 2024 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.