erichutchins/geoipsed

GitHub: erichutchins/geoipsed

基于 Rust 的高性能 IP 地理位置装饰工具,支持流式处理海量日志并实时补充城市、国家、ASN 等元数据。

Stars: 29 | Forks: 3

# geoipsed _Fast, inline geolocation decoration of IPv4 and IPv6 addresses written in Rust_ IP geolocation enriches logs with City, Country, ASN, and timezone metadata. `geoipsed` finds and decorates IP addresses in-place, leaving existing context intact—perfect for incident response and network analysis. ## 快速入门 ``` cargo install geoipsed echo "Connection from 81.2.69.205 to 175.16.199.37" | geoipsed ``` Output: ``` Connection from <81.2.69.205|AS0_|GB|London> to <175.16.199.37|AS0_|CN|Changchun> ``` ## 特性 - IPv4 和 IPv6 支持及严格验证 - City, Country, ASN, timezone 元数据 - Flexible templating via `-t/--template` - Inline decoration or JSON output modes (`--tag`, `--tag-files`) - Fine-grained filtering: `--all`, `--no-private`, `--no-loopback`, `--no-broadcast` - Color support with `-C/--color` - Streaming input (stdin or multiple files) - ~100x faster than Python implementations ## 数据库 Supports MaxMind (default), IP2Location, and IPinfo MMDB formats. Specify location with `-I` or `GEOIP_MMDB_DIR` environment variable. ## 用法 ``` geoipsed --help Inline decoration of IPv4 and IPv6 address geolocations Usage: geoipsed [OPTIONS] [FILE]... Arguments: [FILE]... Input file(s) to process. Leave empty or use "-" to read from stdin Options: -o, --only-matching Show only nonempty parts of lines that match -C, --color Use markers to highlight the matching strings [default: auto] [possible values: always, never, auto] -t, --template