@roniemartinez/iptocc
v1.3.6
Published
Fast, offline IP-to-country lookup. WASM bindings for the Rust iptocc crate.
Downloads
1,996
Maintainers
Readme
@roniemartinez/iptocc
WASM bindings for the iptocc Rust crate. Offline IPv4 and IPv6 to ISO 3166-1 alpha-2 country code lookup.
Note: Country codes reflect the country assigned by a Regional Internet Registry (RIR) to each IP block, not where the block is being used. RIR data agrees with MaxMind for ~95% of IPv4 addresses and has minimal discrepancies for IPv6 (Zander, 2012).
Features
- Offline lookup, no API keys, no network calls
- IPv4 and IPv6 in one call
- Single string OR batch (array of strings)
- Multi-target output: Node, bundlers, browser, Deno, no-modules
iptoccCLI installed withnpm install -g @roniemartinez/iptocc(or usenpx)- Data refreshed nightly from the five Regional Internet Registries
Install
npm install @roniemartinez/iptoccUsage
const { country_code } = require("@roniemartinez/iptocc");
country_code("8.8.8.8"); // "US"
country_code(["8.8.8.8", "1.0.16.1"]); // ["US", "JP"]Per-target entry points: @roniemartinez/iptocc/{nodejs,bundler,web,deno,no-modules}.
Run the CLI without installing via npx:
$ npx @roniemartinez/iptocc 8.8.8.8 1.0.16.1
8.8.8.8 US
1.0.16.1 JPOr install the package and the iptocc bin is on your PATH.
See also
- iptocc — the Rust crate this binding is built on
- iptocc on PyPI — Python bindings
- GitHub repo
