Skip to content

Commit

Permalink
Move proxy::Server to Proxy and sessions::session to sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
XAMPPRocky committed Aug 26, 2022
1 parent f651731 commit 3538770
Show file tree
Hide file tree
Showing 35 changed files with 1,084 additions and 1,120 deletions.
4 changes: 2 additions & 2 deletions benches/throughput.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const PACKETS: &[&[u8]] = &[
fn run_quilkin(port: u16, endpoint: SocketAddr) {
std::thread::spawn(move || {
let runtime = tokio::runtime::Runtime::new().unwrap();
let config = quilkin::Server::builder()
let config = quilkin::Config::builder()
.port(port)
.admin(Admin {
address: "[::]:0".parse().unwrap(),
Expand All @@ -38,7 +38,7 @@ fn run_quilkin(port: u16, endpoint: SocketAddr) {
.build()
.unwrap();

let server = quilkin::Server::try_from(config).unwrap();
let server = quilkin::Proxy::try_from(config).unwrap();
runtime.block_on(async move {
let (_shutdown_tx, shutdown_rx) = tokio::sync::watch::channel::<()>(());
server.run(shutdown_rx).await.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion docs/src/filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ clusters:
# ";
# let config = quilkin::config::Config::from_reader(yaml.as_bytes()).unwrap();
# assert_eq!(config.filters.load().len(), 2);
# quilkin::Server::try_from(config).unwrap();
# quilkin::Proxy::try_from(config).unwrap();
# }
```

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

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

The above example shows a proxy that could be used with a typical game client, where the original client data is
Expand Down
2 changes: 1 addition & 1 deletion docs/src/filters/concatenate_bytes.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ clusters:
# ";
# let config = quilkin::config::Config::from_reader(yaml.as_bytes()).unwrap();
# assert_eq!(config.filters.load().len(), 1);
# quilkin::Server::try_from(config).unwrap();
# quilkin::Proxy::try_from(config).unwrap();
```

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

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

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

Expand Down
2 changes: 1 addition & 1 deletion docs/src/filters/local_rate_limit.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ clusters:
# ";
# let config = quilkin::config::Config::from_reader(yaml.as_bytes()).unwrap();
# assert_eq!(config.filters.load().len(), 1);
# quilkin::Server::try_from(config).unwrap();
# quilkin::Proxy::try_from(config).unwrap();
# }
```
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/filters/match.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ filters:
# ";
# let config = quilkin::config::Config::from_reader(yaml.as_bytes()).unwrap();
# assert_eq!(config.filters.load().len(), 2);
# quilkin::Server::try_from(config).unwrap();
# quilkin::Proxy::try_from(config).unwrap();
```
<!-- ANCHOR_END: example -->

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

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

On the game client side the [ConcatenateBytes](./concatenate_bytes.md) filter could also be used to add authentication
Expand Down
4 changes: 2 additions & 2 deletions docs/src/filters/writing_custom_filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl StaticFilter for Greet {

## Running

We can run the proxy using [`Server::TryFrom`][Server::TryFrom] function. Let's
We can run the proxy using [`Proxy::TryFrom`][Proxy::TryFrom] function. Let's
add a main function that does that. Quilkin relies on the [Tokio] async
runtime, so we need to import that crate and wrap our main function with it.

Expand Down Expand Up @@ -243,7 +243,7 @@ filter. Try it out with the following configuration:
[filter-factory-name]: ../../api/quilkin/filters/trait.FilterFactory.html#tymethod.name
[FilterRegistry]: ../../api/quilkin/filters/struct.FilterRegistry.html
[FilterRegistry::register]: ../../api/quilkin/filters/struct.FilterRegistry.html#method.register
[Server::try_from]: ../../api/struct.Server.html#impl-TryFrom%3CConfig%3E
[Proxy::try_from]: ../../api/struct.Proxy.html#impl-TryFrom%3CConfig%3E
[CreateFilterArgs::config]: ../../api/quilkin/filters/prelude/struct.CreateFilterArgs.html#structfield.config
[ConfigType::dynamic]: ../../api/quilkin/config/enum.ConfigType.html#variant.Dynamic
[ConfigType::static]: ../../api/quilkin/config/enum.ConfigType.html#variant.Static
Expand Down
2 changes: 1 addition & 1 deletion examples/quilkin-filter-example/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ async fn main() -> quilkin::Result<()> {
quilkin::filters::FilterRegistry::register(vec![Greet::factory()].into_iter());

let (_shutdown_tx, shutdown_rx) = tokio::sync::watch::channel(());
let server: quilkin::Server = quilkin::Config::builder()
let server: quilkin::Proxy = quilkin::Config::builder()
.port(7001)
.filters(vec![quilkin::config::Filter {
name: Greet::NAME.into(),
Expand Down
2 changes: 1 addition & 1 deletion src/cli/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl Run {
let span = span!(Level::INFO, "source::run");
let _enter = span.enter();

let server = crate::Server::try_from(config)?;
let server = crate::Proxy::try_from(config)?;

#[cfg(target_os = "linux")]
let mut sig_term_fut = signal::unix::signal(signal::unix::SignalKind::terminate())?;
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub mod xds;
pub type Result<T, E = eyre::Error> = std::result::Result<T, E>;

#[doc(inline)]
pub use self::{cli::Cli, config::Config, proxy::Server};
pub use self::{cli::Cli, config::Config, proxy::Proxy};

pub use quilkin_macros::include_proto;

Expand Down
Loading

0 comments on commit 3538770

Please sign in to comment.