Skip to content

Commit

Permalink
chore: remove old CLI & Components
Browse files Browse the repository at this point in the history
  • Loading branch information
XAMPPRocky committed Feb 26, 2025
1 parent d4733c5 commit de0d32d
Show file tree
Hide file tree
Showing 38 changed files with 73 additions and 937 deletions.
2 changes: 1 addition & 1 deletion docs/src/services/proxy/filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ clusters:
- address: 127.0.0.1:7001
# ";
# let config = quilkin::config::Config::from_reader(yaml.as_bytes()).unwrap();
# assert_eq!(config.filters.load().len(), 2);
# assert_eq!(config.filters().unwrap().load().len(), 2);
# }
```

Expand Down
2 changes: 1 addition & 1 deletion docs/src/services/proxy/filters/capture.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ clusters:
- address: 127.0.0.1:7001
# ";
# let config = quilkin::config::Config::from_reader(yaml.as_bytes()).unwrap();
# assert_eq!(config.filters.load().len(), 1);
# assert_eq!(config.filters().unwrap().load().len(), 1);
```

## Configuration Options ([Rust Doc](../../../../api/quilkin/filters/capture/struct.Config.html))
Expand Down
2 changes: 1 addition & 1 deletion docs/src/services/proxy/filters/concatenate.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ clusters:
- address: 127.0.0.1:7001
# ";
# let config = quilkin::config::Config::from_reader(yaml.as_bytes()).unwrap();
# assert_eq!(config.filters.load().len(), 1);
# assert_eq!(config.filters().unwrap().load().len(), 1);
```

## Configuration Options ([Rust Doc](../../../../api/quilkin/filters/concatenate/struct.Config.html))
Expand Down
2 changes: 1 addition & 1 deletion docs/src/services/proxy/filters/debug.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ clusters:
- address: 127.0.0.1:7001
# ";
# let config = quilkin::config::Config::from_reader(yaml.as_bytes()).unwrap();
# assert_eq!(config.filters.load().len(), 1);
# assert_eq!(config.filters().unwrap().load().len(), 1);
```

## Configuration Options ([Rust Doc](../../../../api/quilkin/filters/debug/struct.Config.html))
Expand Down
2 changes: 1 addition & 1 deletion docs/src/services/proxy/filters/firewall.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ clusters:
- address: 127.0.0.1:7001
# ";
# let config = quilkin::config::Config::from_reader(yaml.as_bytes()).unwrap();
# assert_eq!(config.filters.load().len(), 1);
# assert_eq!(config.filters().unwrap().load().len(), 1);
```

## Configuration Options ([Rust Doc](../../../../api/quilkin/filters/firewall/struct.Config.html))
Expand Down
2 changes: 1 addition & 1 deletion docs/src/services/proxy/filters/load_balancer.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ clusters:
- address: 127.0.0.1:7001
# ";
# let config = quilkin::config::Config::from_reader(yaml.as_bytes()).unwrap();
# assert_eq!(config.filters.load().len(), 1);
# assert_eq!(config.filters().unwrap().load().len(), 1);
# }
```

Expand Down
2 changes: 1 addition & 1 deletion docs/src/services/proxy/filters/local_rate_limit.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ clusters:
- address: 127.0.0.1:7001
# ";
# let config = quilkin::config::Config::from_reader(yaml.as_bytes()).unwrap();
# assert_eq!(config.filters.load().len(), 1);
# assert_eq!(config.filters().unwrap().load().len(), 1);
# }
```
To configure a rate limiter, we specify the maximum rate at which the proxy is allowed to forward packets. In the example above, we configured the proxy to forward a maximum of 1000 packets per second).
Expand Down
2 changes: 1 addition & 1 deletion docs/src/services/proxy/filters/match.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ filters:
name: quilkin.filters.drop.v1alpha1.Drop
# ";
# let config = quilkin::config::Config::from_reader(yaml.as_bytes()).unwrap();
# assert_eq!(config.filters.load().len(), 2);
# assert_eq!(config.filters().unwrap().load().len(), 2);
```
<!-- ANCHOR_END: example -->

Expand Down
4 changes: 2 additions & 2 deletions docs/src/services/proxy/filters/token_router.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ clusters:
- bmt1eTcweA==
# ";
# let config = quilkin::config::Config::from_reader(yaml.as_bytes()).unwrap();
# assert_eq!(config.filters.load().len(), 1);
# assert_eq!(config.filters().unwrap().load().len(), 1);
```

View the [CaptureBytes](capture.md) filter documentation for more details.
Expand Down Expand Up @@ -96,7 +96,7 @@ clusters:
- bmt1eTcweA==
# ";
# let config = quilkin::config::Config::from_reader(yaml.as_bytes()).unwrap();
# assert_eq!(config.filters.load().len(), 2);
# assert_eq!(config.filters().unwrap().load().len(), 2);
```

On the game client side the [Concatenate](concatenate.md) filter could also be used to add authentication
Expand Down
2 changes: 1 addition & 1 deletion docs/src/services/xds/providers/filesystem.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ clusters:
- 'MXg3aWp5Ng=='
# ";
# let config = quilkin::config::Config::from_reader(yaml.as_bytes()).unwrap();
# assert_eq!(config.filters.load().len(), 1);
# assert_eq!(config.filters().unwrap().load().len(), 1);
```

[configuration]: ../../../services/proxy/configuration.md
81 changes: 5 additions & 76 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,39 +19,19 @@ use std::{path::PathBuf, sync::Arc};
use clap::builder::TypedValueParser;
use clap::crate_version;

use crate::Config;
use strum_macros::{Display, EnumString};

pub use self::{
agent::Agent,
generate_config_schema::GenerateConfigSchema,
manage::Manage,
proxy::Proxy,
qcmp::Qcmp,
relay::Relay,
service::{Finalizer, Service},
};

macro_rules! define_port {
($port:expr_2021) => {
pub const PORT: u16 = $port;

pub fn default_port() -> u16 {
PORT
}
};
}

pub mod agent;
pub mod generate_config_schema;
pub mod manage;
pub mod proxy;
pub mod qcmp;
pub mod relay;
mod service;
pub(crate) mod service;

const ETC_CONFIG_PATH: &str = "/etc/quilkin/quilkin.yaml";
const PORT_ENV_VAR: &str = "QUILKIN_PORT";

#[derive(Debug, clap::Parser)]
#[command(next_help_heading = "Administration Options")]
Expand Down Expand Up @@ -186,13 +166,9 @@ impl LogFormats {
/// The various Quilkin commands.
#[derive(Clone, Debug, clap::Subcommand)]
pub enum Commands {
Agent(Agent),
GenerateConfigSchema(GenerateConfigSchema),
Manage(Manage),
#[clap(subcommand)]
Qcmp(Qcmp),
Proxy(Proxy),
Relay(Relay),
}

impl Cli {
Expand Down Expand Up @@ -244,47 +220,8 @@ impl Cli {
self.providers
.spawn_providers(&config, ready.clone(), locality.clone());

match self.command {
Some(Commands::Agent(agent)) => {
let old_ready = agent::Ready {
provider_is_healthy: ready.clone(),
relay_is_healthy: ready.clone(),
..<_>::default()
};
agent.run(locality, config, old_ready, shutdown_rx).await
}

Some(Commands::Proxy(runner)) => {
let old_ready = proxy::Ready {
xds_is_healthy: parking_lot::RwLock::from(Some(ready.clone())).into(),
..<_>::default()
};
runner.run(config, old_ready, None, shutdown_rx).await
}

Some(Commands::Manage(manager)) => {
let old_ready = agent::Ready {
provider_is_healthy: ready.clone(),
is_manage: true,
..<_>::default()
};
manager.run(locality, config, old_ready, shutdown_rx).await
}

Some(Commands::Relay(relay)) => {
let old_ready = relay::Ready {
provider_is_healthy: ready.clone(),
..<_>::default()
};

relay.run(locality, config, old_ready, shutdown_rx).await
}
None => {
self.service.spawn_services(&config, &shutdown_rx)?;
shutdown_rx.changed().await.map_err(From::from)
}
Some(_) => unreachable!(),
}
self.service.spawn_services(&config, &shutdown_rx)?;
shutdown_rx.changed().await.map_err(From::from)
}

/// Searches for the configuration file, and panics if not found.
Expand All @@ -294,12 +231,7 @@ impl Cli {

let file = loop {
let Some(path) = paths.next() else {
let cfg = if matches!(self.command, Some(Commands::Agent(..))) {
Config::default_agent()
} else {
Config::default_non_agent()
};
return Ok(Arc::new(cfg));
return Ok(<_>::default());
};

match std::fs::File::open(path) {
Expand All @@ -315,10 +247,7 @@ impl Cli {
}
};

Ok(Arc::new(crate::Config::from_reader(
file,
matches!(self.command, Some(Commands::Agent(..))),
)?))
Ok(Arc::new(crate::Config::from_reader(file)?))
}
}

Expand Down
108 changes: 0 additions & 108 deletions src/cli/agent.rs

This file was deleted.

Loading

0 comments on commit de0d32d

Please sign in to comment.