feature(country_tracking): Part 1: Config changes

This commit is contained in:
funtimes909
2025-06-04 13:39:24 +12:00
parent 301a083bde
commit 80e3e88c03
2 changed files with 39 additions and 18 deletions
+15 -7
View File
@@ -8,12 +8,6 @@ port_range_start = 25565
# End of port range
port_range_end = 25565
[player_tracking]
# Enable player tracking?
enabled = false
# List of players to track
players = [""]
[masscan]
# Location of masscans config file
config_file = "masscan.conf"
@@ -28,4 +22,18 @@ table = "postgres"
# Database user
user = "postgres"
# Database user password
password = "SuperSuperSecretPassword"
password = "SuperSuperSecretPassword"
[player_tracking]
# Enable player tracking?
enabled = false
# List of players to track
players = [""]
[country_tracking]
# Enable tracking of country information (requires a valid https://ipinfo.io account token)
enabled = false
# How often to update the country information table in hours (minimum 24 hours)
update_frequency = 48
# IPInfo token
ipinfo_token = ":3"
+24 -11
View File
@@ -7,9 +7,10 @@ use tracing::error;
#[derive(Deserialize, Debug)]
pub struct Config {
pub database: Database,
pub player_tracking: PlayerTracking,
pub scanner: ScannerConfig,
pub masscan: Masscan,
pub player_tracking: PlayerTracking,
pub country_tracking: CountryTracking,
}
#[derive(Deserialize, Debug)]
@@ -21,12 +22,6 @@ pub struct Database {
pub password: String,
}
#[derive(Deserialize, Debug)]
pub struct PlayerTracking {
pub enabled: bool,
pub players: Vec<String>,
}
#[derive(Deserialize, Debug)]
pub struct ScannerConfig {
pub repeat: bool,
@@ -40,6 +35,19 @@ pub struct Masscan {
pub config_file: String,
}
#[derive(Deserialize, Debug)]
pub struct PlayerTracking {
pub enabled: bool,
pub players: Vec<String>,
}
#[derive(Deserialize, Debug)]
pub struct CountryTracking {
pub enabled: bool,
pub update_frequency: u64,
pub ipinfo_token: String,
}
impl Default for Config {
fn default() -> Self {
Config {
@@ -50,10 +58,6 @@ impl Default for Config {
user: "postgres".to_string(),
password: "password".to_string(),
},
player_tracking: PlayerTracking {
enabled: false,
players: vec![],
},
scanner: ScannerConfig {
repeat: true,
scan_delay: 60,
@@ -63,6 +67,15 @@ impl Default for Config {
masscan: Masscan {
config_file: "masscan.conf".to_string(),
},
player_tracking: PlayerTracking {
enabled: false,
players: vec![],
},
country_tracking: CountryTracking {
enabled: false,
update_frequency: 48,
ipinfo_token: "".to_string(),
},
}
}
}