From 38136004966afe9e65b568b00fce783f4a1e1aac Mon Sep 17 00:00:00 2001 From: Ermin Hrkalovic Date: Wed, 16 Oct 2024 11:14:59 +0200 Subject: [PATCH] add address selector option for management server --- src/cli/manage.rs | 11 +++++++++++ src/components/manage.rs | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/cli/manage.rs b/src/cli/manage.rs index 48c333f3ec..55ccf83512 100644 --- a/src/cli/manage.rs +++ b/src/cli/manage.rs @@ -44,6 +44,13 @@ pub struct Manage { /// The configuration source for a management server. #[clap(subcommand)] pub provider: crate::config::Providers, + /// If specified, filters the available gameserver addresses to the one that + /// matches the specified type + #[clap(long)] + pub address_type: Option, + /// If specified, additionally filters the gameserver address by its ip kind + #[clap(long, requires("address_type"), value_enum, default_value_t=crate::config::AddrKind::Any)] + pub ip_kind: crate::config::AddrKind, } impl Manage { @@ -69,6 +76,10 @@ impl Manage { provider: self.provider, relay_servers: self.relay, listener, + address_selector: self.address_type.map(|at| crate::config::AddressSelector { + name: at, + kind: self.ip_kind, + }), } .run(crate::components::RunArgs { config, diff --git a/src/components/manage.rs b/src/components/manage.rs index 85481173d3..b9811b5716 100644 --- a/src/components/manage.rs +++ b/src/components/manage.rs @@ -26,6 +26,7 @@ pub struct Manage { pub relay_servers: Vec, pub provider: Providers, pub listener: crate::net::TcpListener, + pub address_selector: Option, } impl Manage { @@ -48,7 +49,7 @@ impl Manage { config.clone(), ready.provider_is_healthy.clone(), self.locality, - None, + self.address_selector, false, );