$ show ljxi/GeoCN
This repository provides a high-precision IP geolocation HTTP API focused on mainland China, capable of resolving IP addresses to province/city/district level using a custom GeoCN database. The server is written in Go, uses MaxMind GeoLite2 databases for ASN and city-level data, and supplements with a custom MMDB for Chinese administrative divisions. It is deployed as a single binary via Docker, with a CI pipeline that weekly rebuilds the image with updated databases. The codebase is monolithic but well-organized, with environment variable configuration, proper error handling, and clean JSON responses. It is primarily an application, not a data research project, though it ships supporting data files for division codes and ASN metadata.
The LLM identified 1 files worth highlighting for reuse:
The `resolveDivision` function takes a numeric division code (e.g., 110105) and resolves it into full and short name arrays for province, city, and district. It handles edge cases like municipalities where province and city names are identical, deduplicating the first element. This pattern is reusable for any hierarchical administrative code system (e.g., ISO 3166-2, FIPS) and can be extracted with minimal modification by providing a code-to-name mapping.