feat(ip): read a raw GeoLite2-City mmdb with the existing unmarshaller - #440
Closed
Ryanmello07 wants to merge 1 commit into
Closed
feat(ip): read a raw GeoLite2-City mmdb with the existing unmarshaller#440Ryanmello07 wants to merge 1 commit into
Ryanmello07 wants to merge 1 commit into
Conversation
A deployment without a DB-IP or ipinfo licence has no geolocation database it
can legally use, and geolocation is not optional here -- the provider location
map, the country gate and the egress verdicts all read it. That deployment
currently cannot start.
GeoLite2-City is the free database that covers this, and it needs no new
decoder: its record layout is a strict SUBSET of the DB-IP enterprise layout
for every key unmarshalDbIp reads. continent{code,names.en},
country{iso_code,names.en}, subdivisions[]{names.en}, city{names.en} and
location{latitude,longitude,time_zone} are identical. What it lacks is the ISP
half -- traits.isp, traits.organization, traits.user_type and the autonomous
system fields -- which are simply absent, leaving Organization, ASN and
UserType zero.
That degradation is the honest cost and is written down at the decoder rather
than left to be discovered: a GeoLite2 database is a location-only source, so
anything keying off ASN or user type gets nothing from it. Naming the schema in
the switch rather than falling through to the default is what makes the choice
explicit -- an unrecognised database still errors rather than being guessed at.
Contributor
Author
|
Closing at the maintainers' request. Mainnet uses its own geolocation database, and the plan is to retire that dependency in favour of the probe system rather than extend it — so teaching the unmarshaller a second mmdb schema adds surface to a component that is on the way out. Also worth recording why this was the right call independent of that: the change rested on GeoLite2-City being field-compatible with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three lines letting the DB-IP unmarshaller accept a GeoLite2-City schema.
Caveat: not verified against a real GeoLite2 file. It rests on GeoLite2-City being field-compatible with
unmarshalDbIp— plausible, both MaxMind-standard, untested. Lowest-value item in this batch; drop it if you would rather not take that on trust.