erichutchins/geoipsed

GitHub: erichutchins/geoipsed

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

Stars: 29 | Forks: 3

# geoipsed _使用 Rust 编写的快速、内联 IPv4 和 IPv6 地址地理地理位置修饰工具_ IP 地理位置信息通过城市、国家、ASN 和时区元数据来丰富日志内容。`geoipsed` 会就地查找并修饰 IP 地址,同时保持现有上下文不变——非常适合事件响应和网络分析。 ## 快速开始 ``` cargo install geoipsed echo "Connection from 81.2.69.205 to 175.16.199.37" | geoipsed ``` 输出: ``` Connection from <81.2.69.205|AS0_|GB|London> to <175.16.199.37|AS0_|CN|Changchun> ``` ## 功能 - 支持带有严格验证的 IPv4 和 IPv6 - 城市、国家、ASN、时区元数据 - 通过 `-t/--template` 实现灵活的模板化 - 内联修饰或 JSON 输出模式(`--tag`、`--tag-files`) - 细粒度过滤:`--all`、`--no-private`、`--no-loopback`、`--no-broadcast` - 通过 `-C/--color` 支持颜色显示 - 流式输入(stdin 或多个文件) - 比 Python 实现快约 100 倍 ## 数据库 支持 MaxMind(默认)、IP2Location 和 IPinfo MMDB 格式。使用 `-I` 或 `GEOIP_MMDB_DIR` 环境变量指定位置。 ## 用法 ``` 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