Comments (1)
Hi, the issue is that you are looking up IPs in the database for which we don't have a city record - the data is just not there.
If you look up the data using a tool such as mmdblookup
, found here, you'll see that none of the IPs you posted have a "city"
field. E.g.:
$ mmdblookup --file /usr/share/GeoIP/GeoLite2-City.mmdb --ip 13.77.161.179
{
"continent":
{
"code":
"NA" <utf8_string>
"geoname_id":
6255149 <uint32>
"names":
{
"de":
"Nordamerika" <utf8_string>
"en":
"North America" <utf8_string>
"es":
"Norteamérica" <utf8_string>
"fr":
"Amérique du Nord" <utf8_string>
"ja":
"北アメリカ" <utf8_string>
"pt-BR":
"América do Norte" <utf8_string>
"ru":
"Северная Америка" <utf8_string>
"zh-CN":
"北美洲" <utf8_string>
}
}
"country":
{
"geoname_id":
6252001 <uint32>
"iso_code":
"US" <utf8_string>
"names":
{
"de":
"USA" <utf8_string>
"en":
"United States" <utf8_string>
"es":
"Estados Unidos" <utf8_string>
"fr":
"États-Unis" <utf8_string>
"ja":
"アメリカ合衆国" <utf8_string>
"pt-BR":
"Estados Unidos" <utf8_string>
"ru":
"США" <utf8_string>
"zh-CN":
"美国" <utf8_string>
}
}
"location":
{
"accuracy_radius":
1000 <uint16>
"latitude":
47.609200 <double>
"longitude":
-122.331400 <double>
"time_zone":
"America/Los_Angeles" <utf8_string>
}
"registered_country":
{
"geoname_id":
6252001 <uint32>
"iso_code":
"US" <utf8_string>
"names":
{
"de":
"USA" <utf8_string>
"en":
"United States" <utf8_string>
"es":
"Estados Unidos" <utf8_string>
"fr":
"États-Unis" <utf8_string>
"ja":
"アメリカ合衆国" <utf8_string>
"pt-BR":
"Estados Unidos" <utf8_string>
"ru":
"США" <utf8_string>
"zh-CN":
"美国" <utf8_string>
}
}
"subdivisions":
[
{
"geoname_id":
5815135 <uint32>
"iso_code":
"WA" <utf8_string>
"names":
{
"en":
"Washington" <utf8_string>
"es":
"Washington" <utf8_string>
"fr":
"Washington" <utf8_string>
"ja":
"ワシントン州" <utf8_string>
"ru":
"Вашингтон" <utf8_string>
"zh-CN":
"华盛顿州" <utf8_string>
}
}
]
}
However, if you look up an IP that does have data in the database, you'll see the "city"
field:
$ mmdblookup --file /usr/share/GeoIP/GeoLite2-City.mmdb --ip 173.213.100.106
{
"city":
{
"geoname_id":
5506956 <uint32>
"names":
{
"de":
"Las Vegas" <utf8_string>
"en":
"Las Vegas" <utf8_string>
"es":
"Las Vegas" <utf8_string>
"fr":
"Las Vegas" <utf8_string>
"ja":
"ラスベガス" <utf8_string>
"pt-BR":
"Las Vegas" <utf8_string>
"ru":
"Лас-Вегас" <utf8_string>
"zh-CN":
"拉斯维加斯" <utf8_string>
}
}
[...snip...]
Moreover, I would strongly recommend against using a production database in your tests, because the underlying data in the database changes from release to release. Instead, you could test using a test DB, found here. You could store a version of the file in your repo and the data would never change.
Hope this helps.
from geoip2-dotnet.
Related Issues (20)
- NuGet package, C# HOT 3
- AddressNotFoundException error HOT 1
- Proper use of WebServiceClient in .NET Core HOT 17
- Installation doesn't work HOT 2
- Mockable Metadata
- No Async support in DatabaseReader? HOT 1
- powershell-core issue HOT 1
- Versioning of dependency on Microsoft.Extensions.Options HOT 4
- Load all databases (City, Country, ASN) on startup HOT 4
- install Problem(install-package MaxMind.GeoIP2) HOT 6
- How to consume geoip .net api or webservice from C# 2.0 based app HOT 2
- Cache the database HOT 3
- DatabaseReader constructor yields an exception on .Net Core / Windows 8.1 HOT 7
- request for constructing CityResponse members for unit testing HOT 2
- DatabaseReader overload that takes a stream and mapping mode. HOT 2
- Code not reflecting on NuGet HOT 2
- Why is sending user id and license key through constructor? HOT 1
- Typo in documentation HOT 1
- DatabaseReader is IDisposable for no reason HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geoip2-dotnet.