oschwald/geoip2-golang

the ASN method does not support the GeoLite2-City database

ddmud opened this issue · 2 comments

ddmud commented

I am trying to get the ISP of an ip address. In my /usr/local/etc/GeoIP.conf file I have the ASN database:

  EditionIDs GeoLite2-City GeoLite2-Country GeoLite2-ASN

The code:

```
 m.DB = "/usr/share/GeoIP/GeoLite2-City.mmdb"
db, err := geoip2.Open(m.DB)
if err != nil {
	return nil, err
}

defer db.Close()

c, err := db.ASN(ip)
if err != nil {
	return nil, err
}

The error I get is:

    geoip2: the ASN method does not support the GeoLite2-City database

How do I get the ISP?

You have to use the ASN database to use the ANS method. If you want the "ISP" rather than the AS org, you will need to use the commercial GeoIP2 ISP database.

ddmud commented

OK, but how do I get the ANS database? I have this in my GeoIP.conf file:

EditionIDs GeoLite2-City GeoLite2-Country GeoLite2-ASN