Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lbp0200/my_ip
获取本机IP地址及位置信息
https://github.com/lbp0200/my_ip
golang ip location-services
Last synced: 11 days ago
JSON representation
获取本机IP地址及位置信息
- Host: GitHub
- URL: https://github.com/lbp0200/my_ip
- Owner: lbp0200
- Created: 2020-04-25T11:18:43.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-05-04T13:42:39.000Z (over 4 years ago)
- Last Synced: 2024-12-06T08:19:44.748Z (about 1 month ago)
- Topics: golang, ip, location-services
- Language: Go
- Homepage: https://ip.liuboping.win:1443/my_ip
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
查询IP位置
---
基于命令行程序 [geoiplookup](https://linux.die.net/man/1/geoiplookup) 实现IP数据库从[maxmind](https://www.maxmind.com/en/home) 下载免费版,或者通过[国内网盘](https://590m.com/dir/26620660-38698816-0b9da5) 下载。
将环境变量`GEO_FILE`设置为IP数据库的文件路径,如:
```
GEO_FILE=/usr/share/GeoIP/GeoLite2-City.mmdb
```设置环境变量,Web服务器监听地址
```.env
MY_LISTEN=127.0.0.1:7000
```用法
---
获取本机IP:
```
GET http://127.0.0.1:7000/ip
```查询IP:
```
GET http://127.0.0.1:7000/ip/8.8.8.8
```Demo
---
(推荐使用)https://ip.liuboping.win:1443/my_ip
(不推荐)
https://ip.liuboping.win/my_ip
备注
---
因为golang的原因,不支持CentOS5