Closed nferch closed 6 years ago
Try moving the declaration of record
into the loop. If a value is not present in the database, it won't modify it in the struct. Given that the database has an empty map there, you are seeing a value set by a previous call to networks.Networks
.
Yep, that was it. I had assumed Networks() would only contain networks present in the database, but that's not the case. Or does the database actually contain entries for the entire IP space? Guess I should have RTFS.
In either case, thanks so much!
I believe the anonymous IP database contains an empty map for public networks that aren't marked as anonymous.
Seeing some odd results when trying to read all IPv4 subnets from the
GeoIP2-Anonymous-IP.mmdb
file:go run
...| grep 1.169.30.6/32
1.169.30.6/32: Anonymous:true Tor:true
I also note that I get 1311159 results when there's 1354761 total in the file.
I get different (expected?) results with
geoip2-golang
andmmdblookup