range_check
- Version 4.1.0
- Published
- 30.7 kB
- 2 dependencies
- BSD-2-Clause license
Install
npm i range_check
yarn add range_check
pnpm add range_check
Overview
This is a simple module to validate IP address, check ip address version, check if ip is within a range.
Index
Functions
function displayIP
displayIP: (addr: string) => any;
function inRange
inRange: (addr: string, range: string | string[]) => boolean;
function IPFingerprint
IPFingerprint: (addr: string) => string;
Generates a consistent fingerprint for IP addresses that can be used for bot tracking - For IPv4: Uses the full address - For IPv6: Uses the /64 network prefix
Parameter addr
The IP address to generate a fingerprint for
Returns
A string in the format 'v4:ADDRESS' or 'v6:PREFIX'
function IPFingerprintHashed
IPFingerprintHashed: (addr: string) => Promise<string>;
Asynchronously generates a hashed fingerprint for IP addresses using Web Crypto API This works in both browser and Node.js environments that support Web Crypto
Parameter addr
The IP address to generate a fingerprint for
Returns
A Promise that resolves to a string in the format 'v4:HASH' or 'v6:HASH'
function isIP
isIP: (addr: string) => boolean;
function isIPInRangeOrPrivate
isIPInRangeOrPrivate: ( ip: string, options?: { ranges?: string[] | string; allowAnyPrivate?: boolean }) => boolean;
function isPrivateIP
isPrivateIP: (ip: string) => boolean;
function isRange
isRange: (range: string) => boolean;
function isV4
isV4: (addr: string) => boolean;
function isV6
isV6: (addr: string) => boolean;
function searchIP
searchIP: (addr: string) => any;
function storeIP
storeIP: (addr: string) => any;
function version
version: (addr: string) => number;
Package Files (1)
Dependencies (2)
Dev Dependencies (6)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/range_check
.
- Markdown[](https://www.jsdocs.io/package/range_check)
- HTML<a href="https://www.jsdocs.io/package/range_check"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 2356 ms. - Missing or incorrect documentation? Open an issue for this package.