ores.geo
Table of Contents
2. Summary
ores.geo answers one question: which country does this IP address belong to.
It reads ores_geo_ip2country_tbl in PostgreSQL through the
ores_geo_ip2country_lookup_fn function, and exposes a geolocation_service
that returns an ISO 3166-1 alpha-2 country code. The data source is
ip2country, so the answer is country-level only; city and coordinate data are
not available. ores.http constructs the service and calls it from its login
route, and no other component consumes it.
3. Inputs
- An IP address, IPv4 or IPv6, as a
boost::asio::ip::addressor a string. - ip2country ranges in
ores_geo_ip2country_tbl, written by the dq ip2country publish path. No recreate step runs that path, so a database built from scratch answersaddress_not_founduntil a publish has run. - A
database::contextfor the PostgreSQL connection.
4. Outputs
geolocation_result, holding the ISO 3166-1 alpha-2 country code.- A
geolocation_errorwhen the lookup cannot answer:address_not_foundwhen no range covers the address,invalid_addresswhen a string is not an address, orlookup_failedwhen the query throws.
5. Entry points
include/ores.geo/service/geolocation_service.hpp— the lookup API.
6. Dependencies
ores.database— the connection pool and the raw multi-column query helper.ores_geo_ip2country_lookup_fnoverores_geo_ip2country_tbl, defined underprojects/ores.sql/create/geo/.
7. Build dependencies
What the shared profile cannot know, declared here rather than hand-edited into the generated build file. Each block is spliced into its generated file after the profile's baseline.
8. See also
- ores.database — the connection and query layer the service reads through.
- ores.http.core — the login route that calls the lookup.
- ores.http.server — the process that constructs the service.
- System Model: Foundation Layer — the layer this component belongs to.
9. Test dependencies
The suites link what the profile cannot know about.
target_link_libraries(${lib_target_name}
PUBLIC
ores.database.lib
ores.telemetry.core.lib
PRIVATE
Boost::boost)
target_link_libraries(${tests_target_name}
PRIVATE
${lib_target_name}
ores.telemetry.core.lib
ores.testing.lib
Catch2::Catch2
faker-cxx::faker-cxx
ores.openssl_cleanup
Threads::Threads)
