|
ORE Studio 0.0.4
|
Service for looking up geographic location from IP addresses. More...
#include <geolocation_service.hpp>

Public Member Functions | |
| geolocation_service (database::context ctx) | |
| Construct a geolocation service with database context. | |
| std::expected< geolocation_result, geolocation_error > | lookup (const boost::asio::ip::address &ip) const |
| Look up geolocation for an IP address. | |
| std::expected< geolocation_result, geolocation_error > | lookup (const std::string &ip_string) const |
| Look up geolocation for an IP address string. | |
Service for looking up geographic location from IP addresses.
Uses PostgreSQL ip2country table for lookups. The table must be populated with ip2country data from iptoasn.com using the geolocation_import.sql script.
Thread-safety: All public methods are thread-safe.
|
explicit |
Construct a geolocation service with database context.
| ctx | Database context for PostgreSQL queries |
| std::expected< geolocation_result, geolocation_error > lookup | ( | const boost::asio::ip::address & | ip | ) | const |
Look up geolocation for an IP address.
| ip | The IP address to look up |

| std::expected< geolocation_result, geolocation_error > lookup | ( | const std::string & | ip_string | ) | const |
Look up geolocation for an IP address string.
| ip_string | The IP address string to look up |