Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test database doesn't correctly handle is_in_european_union #54

Closed
Dodie324 opened this issue Jul 9, 2018 · 2 comments
Closed

Test database doesn't correctly handle is_in_european_union #54

Dodie324 opened this issue Jul 9, 2018 · 2 comments

Comments

@Dodie324
Copy link

Dodie324 commented Jul 9, 2018

It appears the GeoIP2-City-Test.mmdb doesn't correctly handle is_in_european_union when performing a look up on a test IP address.

For example, 2a02:cfc0::29 (FR record used from GeoIP2-City-Test.json) yields the correct GeoIP2 data but IsInEuropeanUnion is false. This happens for, what appears to be, all European Union sample data. Please advise if I am missing something!

Source data

{
      "2a02:cfc0::/29" : {
         "continent" : {
            "code" : "EU",
            "geoname_id" : 6255148,
            "names" : {
               "de" : "Europa",
               "en" : "Europe",
               "es" : "Europa",
               "fr" : "Europe",
               "ja" : "ヨーロッパ",
               "pt-BR" : "Europa",
               "ru" : "Европа",
               "zh-CN" : "欧洲"
            }
         },
         "country" : {
            "geoname_id" : 3017382,
            "is_in_european_union" : true,
            "iso_code" : "FR",
            "names" : {
               "de" : "Frankreich",
               "en" : "France",
               "es" : "Francia",
               "fr" : "France",
               "ja" : "フランス共和国",
               "pt-BR" : "França",
               "ru" : "Франция",
               "zh-CN" : "法国"
            }
         },
         "location" : {
            "accuracy_radius" : 100,
            "latitude" : "46",
            "longitude" : "2",
            "time_zone" : "Europe/Paris"
         },
         "registered_country" : {
            "geoname_id" : 3017382,
            "is_in_european_union" : true,
            "iso_code" : "FR",
            "names" : {
               "de" : "Frankreich",
               "en" : "France",
               "es" : "Francia",
               "fr" : "France",
               "ja" : "フランス共和国",
               "pt-BR" : "França",
               "ru" : "Франция",
               "zh-CN" : "法国"
            }
         }
      }
   },

Yielded result

&{{0 map[]} {EU 6255148 map[ru:Европа zh-CN:欧洲 de:Europa en:Europe es:Europa fr:Europe ja:ヨーロッパ pt-BR:Europa]} {3017382 false FR map[pt-BR:França ru:Франция zh-CN:法国 de:Frankreich en:France es:Francia fr:France ja:フランス共和国]} {0 46 2 0 Europe/Paris} {} {3017382 false FR map[de:Frankreich en:France es:Francia fr:France ja:フランス共和国 pt-BR:França ru:Франция zh-CN:法国]} {0 false  map[] } [] {false false}}
@oschwald
Copy link
Member

oschwald commented Jul 9, 2018

Are you sure you are using the latest version of the database? As far as I can tell, it looks fine:

$ mmdblookup -f test-data/GeoIP2-City-Test.mmdb -i 2a02:cfc0::

  {
    "continent": 
      {
        "code": 
          "EU" <utf8_string>
        "geoname_id": 
          6255148 <uint32>
        "names": 
          {
            "de": 
              "Europa" <utf8_string>
            "en": 
              "Europe" <utf8_string>
            "es": 
              "Europa" <utf8_string>
            "fr": 
              "Europe" <utf8_string>
            "ja": 
              "ヨーロッパ" <utf8_string>
            "pt-BR": 
              "Europa" <utf8_string>
            "ru": 
              "Европа" <utf8_string>
            "zh-CN": 
              "欧洲" <utf8_string>
          }
      }
    "country": 
      {
        "geoname_id": 
          3017382 <uint32>
        "is_in_european_union": 
          true <boolean>
        "iso_code": 
          "FR" <utf8_string>
        "names": 
          {
            "de": 
              "Frankreich" <utf8_string>
            "en": 
              "France" <utf8_string>
            "es": 
              "Francia" <utf8_string>
            "fr": 
              "France" <utf8_string>
            "ja": 
              "フランス共和国" <utf8_string>
            "pt-BR": 
              "França" <utf8_string>
            "ru": 
              "Франция" <utf8_string>
            "zh-CN": 
              "法国" <utf8_string>
          }
      }
    "location": 
      {
        "accuracy_radius": 
          100 <uint16>
        "latitude": 
          46.000000 <double>
        "longitude": 
          2.000000 <double>
        "time_zone": 
          "Europe/Paris" <utf8_string>
      }
    "registered_country": 
      {
        "geoname_id": 
          3017382 <uint32>
        "is_in_european_union": 
          true <boolean>
        "iso_code": 
          "FR" <utf8_string>
        "names": 
          {
            "de": 
              "Frankreich" <utf8_string>
            "en": 
              "France" <utf8_string>
            "es": 
              "Francia" <utf8_string>
            "fr": 
              "France" <utf8_string>
            "ja": 
              "フランス共和国" <utf8_string>
            "pt-BR": 
              "França" <utf8_string>
            "ru": 
              "Франция" <utf8_string>
            "zh-CN": 
              "法国" <utf8_string>
          }
      }
  }

@Dodie324
Copy link
Author

@oschwald Thanks for your prompt response! I feel terrible not making sure I was using the latest test DB before submitting my issue; however, updating it seems to fix it. Thanks for the suggestion, and keep up the great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants