# lionsoul2014/ip2region

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/lionsoul2014-ip2region).**

19,159 stars · 3,008 forks · Java · Apache-2.0

## Links

- GitHub: https://github.com/lionsoul2014/ip2region
- Homepage: https://ip2region.net
- awesome-repositories: https://awesome-repositories.com/repository/lionsoul2014-ip2region.md

## Topics

`ip-address` `ip-address-database` `ip-address-location` `ip-location` `ip-lookup` `ipv4-address` `ipv4-lookup` `ipv4-support` `ipv6-address` `ipv6-lookup` `ipv6-support` `xdb-engine` `xdb-ipv4` `xdb-ipv6`

## Description

ip2region is an offline IP geolocation library and framework designed to resolve IPv4 and IPv6 addresses to city-level regional information using local binary data files. It functions as a binary IP database compiler and a cross-language search client, allowing for regional lookups without relying on external APIs.

The project distinguishes itself through a specialized binary format that supports high-performance query optimization. It employs adjacent-segment IP merging and deduplicated region storage to minimize the database footprint, while utilizing memory-mapped file caching and vector-index search mechanisms to achieve microsecond-level response times.

The framework covers comprehensive IP data management, including the ability to compile, edit, and validate raw localization records. It provides tools for building custom geolocation datasets with business-specific metadata and offers flexible caching configurations to balance memory consumption against lookup speed.

The library includes search implementations for multiple programming languages and supports integration with Nginx for request processing.

## Tags

### Data & Databases

- [IP Geolocation](https://awesome-repositories.com/f/data-databases/geolocation-databases/ip-geolocation.md) — Implements a high-performance offline system for mapping IPv4 and IPv6 addresses to regional locations. ([source](https://github.com/lionsoul2014/ip2region#readme))
- [Binary Database Compilers](https://awesome-repositories.com/f/data-databases/binary-database-compilers.md) — Converts raw text-based IP location records into optimized binary files for high-speed offline lookups.
- [Data Caching](https://awesome-repositories.com/f/data-databases/data-caching.md) — Pre-loads vector indices or data files into memory to increase performance and reduce disk I/O pressure. ([source](https://github.com/lionsoul2014/ip2region/blob/master/binding/php/README.md))
- [Binary Data Formats](https://awesome-repositories.com/f/data-databases/data-processing-pipelines/data-processing/data-serialization-parsing/binary-data-formats.md) — Converts raw text IP mappings into a specialized binary format designed for high-speed sequential access and offline lookups.
- [Regional Querying](https://awesome-repositories.com/f/data-databases/data-querying/spatial-querying/regional-querying.md) — Allows querying for the regional location of an IP address using a local binary data file. ([source](https://github.com/lionsoul2014/ip2region/blob/master/binding/php/README.md))
- [In-Memory Caches](https://awesome-repositories.com/f/data-databases/in-memory-caches.md) — Loads the vector index or the entire data file into memory to accelerate query speeds. ([source](https://github.com/lionsoul2014/ip2region/blob/master/binding/c/README.md))
- [IP Data Optimizations](https://awesome-repositories.com/f/data-databases/ip-data-optimizations.md) — Reduces database size by merging adjacent IP segments and deduplicating identical regional information. ([source](https://github.com/lionsoul2014/ip2region/blob/master/README.md))
- [Offline Geolocation Indexes](https://awesome-repositories.com/f/data-databases/local-data-engines/offline-geolocation-indexes.md) — Compiles raw address data into a specialized binary format optimized for fast offline regional lookups. ([source](https://github.com/lionsoul2014/ip2region/blob/master/binding/cpp/README.md))
- [Performance Caching Systems](https://awesome-repositories.com/f/data-databases/performance-caching-systems.md) — Balances query speed and memory usage by choosing between on-demand reads, index caching, or full dataset loading. ([source](https://github.com/lionsoul2014/ip2region/blob/master/binding/cangjie/README.md))
- [Query Caching Strategies](https://awesome-repositories.com/f/data-databases/query-caching-strategies.md) — Reduces lookup latency by caching vector indices or loading the entire database into memory. ([source](https://github.com/lionsoul2014/ip2region#readme))
- [Query Performance Tuning](https://awesome-repositories.com/f/data-databases/query-performance-tuning.md) — Optimizes lookup performance by caching the vector index or the entire data file in memory. ([source](https://github.com/lionsoul2014/ip2region/blob/master/binding/golang/README.md))
- [Vector Search Indexes](https://awesome-repositories.com/f/data-databases/search-indexing-technologies/search-indexing/search-and-indexing/vector-search-indexes.md) — Employs a structured vector index to locate regional data for specific IP addresses with microsecond efficiency.
- [Custom Geolocation Datasets](https://awesome-repositories.com/f/data-databases/custom-geolocation-datasets.md) — Allows the creation of custom localization datasets by appending business-specific metadata like coordinates or zip codes. ([source](https://github.com/lionsoul2014/ip2region#readme))
- [Memory-Mapped File Access](https://awesome-repositories.com/f/data-databases/data-access-querying/memory-mapped-file-access.md) — Maps the database and index vectors directly into process memory to eliminate disk I/O latency during lookups.
- [Dataset Builders](https://awesome-repositories.com/f/data-databases/geolocation-databases/dataset-builders.md) — Allows building custom localization datasets by merging business-specific metadata with IP mappings.
- [Storage Optimizations](https://awesome-repositories.com/f/data-databases/geolocation-databases/ip-geolocation/storage-optimizations.md) — Implements adjacent-segment IP merging to reduce the binary database size by combining contiguous ranges with identical locations.
- [Multi-Language Search Clients](https://awesome-repositories.com/f/data-databases/multi-language-search-clients.md) — Provides a set of search implementations across multiple programming languages to query a unified binary IP database.

### Networking & Communication

- [Offline IP Geolocation](https://awesome-repositories.com/f/networking-communication/offline-ip-geolocation.md) — Resolves IPv4 and IPv6 addresses to city-level regional information using a local binary data format. ([source](https://github.com/lionsoul2014/ip2region/blob/master/README.md))
- [Dual-Stack Address Resolution](https://awesome-repositories.com/f/networking-communication/dual-stack-address-resolution.md) — Provides a unified interface to resolve both IPv4 and IPv6 addresses to standardized localization data.
- [Dual-Stack IP Localization](https://awesome-repositories.com/f/networking-communication/dual-stack-ip-localization.md) — Provides a unified interface to resolve both IPv4 and IPv6 addresses to standardized city-level regional data.

### Scientific & Mathematical Computing

- [IP-to-City Localization](https://awesome-repositories.com/f/scientific-mathematical-computing/data-modeling-processing/geospatial-and-location-services/location-services/address-localization/ip-to-city-localization.md) — Resolves IP addresses to city-level regional information using an offline binary database. ([source](https://github.com/lionsoul2014/ip2region/blob/master/binding/nginx))

### Artificial Intelligence & ML

- [Unified Data Querying](https://awesome-repositories.com/f/artificial-intelligence-ml/unified-data-querying.md) — Provides a single interface to query both IPv4 and IPv6 addresses and receive data in a standardized format. ([source](https://github.com/lionsoul2014/ip2region/blob/master/README.md))

### Part of an Awesome List

- [Country and Regional Data](https://awesome-repositories.com/f/awesome-lists/data/country-and-regional-data.md) — Transforms regional mapping data for IPv4 and IPv6 addresses into a binary format for offline use. ([source](https://github.com/lionsoul2014/ip2region/blob/master/maker/rust/README.md))
- [Geographic and Location](https://awesome-repositories.com/f/awesome-lists/data/geographic-and-location.md) — Resolves IP addresses to their corresponding regional location strings using an offline binary data file. ([source](https://github.com/lionsoul2014/ip2region/blob/master/binding/python/README.md))
- [IP Localization Data Management](https://awesome-repositories.com/f/awesome-lists/data/ip-localization-data-management.md) — Provides tools to compile, edit, and optimize raw address mapping files into high-performance binary formats.

### Repository Format

- [Static Data Compilers](https://awesome-repositories.com/f/repository-format/static-data-compilers.md) — Transforms raw text-based localization records into a specialized binary format for fast offline search. ([source](https://github.com/lionsoul2014/ip2region/blob/master/maker/java/README.md))

### System Administration & Monitoring

- [Geographic IP Lookups](https://awesome-repositories.com/f/system-administration-monitoring/geographic-ip-lookups.md) — Identifies the physical and regional location of network hosts based on IP address data. ([source](https://github.com/lionsoul2014/ip2region/blob/master/binding/golang/README.md))

### Development Tools & Productivity

- [Data File Generators](https://awesome-repositories.com/f/development-tools-productivity/documentation-generators/data-file-generators.md) — Generates optimized binary data files from raw localization records for high-performance lookups. ([source](https://github.com/lionsoul2014/ip2region/blob/master/maker/cpp/README.md))

### DevOps & Infrastructure

- [Process Scaling](https://awesome-repositories.com/f/devops-infrastructure/process-scaling/thread-scaling/process-scaling.md) — Increases processing capacity by distributing lookup requests across multiple worker processes. ([source](https://github.com/lionsoul2014/ip2region/blob/master/binding/erlang/README.md))
- [Data Deduplication](https://awesome-repositories.com/f/devops-infrastructure/regional-routing/regional-failover/data-deduplication.md) — Minimizes the binary file footprint by storing unique regional strings once and referencing them via identifiers.

### Software Engineering & Architecture

- [Concurrent Query Handlers](https://awesome-repositories.com/f/software-engineering-architecture/concurrent-query-handlers.md) — Uses searcher pooling and read-only buffers to handle multiple lookup requests safely across different threads. ([source](https://github.com/lionsoul2014/ip2region/blob/master/binding/cangjie/README.md))
