mirror of
https://codeberg.org/slatian/service.echoip-slatecave.git
synced 2025-07-16 14:03:28 +02:00
Made the geoip database reloadable
This commit is contained in:
29
src/main.rs
29
src/main.rs
@ -30,7 +30,6 @@ use trust_dns_resolver::{
|
||||
use std::fs;
|
||||
use std::net::IpAddr;
|
||||
use std::sync::Arc;
|
||||
use std::path::Path;
|
||||
|
||||
mod config;
|
||||
mod geoip;
|
||||
@ -205,23 +204,19 @@ async fn main() {
|
||||
|
||||
// Initalize GeoIP Database
|
||||
|
||||
let mut asn_db = geoip::MMDBCarrier {
|
||||
mmdb: None,
|
||||
name: "GeoIP ASN Database".to_string(),
|
||||
};
|
||||
match &config.geoip.asn_database {
|
||||
Some(path) => { asn_db.load_database_from_path(Path::new(&path)).ok(); },
|
||||
None => {},
|
||||
}
|
||||
let asn_db = geoip::MMDBCarrier::new(
|
||||
"GeoIP ASN Database".to_string(),
|
||||
config.geoip.asn_database.clone()
|
||||
);
|
||||
|
||||
let mut location_db = geoip::MMDBCarrier {
|
||||
mmdb: None,
|
||||
name: "GeoIP Location Database".to_string(),
|
||||
};
|
||||
match &config.geoip.location_database {
|
||||
Some(path) => { location_db.load_database_from_path(Path::new(&path)).ok(); },
|
||||
None => {},
|
||||
}
|
||||
asn_db.reload_database().ok();
|
||||
|
||||
let location_db = geoip::MMDBCarrier::new(
|
||||
"GeoIP Location Database".to_string(),
|
||||
config.geoip.location_database.clone()
|
||||
);
|
||||
|
||||
location_db.reload_database().ok();
|
||||
|
||||
// Initalize DNS resolver with os defaults
|
||||
println!("Initalizing dns resolver ...");
|
||||
|
Reference in New Issue
Block a user