mirror of
https://git.funtimes909.xyz/ServerSeekerV2/ServerSeekerV2.git
synced 2026-10-10 04:03:09 +08:00
config changes
This commit is contained in:
@@ -4,6 +4,8 @@ scan_delay = 60
|
||||
port_range_start = 25565
|
||||
port_range_end = 25565
|
||||
ignore_fake_players = true
|
||||
# Can be one of "OldestFirst", "NewestFirst", "LeastPlayers", "MostPlayers"
|
||||
rescan_priority = "OldestFirst"
|
||||
|
||||
[masscan]
|
||||
# Location of masscans config file
|
||||
|
||||
@@ -4,6 +4,14 @@ use std::fs::File;
|
||||
use std::io::{ErrorKind, Read};
|
||||
use tracing::error;
|
||||
|
||||
#[derive(Deserialize, Clone, Copy, Debug)]
|
||||
pub enum ServerRescanPriority {
|
||||
OldestFirst,
|
||||
NewestFirst,
|
||||
LeastPlayers,
|
||||
MostPlayers,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Clone, Debug)]
|
||||
pub struct Config {
|
||||
pub database: Database,
|
||||
@@ -28,6 +36,8 @@ pub struct ScannerConfig {
|
||||
pub scan_delay: u64,
|
||||
pub port_range_start: u16,
|
||||
pub port_range_end: u16,
|
||||
pub ignore_fake_players: bool,
|
||||
pub rescan_priority: ServerRescanPriority,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Clone, Debug)]
|
||||
|
||||
+3
-3
@@ -5,7 +5,7 @@ mod database;
|
||||
mod protocol;
|
||||
mod scanning;
|
||||
|
||||
use chrono::{DateTime, Local, NaiveDate};
|
||||
use chrono::{DateTime, Local};
|
||||
use clap::Parser;
|
||||
use config::load_config;
|
||||
use lazy_static::lazy_static;
|
||||
@@ -17,7 +17,7 @@ use tracing::{error, info};
|
||||
|
||||
use crate::config::Config;
|
||||
use crate::database::{Database, country_tracking};
|
||||
use crate::scanning::rescanner::{Rescanner, ServerRescanPriority};
|
||||
use crate::scanning::rescanner::Rescanner;
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[clap(about = "Scans the internet for minecraft servers and indexes them")]
|
||||
@@ -131,7 +131,7 @@ async fn main() {
|
||||
let rescanner = Rescanner {
|
||||
is_active: true,
|
||||
database: Database { connection: pool },
|
||||
rescan_priority: ServerRescanPriority::OldestFirst,
|
||||
rescan_priority: CONFIG.scanner.rescan_priority,
|
||||
};
|
||||
|
||||
rescanner.rescan_database().await;
|
||||
|
||||
@@ -6,17 +6,9 @@ use indicatif::{ProgressBar, ProgressStyle};
|
||||
use sqlx::{Row, types::ipnet::IpNet};
|
||||
|
||||
use crate::{
|
||||
database::{Database, ServerUpdateOperation},
|
||||
protocol::{minecraft::simple_ping, response::MinecraftServer},
|
||||
config::ServerRescanPriority, database::{Database, ServerUpdateOperation}, protocol::{minecraft::simple_ping, response::MinecraftServer}
|
||||
};
|
||||
|
||||
pub enum ServerRescanPriority {
|
||||
OldestFirst,
|
||||
NewestFirst,
|
||||
LeastPlayers,
|
||||
MostPlayers,
|
||||
}
|
||||
|
||||
pub struct Rescanner {
|
||||
pub is_active: bool,
|
||||
pub database: Database,
|
||||
|
||||
Reference in New Issue
Block a user