Skip to content

Commit a4f9db1

Browse files
swerminmarkmandel
andauthored
add address selector option for management server (#1022)
Co-authored-by: Mark Mandel <[email protected]>
1 parent 9ebec5a commit a4f9db1

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/cli/manage.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ pub struct Manage {
4444
/// The configuration source for a management server.
4545
#[clap(subcommand)]
4646
pub provider: crate::config::Providers,
47+
/// If specified, filters the available gameserver addresses to the one that
48+
/// matches the specified type
49+
#[clap(long)]
50+
pub address_type: Option<String>,
51+
/// If specified, additionally filters the gameserver address by its ip kind
52+
#[clap(long, requires("address_type"), value_enum, default_value_t=crate::config::AddrKind::Any)]
53+
pub ip_kind: crate::config::AddrKind,
4754
}
4855

4956
impl Manage {
@@ -69,6 +76,10 @@ impl Manage {
6976
provider: self.provider,
7077
relay_servers: self.relay,
7178
listener,
79+
address_selector: self.address_type.map(|at| crate::config::AddressSelector {
80+
name: at,
81+
kind: self.ip_kind,
82+
}),
7283
}
7384
.run(crate::components::RunArgs {
7485
config,

src/components/manage.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ pub struct Manage {
2626
pub relay_servers: Vec<tonic::transport::Endpoint>,
2727
pub provider: Providers,
2828
pub listener: crate::net::TcpListener,
29+
pub address_selector: Option<crate::config::AddressSelector>,
2930
}
3031

3132
impl Manage {
@@ -48,7 +49,7 @@ impl Manage {
4849
config.clone(),
4950
ready.provider_is_healthy.clone(),
5051
self.locality,
51-
None,
52+
self.address_selector,
5253
false,
5354
);
5455

0 commit comments

Comments
 (0)