Giter Club home page Giter Club logo

lua-geoip's People

Contributors

agladysh avatar caldwell avatar dvv avatar helmutg avatar msva avatar pisto avatar trink avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

lua-geoip's Issues

File descriptor leaks when used in nginx-lua-module

When lua_code_cache is off, fd which points to error.log increases continuously for workers.
I do understand lua_code_cache off should not be used in production. This setting exists in development environment only. However, it still annoys because nginx will no longer accept any request when fd limit is reached during testing.

$ ll /proc/{worker_pid}/fd/
l-wx------ 1 ubuntu ubuntu 64 May  8 06:43 14 -> /var/log/nginx/error.log
l-wx------ 1 ubuntu ubuntu 64 May  8 06:43 2 -> /var/log/nginx/error.log
l-wx------ 1 ubuntu ubuntu 64 May  8 06:43 28 -> /var/log/nginx/error.log
l-wx------ 1 ubuntu ubuntu 64 May  8 06:43 30 -> /var/log/nginx/error.log
l-wx------ 1 ubuntu ubuntu 64 May  8 06:43 33 -> /var/log/nginx/error.log
l-wx------ 1 ubuntu ubuntu 64 May  8 06:43 35 -> /var/log/nginx/error.log
l-wx------ 1 ubuntu ubuntu 64 May  8 06:43 37 -> /var/log/nginx/error.log
l-wx------ 1 ubuntu ubuntu 64 May  8 06:43 39 -> /var/log/nginx/error.log
l-wx------ 1 ubuntu ubuntu 64 May  8 06:43 42 -> /var/log/nginx/error.log
l-wx------ 1 ubuntu ubuntu 64 May  8 06:43 44 -> /var/log/nginx/error.log
...

After some experiments and observation, I can reproduce by the following simplified scripts:
Entry script:

#!/usr/bin/env lua
local Geo = require "MyGeo"

MyGeo.lua:

#!/usr/bin/env lua
local geoip_country = require "geoip.country"

local GeoIp = {
    db_country = geoip_country.open("/usr/share/GeoIP/GeoIP.dat")
}

return GeoIp

The geoip module is

# luarocks show lua-geoip

lua-geoip 0.1.2-1 - Bindings for MaxMind's GeoIP library

License:        MIT/X11
Homepage:       http://github.com/agladysh/lua-geoip
Installed in:   /usr/local

Modules:
        geoip.country
        geoip
        geoip.city

The openresty version is:

./nginx -v
nginx version: openresty/1.11.2.1

you need offer a clearly way to install

I am using luarocks install lua-geoip
but I got this “Error: Could not find expected file GeoIP.h, or GeoIP.h for GEOIP ”

yum install libgeoip-dev no pakage

Build Error When Installing "lua-geoip" by luarocks

I cannot find where you declare constant GEOIP_SILENCE, neither does the compiler.
Please let me know how to install lua-geoip successfully.
Thanks!

see:
root@yy-luarocks-server:/# luarocks install lua-geoip
Installing http://luarocks.org/repositories/rocks/lua-geoip-0.2-1.src.rock
gcc -O2 -fPIC -I/usr/include/lua5.1 -c src/database.c -o src/database.o -Isrc/
gcc -O2 -fPIC -I/usr/include/lua5.1 -c src/country.c -o src/country.o -Isrc/
src/country.c: In function ‘lcountry_open’:
src/country.c:264:28: error: ‘GEOIP_SILENCE’ undeclared (first use in this function)
GEOIP_MEMORY_CACHE | GEOIP_SILENCE,
^
src/country.c:264:28: note: each undeclared identifier is reported only once for each function it appears in

Error: Build error: Failed compiling object src/country.o

Time to fix luaL_reg -> luaL_Reg

You should make a new release on luarocks with my old fix for the file descriptor leak, and fix the naming luaL_reg -> luaL_Reg, because not all distros have LUA_COMPAT_ALL defined.

attempt to call field 'COUNTRY' (a number value)

I trying get country name by Ip, but have error:

$ lua init.lua   
lua: init.lua:9: attempt to call field 'COUNTRY' (a number value)     
require "geoip"                              
local ip = "185.10.127.226"                  
                                             
local geoip_country = require 'geoip.country'
                                             
local geoip_country_filename = select(1, ...) or "./GeoIP.dat"                            
assert(io.open(geoip_country_filename, "r")):close()                                      
do                                           
local country = geoip.COUNTRY(ip)            
end                                          
print(country)
```lua

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.