[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-93090":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":15,"stars30d":16,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":17,"rankGlobal":10,"rankLanguage":10,"license":18,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":21,"hasPages":19,"topics":22,"createdAt":10,"pushedAt":10,"updatedAt":36,"readmeContent":37,"aiSummary":38,"trendingCount":15,"starSnapshotCount":15,"syncStatus":39,"lastSyncTime":40,"discoverSource":41},93090,"SypexGeoRS","GLOBUS-studio\u002FSypexGeoRS","GLOBUS-studio","Fast zero-dependency pure-Rust reader for SypexGeo binary IP geolocation databases - country, city and region lookups with file, in-memory and batch modes.","https:\u002F\u002Fcrates.io\u002Fcrates\u002Fsypexgeo",null,"Rust",56,32,51,0,4,44.96,"MIT License",false,"main",true,[23,24,25,26,27,28,29,30,31,32,33,34,35],"database","geoip","geolocation","ip-address","ip-geolocation","ip-lookup","ip-to-country","networking","parsing","rust","rust-crate","rust-library","sypexgeo","2026-07-22 04:02:08","# sypexgeo (Rust)\n\n[![Crates.io](https:\u002F\u002Fimg.shields.io\u002Fcrates\u002Fv\u002Fsypexgeo.svg)](https:\u002F\u002Fcrates.io\u002Fcrates\u002Fsypexgeo)\n[![License](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-MIT-blue.svg)](LICENSE)\n[![Rust](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Frust-1.70%2B-orange.svg)](Cargo.toml)\n\nPure-Rust reader for the SypexGeo binary IP-to-geo database. Zero runtime dependencies, std only.\n\nSupports **Country**, **City** and **City Max** database variants in file, in-memory and batch modes.\n\nPort of [GLOBUS-studio\u002FSypexGeo](https:\u002F\u002Fgithub.com\u002FGLOBUS-studio\u002FSypexGeo) (PHP).\n\n## Features\n\n- Pure Rust — no C bindings, no external crates.\n- Reads SypexGeo v2.x binary `.dat` files.\n- File, in-memory and batch lookup modes (combinable as bit flags).\n- Country code, country ID, city, and full city+region+country lookups.\n- Full pack-format binary decoder (all 14 field types).\n- IPv4 only; private\u002Freserved ranges return empty\u002FNone.\n\n## Requirements\n\n- Rust 1.70 or newer.\n- A SypexGeo binary database file — download from [sypexgeo.net](https:\u002F\u002Fsypexgeo.net\u002Fen\u002Fdownload\u002F).\n\n## Installation\n\nPublished on [crates.io](https:\u002F\u002Fcrates.io\u002Fcrates\u002Fsypexgeo):\n\n```toml\n[dependencies]\nsypexgeo = \"0.1\"\n```\n\nOr via Cargo:\n\n```bash\ncargo add sypexgeo\n```\n\n## Usage\n\n```rust\nuse sypexgeo::{SxGeo, mode};\n\nlet sx = SxGeo::open(\"\u002Fabsolute\u002Fpath\u002Fto\u002FSxGeoCity.dat\", mode::MEMORY)?;\n\nsx.get_country(\"8.8.8.8\");     \u002F\u002F \"US\"\nsx.get_country_id(\"8.8.8.8\");  \u002F\u002F internal numeric id\nsx.get_city(\"8.8.8.8\");        \u002F\u002F Some(GeoCity { city, country })\nsx.get_city_full(\"8.8.8.8\");   \u002F\u002F Some(GeoCityFull { city, region, country })\nsx.get(\"8.8.8.8\");             \u002F\u002F City (City DB) or Country (Country DB)\nsx.about();                    \u002F\u002F database metadata\n```\n\n### Lookup modes\n\nModes are bit flags and may be combined:\n\n| Constant        | Value | Behaviour                                          |\n| --------------- | ----- | -------------------------------------------------- |\n| `mode::FILE`    | 0     | Read from disk on every lookup. Lowest memory.     |\n| `mode::MEMORY`  | 1     | Load the whole database into RAM. Fastest reads.   |\n| `mode::BATCH`   | 2     | Pre-decode indices for faster repeated lookups.    |\n\n```rust\nlet sx = SxGeo::open(\"\u002Fpath\u002Fto\u002FSxGeoCity.dat\", mode::MEMORY | mode::BATCH)?;\n```\n\n## API reference\n\n| Method | Returns |\n| ------ | ------- |\n| `open(path, flags)` | `Result\u003CSxGeo, Error>` |\n| `get(ip)` | `Option\u003CLookupResult>` — City for City DB, Country otherwise |\n| `get_country(ip)` | `String` — ISO 3166-1 alpha-2 code, empty for invalid IPs |\n| `get_country_id(ip)` | `u32` — Internal numeric country ID, `0` for invalid IPs |\n| `get_city(ip)` | `Option\u003CGeoCity>` — `{ city, country }` |\n| `get_city_full(ip)` | `Option\u003CGeoCityFull>` — `{ city, region, country }` |\n| `about()` | `About` — Database metadata |\n\nNotes:\n- IPv4 only. Private\u002Freserved ranges (`10\u002F8`, `127\u002F8`, `0\u002F8`) return empty\u002FNone.\n- `open()` returns `Error::Io`, `Error::InvalidSignature`, or `Error::InvalidFormat`.\n\n## Example\n\nSee [`examples\u002Flookup.rs`](examples\u002Flookup.rs) for the full example.\n\n```bash\n# Download a database from https:\u002F\u002Fsypexgeo.net\u002Fen\u002Fdownload\u002F\n# and place it in tests\u002Ffixtures\u002F, then:\ncargo run --example lookup\n```\n\n```\nSxGeo City EN  ·  utf-8  ·  5 995 121 blocks  ·  2025.12.19\n\n8.8.8.8\n  Country  US  (id: 225)\n  City     Mountain View  37.3861, -122.0839\n  Region   California  US-CA\n  Country  United States  39.76, -98.5\n```\n\n## Testing\n\n```bash\ncargo test\n```\n\nUnit tests run without a database. To test against a real `.dat` file, place one in `tests\u002Ffixtures\u002F` (see [tests\u002Ffixtures\u002FREADME.md](tests\u002Ffixtures\u002FREADME.md)) and run:\n\n```bash\ncargo test -- --ignored\n```\n\n## License\n\nMIT, see [LICENSE](LICENSE).\n\n## Credits\n\nPorted from the PHP library maintained by [GLOBUS.studio](https:\u002F\u002Fglobus.studio) and Yevhen Leonidov, based on the original SypexGeo by zapimir and BINOVATOR.\n","这是一个纯 Rust 编写的轻量级 SypexGeo 二进制 IP 地理位置数据库读取器，支持国家、城市及区域级别的 IPv4 地址查询。核心特性包括零运行时依赖、仅使用标准库、完整解析 SypexGeo v2.x .dat 文件（含全部14种字段类型），并提供文件读取、内存加载和批量预解码三种可组合的查询模式。适用于需要高性能、低开销 IP 归属地解析的服务端应用，如访问日志分析、地域化路由、安全风控等场景。",2,"2026-07-11 02:30:54","CREATED_QUERY"]