Crates.io | ipcheck-rs |
lib.rs | ipcheck-rs |
version | 1.0.1 |
source | src |
created_at | 2024-11-25 16:38:20.64458 |
updated_at | 2024-11-25 18:52:31.864724 |
description | A command tool generates typescript ip checker from CIDR |
homepage | |
repository | https://github.com/alannotnerd/ipcheck-rs |
max_upload_size | |
id | 1460484 |
size | 197,088 |
A command-line tool for efficient IP range filtering, built on top of iprange-rs library.
This is a fork of iprange-rs <https://github.com/sticnarf/iprange-rs>
_ with additional binary functionality, as the original library has unexposed internal fields needed for IP filtering operations.
From source:
.. code-block:: bash
cargo install --features ipcheck ipcheck-rs
.. code-block:: bash
ipcheck ipv4.csv ipv6.csv output.ts
.. code-block:: typescript
import { ipCheck } from './ipcheck';
// Check if an IP is in the range
console.log(ipCheck('192.168.1.1')); // IPv4
console.log(ipCheck('2001:db8::1')); // IPv6
The tool inherits the optimized binary trie structure from iprange-rs, providing:
O(1) lookup time for any IP address
Minimal memory footprint
Efficient serialization
This fork adds:
The original library's internal fields were not exposed, making certain IP filtering operations impossible through the public API.
MIT License - See LICENSE file for details.
Original work Copyright (c) 2017 Yilin Chen Modified work Copyright (c) 2024 Alan WANG
cargo test --all-features
The project follows semantic versioning and welcomes contributions.