|
@@ -43,7 +43,7 @@ type GeoIPRecord struct {
|
|
|
TimeZone string `maxminddb:"time_zone"`
|
|
|
} `maxminddb:"location"`
|
|
|
|
|
|
- ASN asndb.ASN
|
|
|
+ ASN *asndb.ASN
|
|
|
}
|
|
|
|
|
|
// Init initializes the plugin
|
|
@@ -67,7 +67,7 @@ func setup(c *caddy.Controller) error {
|
|
|
|
|
|
asndb, err := asndb.New()
|
|
|
if err != nil {
|
|
|
- return c.Err("asndb: failed to load: " + err.Error)
|
|
|
+ return c.Err("asndb: failed to load: " + err.Error())
|
|
|
}
|
|
|
|
|
|
// Create new middleware
|
|
@@ -95,7 +95,7 @@ func (gip GeoIP) lookupLocation(w http.ResponseWriter, r *http.Request) {
|
|
|
record := gip.fetchGeoipData(r)
|
|
|
|
|
|
replacer := newReplacer(r)
|
|
|
- replacer.Set("asn_asn", record.ASN.ASN)
|
|
|
+ replacer.Set("asn_asn", fmt.Sprintf("%d", record.ASN.ASN))
|
|
|
replacer.Set("asn_organization", record.ASN.Organization)
|
|
|
replacer.Set("geoip_country_code", record.Country.ISOCode)
|
|
|
replacer.Set("geoip_country_name", record.Country.Names["en"])
|