Tobias von Dewitz 5 年 前
コミット
2c9d48f064
1 ファイル変更3 行追加3 行削除
  1. 3 3
      setup.go

+ 3 - 3
setup.go

@@ -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"])