lua-resty-maxminddb
一个用于获取 IP 位置的 MaxmindDB Lua 客户端
$ opm get lilien1010/lua-resty-maxminddb
------
# 一个用于 Maxmind DB 的 Lua 客户端 ### 用于获取 Maxmind 提供的 IP 数据库的 IP 位置
## 安装 1: 从 此仓库 安装 libmaxminddb
2: 从 Maxmind 下载 IP 数据库
### 示例代码
local maxminddb = require("resty.maxminddb")
local geo_file = '/home/lua/common_data/GeoIP2-Country-20161004.mmdb'
local ipDB = maxminddb.new(geo_file)
local ip = ngx.req.get_uri_args()['ip']
local out = {}
if not ip then
return nil
end
local res,err = ipDB:get_area_code(ip)
ngx.print( res )
错误报告
请通过在我们的 GitHub 问题跟踪器 https://github.com/lilien1010/libmaxminddb/issues 中提交问题报告错误,或如果错误是由 libmaxminddb 引起的,请在 https://github.com/maxmind/libmaxminddb/issues 中提交问题。
版权和许可
根据 Apache 许可证 2.0 版(“许可证”)授权使用;除非遵守许可证,否则您不得使用此文件。您可以在以下地址获取许可证副本:
https://apache.ac.cn/licenses/LICENSE-2.0
除非适用法律要求或书面同意,否则根据许可证分发的软件按“现状”提供,没有任何明示或暗示的担保。请参阅许可证以了解管理许可证下的特定权限和限制。
作者
lilien1010(Lien)
许可证
3bsd
版本
-
一个用于获取 IP 位置的 MaxmindDB Lua 客户端 2016-11-09 14:09:11
-
一个用于获取 IP 位置的 MaxmindDB Lua 客户端 2016-11-06 14:43:10