Skip to content
This repository has been archived by the owner on Mar 4, 2021. It is now read-only.

Set correct default probe_asn and probe_cc #18

Open
bassosimone opened this issue Aug 22, 2019 · 0 comments
Open

Set correct default probe_asn and probe_cc #18

bassosimone opened this issue Aug 22, 2019 · 0 comments
Assignees
Labels
bug Something isn't working wontfix This will not be worked on

Comments

@bassosimone
Copy link
Member

When porting mkall-ios to MK v0.10.5, I needed to write this code:

MKUTIL_WRAP_GET_POINTER(MKGeoIPLookupResults, perform,
                        [](auto settings) noexcept {
  auto results = new mk::geoip::LookupResults{mk::geoip::lookup(*settings)};
  if (!results->good) {
    // Implementation note: the logic used by mk::geoip::lookup to determine
    // success checks the values of the probe_ip, probe_asn, etc fields. This
    // means we cannot initialize the results to the values we want to have
    // back on failure ("ZZ", "AS0", etc). We should instead check whether we
    // are good and set them afterwards. This glue code can probably go, if
    // we include this logic into the next release of mkgeoip.
    //
    // This code has been adapted from MK v0.10.4's geoiplookup.c. We should
    // actually fix geoiplookup to avoid duplicating code.
    if (results->probe_asn_string.empty()) {
      results->probe_asn_string = "AS0";
    }
    if (results->probe_cc.empty()) {
      results->probe_cc = "ZZ";
    }
  }
  return results;
})

To avoid duplicating code between mkall-ios and android-libs, it would actually be much better if we could put this logic into this repository instead.

@bassosimone bassosimone added the bug Something isn't working label Aug 22, 2019
@bassosimone bassosimone self-assigned this Aug 22, 2019
@bassosimone bassosimone added the wontfix This will not be worked on label Mar 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant