diff --git a/config-example.toml b/config-example.toml index 35f0b1c..830ded6 100644 --- a/config-example.toml +++ b/config-example.toml @@ -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" \ No newline at end of file +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" \ No newline at end of file diff --git a/src/config.rs b/src/config.rs index 0633b66..6994bc9 100644 --- a/src/config.rs +++ b/src/config.rs @@ -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, -} - #[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, +} + +#[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(), + }, } } }