Skip to content

feat(ip): read a raw GeoLite2-City mmdb with the existing unmarshaller - #440

Closed
Ryanmello07 wants to merge 1 commit into
urnetwork:mainfrom
Ryanmello07:feat/geolite2-city-mmdb-upstream
Closed

feat(ip): read a raw GeoLite2-City mmdb with the existing unmarshaller#440
Ryanmello07 wants to merge 1 commit into
urnetwork:mainfrom
Ryanmello07:feat/geolite2-city-mmdb-upstream

Conversation

@Ryanmello07

Copy link
Copy Markdown
Contributor

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.

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.
@Ryanmello07

Copy link
Copy Markdown
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 unmarshalDbIp, which was never verified against a real GeoLite2 file. Plausible, both being MaxMind-standard, but untested.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant