oschwald / maxminddb-golang

MaxMind DB Reader for Go
ISC License
615 stars 101 forks source link

Document returned data #22

Closed lmas closed 8 years ago

lmas commented 8 years ago

Hi, I had a hard trying to find out what kind of data you can get from a IP look up as there was no documentation on it. Couldn't find any info on Maxmind's site either after a quick peek. I ended up using an empty interface{} for Lookup() and print that, to see the available data.

Could you please add some documentation for that? Or I could send you a PR with a file called doc.go or something and make a list of the data for now?

For reference:

map[string]interface {}{"continent":map[string]interface {}{"code":"NA", "geoname_id":0x5f722d, "names":map[string]interface {}{"fr":"Amérique du Nord", "ja":"北アメリカ", "pt-BR":"América do Norte", "ru":"Северная Америка", "zh-CN":"北美洲", "de":"Nordamerika", "en":"North America", "es":"Norteamérica"}}, "country":map[string]interface {}{"iso_code":"US", "names":map[string]interface {}{"pt-BR":"Estados Unidos", "ru":"США", "zh-CN":"美国", "de":"USA", "en":"United States", "es":"Estados Unidos", "fr":"États-Unis", "ja":"アメリカ合衆国"}, "geoname_id":0x5f65e1}, "registered_country":map[string]interface {}{"names":map[string]interface {}{"fr":"États-Unis", "ja":"アメリカ合衆国", "pt-BR":"Estados Unidos", "ru":"США", "zh-CN":"美国", "de":"USA", "en":"United States", "es":"Estados Unidos"}, "geoname_id":0x5f65e1, "iso_code":"US"}}
oschwald commented 8 years ago

This library is for the database format, not any specific database. If you are looking for a library for the MaxMind GeoIP2/GeoLite2 databases, I would recommend geoip2, which uses this library internally.