Beispiel #1
0
func (g *GeoIP) setupGeoIPCountry() {
	if g.country != nil {
		return
	}

	g.setDirectory()

	gi, err := geoip.OpenType(geoip.GEOIP_COUNTRY_EDITION)
	if gi == nil || err != nil {
		log.Printf("Could not open country GeoIP database: %s\n", err)
		return
	}
	g.countryLastLoad = time.Now()
	g.hasCity = true
	g.country = gi

}
Beispiel #2
0
func (g *GeoIP) setupGeoIPASN() {
	if g.asn != nil {
		return
	}

	g.setDirectory()

	gi, err := geoip.OpenType(geoip.GEOIP_ASNUM_EDITION)
	if gi == nil || err != nil {
		log.Printf("Could not open ASN GeoIP database: %s\n", err)
		return
	}
	g.asnLastLoad = time.Now()
	g.hasAsn = true
	g.asn = gi

}