Stub API.

This commit is contained in:
Lyle Mantooth 2023-05-15 18:47:31 -04:00
parent 9f30a75d44
commit e9523f6e62
Signed by: IslandUsurper
GPG key ID: 6DB52EAE123A5789
3 changed files with 124 additions and 0 deletions

21
src/main.rs Normal file
View file

@ -0,0 +1,21 @@
use std::net::IpAddr;
/// Allows geo-locating IPs and keeps analytics.
pub struct Locat {}
impl Locat {
pub fn new(_geoip_country_db_path: &str, _analytics_db_path: &str0 -> Self {
// TODO: read geoip db, create analytics db
Self {}
}
/// Converts an address to an ISO 3166-1 alpha-2 country code.
pub fn ip_to_iso_code(&self, _addr: IpAddr) -> Option<&str> {
None
}
/// Returns a map of country codes to number of requests.
pub fn get_analytics(&self) -> Vec<(String, u64)> {
Default::default()
}
}