Skip to content

Commit

Permalink
add address selector option for management server
Browse files Browse the repository at this point in the history
  • Loading branch information
swermin committed Oct 16, 2024
1 parent a17f38f commit 3813600
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/cli/manage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
/// 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 {
Expand All @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion src/components/manage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pub struct Manage {
pub relay_servers: Vec<tonic::transport::Endpoint>,
pub provider: Providers,
pub listener: crate::net::TcpListener,
pub address_selector: Option<crate::config::AddressSelector>,
}

impl Manage {
Expand All @@ -48,7 +49,7 @@ impl Manage {
config.clone(),
ready.provider_is_healthy.clone(),
self.locality,
None,
self.address_selector,
false,
);

Expand Down

0 comments on commit 3813600

Please sign in to comment.