Browse Source

Fix ASN targeting support

Ask Bjørn Hansen 7 years ago
parent
commit
602643da9f
2 changed files with 2 additions and 2 deletions
  1. 1 1
      targeting/geoip2/geoip2.go
  2. 1 1
      targeting/targeting_test.go

+ 1 - 1
targeting/geoip2/geoip2.go

@@ -153,7 +153,7 @@ func (g *GeoIP2) GetASN(ip net.IP) (string, int, error) {
 		return "", 0, err
 		return "", 0, err
 	}
 	}
 
 
-	c, err := r.ISP(ip)
+	c, err := r.ASN(ip)
 	if err != nil {
 	if err != nil {
 		return "", 0, fmt.Errorf("lookup ASN for '%s': %s", ip.String(), err)
 		return "", 0, fmt.Errorf("lookup ASN for '%s': %s", ip.String(), err)
 	}
 	}

+ 1 - 1
targeting/targeting_test.go

@@ -98,7 +98,7 @@ func TestGetTargets(t *testing.T) {
 		tests = append(tests,
 		tests = append(tests,
 			test{"@ continent regiongroup country region asn ip",
 			test{"@ continent regiongroup country region asn ip",
 				[]string{"[207.171.1.1]", "[207.171.1.0]", "as7012", "us-ca", "us-west", "us", "north-america", "@"},
 				[]string{"[207.171.1.1]", "[207.171.1.0]", "as7012", "us-ca", "us-west", "us", "north-america", "@"},
-				"",
+				"207.171.1.1",
 			})
 			})
 	}
 	}