2

In one open source project, I saw that they were including GeoIP.h header file and calling their functions to know the country code of an IP. I wonder where is the database used by GeoIP.h

I went through the source code of GeoIP.h at http://www9.biostr.washington.edu/webalizer/src/stonesteps.ca/webalizer_src_3_4_4_1/GeoIP.h

It uses a variable FILE *GeoIPDatabase; Please suggest. I need the whole database.

===EDIT===

The source code I am visiting is this. It doesn't mention any database to be used! https://github.com/lampeh/libvmod-geoip/blob/master/src/vmod_geoip.c.

Charanjeet Kaur
  • 1,199
  • 3
  • 14
  • 27

2 Answers2

2

It's available for download on the Maxmind web site. A basic free version is available at:

http://dev.maxmind.com/geoip/legacy/geolite/

More detailed databases are also available for purchase.

  • The source code I am visiting is this. It doesn't mention any database to be used! https://github.com/lampeh/libvmod-geoip/blob/master/src/vmod_geoip.c. – Charanjeet Kaur Nov 13 '14 at 07:16
1

Are you looking for this? (see downloads section) http://dev.maxmind.com/geoip/legacy/geolite/

You can download either CSV or binary data files.

Claudi
  • 5,224
  • 17
  • 30
  • The source code I am visiting is this. It doesn't mention any database to be used! https://github.com/lampeh/libvmod-geoip/blob/master/src/vmod_geoip.c. – Charanjeet Kaur Nov 13 '14 at 07:16
  • Look at this function called by GeoIP_new(): it gives you a clue of how file names are deduced: http://d3.jpn.org/hl2/cf-doxy/html/GeoIP_8cpp-source.html#l00121 – Claudi Nov 13 '14 at 08:04
  • You will notice the function _full_path_to(). If you click on it you can see how the path to the file is built. http://d3.jpn.org/hl2/cf-doxy/html/GeoIP_8cpp-source.html#l00092 – Claudi Nov 13 '14 at 08:08