mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 09:45:31 +00:00
Move aquatic_cli_helpers code into aquatic_common and remove crate
This commit is contained in:
parent
b677a104d3
commit
bd6764afaf
32 changed files with 34 additions and 76 deletions
26
Cargo.lock
generated
26
Cargo.lock
generated
|
|
@ -47,26 +47,13 @@ checksum = "4361135be9122e0870de935d7c439aef945b9f9ddd4199a553b5270b49c82a27"
|
|||
name = "aquatic"
|
||||
version = "0.2.0"
|
||||
dependencies = [
|
||||
"aquatic_cli_helpers",
|
||||
"aquatic_common",
|
||||
"aquatic_http",
|
||||
"aquatic_udp",
|
||||
"aquatic_ws",
|
||||
"mimalloc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aquatic_cli_helpers"
|
||||
version = "0.2.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"aquatic_toml_config",
|
||||
"git-testament",
|
||||
"log",
|
||||
"serde",
|
||||
"simple_logger",
|
||||
"toml",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aquatic_common"
|
||||
version = "0.2.0"
|
||||
|
|
@ -76,6 +63,7 @@ dependencies = [
|
|||
"aquatic_toml_config",
|
||||
"arc-swap",
|
||||
"duplicate",
|
||||
"git-testament",
|
||||
"glommio",
|
||||
"hashbrown 0.12.0",
|
||||
"hex",
|
||||
|
|
@ -88,6 +76,8 @@ dependencies = [
|
|||
"rustls 0.20.4",
|
||||
"rustls-pemfile",
|
||||
"serde",
|
||||
"simple_logger",
|
||||
"toml",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -95,7 +85,6 @@ name = "aquatic_http"
|
|||
version = "0.2.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"aquatic_cli_helpers",
|
||||
"aquatic_common",
|
||||
"aquatic_http_protocol",
|
||||
"aquatic_toml_config",
|
||||
|
|
@ -127,7 +116,6 @@ name = "aquatic_http_load_test"
|
|||
version = "0.2.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"aquatic_cli_helpers",
|
||||
"aquatic_common",
|
||||
"aquatic_http_protocol",
|
||||
"aquatic_toml_config",
|
||||
|
|
@ -149,7 +137,6 @@ name = "aquatic_http_private"
|
|||
version = "0.2.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"aquatic_cli_helpers",
|
||||
"aquatic_common",
|
||||
"aquatic_http_protocol",
|
||||
"aquatic_toml_config",
|
||||
|
|
@ -217,7 +204,6 @@ name = "aquatic_udp"
|
|||
version = "0.2.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"aquatic_cli_helpers",
|
||||
"aquatic_common",
|
||||
"aquatic_toml_config",
|
||||
"aquatic_udp_protocol",
|
||||
|
|
@ -244,7 +230,6 @@ name = "aquatic_udp_bench"
|
|||
version = "0.2.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"aquatic_cli_helpers",
|
||||
"aquatic_common",
|
||||
"aquatic_toml_config",
|
||||
"aquatic_udp",
|
||||
|
|
@ -263,7 +248,6 @@ name = "aquatic_udp_load_test"
|
|||
version = "0.2.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"aquatic_cli_helpers",
|
||||
"aquatic_common",
|
||||
"aquatic_toml_config",
|
||||
"aquatic_udp_protocol",
|
||||
|
|
@ -293,7 +277,6 @@ name = "aquatic_ws"
|
|||
version = "0.2.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"aquatic_cli_helpers",
|
||||
"aquatic_common",
|
||||
"aquatic_toml_config",
|
||||
"aquatic_ws_protocol",
|
||||
|
|
@ -325,7 +308,6 @@ name = "aquatic_ws_load_test"
|
|||
version = "0.2.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"aquatic_cli_helpers",
|
||||
"aquatic_common",
|
||||
"aquatic_toml_config",
|
||||
"aquatic_ws_protocol",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
members = [
|
||||
"aquatic",
|
||||
"aquatic_cli_helpers",
|
||||
"aquatic_common",
|
||||
"aquatic_http",
|
||||
"aquatic_http_load_test",
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ readme = "../README.md"
|
|||
name = "aquatic"
|
||||
|
||||
[dependencies]
|
||||
aquatic_cli_helpers = { version = "0.2.0", path = "../aquatic_cli_helpers" }
|
||||
aquatic_common = { version = "0.2.0", path = "../aquatic_common" }
|
||||
aquatic_http = { version = "0.2.0", path = "../aquatic_http" }
|
||||
aquatic_udp = { version = "0.2.0", path = "../aquatic_udp" }
|
||||
aquatic_ws = { version = "0.2.0", path = "../aquatic_ws" }
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use aquatic_cli_helpers::{print_help, run_app_with_cli_and_config, Options};
|
||||
use aquatic_common::cli::{print_help, run_app_with_cli_and_config, Options};
|
||||
use aquatic_http::config::Config as HttpConfig;
|
||||
use aquatic_udp::config::Config as UdpConfig;
|
||||
use aquatic_ws::config::Config as WsConfig;
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
[package]
|
||||
name = "aquatic_cli_helpers"
|
||||
version = "0.2.0"
|
||||
authors = ["Joakim Frostegård <joakim.frostegard@gmail.com>"]
|
||||
edition = "2021"
|
||||
license = "Apache-2.0"
|
||||
description = "aquatic BitTorrent tracker CLI helpers"
|
||||
repository = "https://github.com/greatest-ape/aquatic"
|
||||
readme = "../README.md"
|
||||
|
||||
[dependencies]
|
||||
aquatic_toml_config = { version = "0.2.0", path = "../aquatic_toml_config" }
|
||||
|
||||
anyhow = "1"
|
||||
git-testament = "0.2"
|
||||
log = "0.4"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
simple_logger = { version = "2", features = ["stderr"] }
|
||||
toml = "0.5"
|
||||
|
|
@ -23,6 +23,7 @@ ahash = "0.7"
|
|||
anyhow = "1"
|
||||
arc-swap = "1"
|
||||
duplicate = "0.4"
|
||||
git-testament = "0.2"
|
||||
hashbrown = "0.12"
|
||||
hex = "0.4"
|
||||
indexmap-amortized = "1"
|
||||
|
|
@ -31,6 +32,8 @@ log = "0.4"
|
|||
privdrop = "0.5"
|
||||
rand = { version = "0.8", features = ["small_rng"] }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
simple_logger = { version = "2", features = ["stderr"] }
|
||||
toml = "0.5"
|
||||
|
||||
# Optional
|
||||
glommio = { version = "0.7", optional = true }
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use ahash::RandomState;
|
|||
use rand::Rng;
|
||||
|
||||
pub mod access_list;
|
||||
pub mod cli;
|
||||
pub mod cpu_pinning;
|
||||
pub mod privileges;
|
||||
#[cfg(feature = "rustls-config")]
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ name = "aquatic_http"
|
|||
name = "aquatic_http"
|
||||
|
||||
[dependencies]
|
||||
aquatic_cli_helpers = { version = "0.2.0", path = "../aquatic_cli_helpers" }
|
||||
aquatic_common = { version = "0.2.0", path = "../aquatic_common", features = ["rustls-config", "with-glommio"] }
|
||||
aquatic_http_protocol = { version = "0.2.0", path = "../aquatic_http_protocol" }
|
||||
aquatic_toml_config = { version = "0.2.0", path = "../aquatic_toml_config" }
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use aquatic_common::{
|
|||
use aquatic_toml_config::TomlConfig;
|
||||
use serde::Deserialize;
|
||||
|
||||
use aquatic_cli_helpers::LogLevel;
|
||||
use aquatic_common::cli::LogLevel;
|
||||
|
||||
/// aquatic_http configuration
|
||||
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
||||
|
|
@ -45,7 +45,7 @@ impl Default for Config {
|
|||
}
|
||||
}
|
||||
|
||||
impl aquatic_cli_helpers::Config for Config {
|
||||
impl aquatic_common::cli::Config for Config {
|
||||
fn get_log_level(&self) -> Option<LogLevel> {
|
||||
Some(self.log_level)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use aquatic_cli_helpers::run_app_with_cli_and_config;
|
||||
use aquatic_common::cli::run_app_with_cli_and_config;
|
||||
use aquatic_http::config::Config;
|
||||
|
||||
#[global_allocator]
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ readme = "../README.md"
|
|||
name = "aquatic_http_load_test"
|
||||
|
||||
[dependencies]
|
||||
aquatic_cli_helpers = { version = "0.2.0", path = "../aquatic_cli_helpers" }
|
||||
aquatic_common = { version = "0.2.0", path = "../aquatic_common", features = ["with-glommio"] }
|
||||
aquatic_http_protocol = { version = "0.2.0", path = "../aquatic_http_protocol" }
|
||||
aquatic_toml_config = { version = "0.2.0", path = "../aquatic_toml_config" }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use std::net::SocketAddr;
|
||||
|
||||
use aquatic_cli_helpers::LogLevel;
|
||||
use aquatic_common::cli::LogLevel;
|
||||
use aquatic_common::cpu_pinning::desc::CpuPinningConfigDesc;
|
||||
use aquatic_toml_config::TomlConfig;
|
||||
use serde::Deserialize;
|
||||
|
|
@ -26,7 +26,7 @@ pub struct Config {
|
|||
pub cpu_pinning: CpuPinningConfigDesc,
|
||||
}
|
||||
|
||||
impl aquatic_cli_helpers::Config for Config {
|
||||
impl aquatic_common::cli::Config for Config {
|
||||
fn get_log_level(&self) -> Option<LogLevel> {
|
||||
Some(self.log_level)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
|||
const MBITS_FACTOR: f64 = 1.0 / ((1024.0 * 1024.0) / 8.0);
|
||||
|
||||
pub fn main() {
|
||||
aquatic_cli_helpers::run_app_with_cli_and_config::<Config>(
|
||||
aquatic_common::cli::run_app_with_cli_and_config::<Config>(
|
||||
"aquatic_http_load_test: BitTorrent load tester",
|
||||
env!("CARGO_PKG_VERSION"),
|
||||
run,
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ name = "aquatic_http_private"
|
|||
name = "aquatic_http_private"
|
||||
|
||||
[dependencies]
|
||||
aquatic_cli_helpers = { version = "0.2.0", path = "../aquatic_cli_helpers" }
|
||||
aquatic_common = { version = "0.2.0", path = "../aquatic_common", features = ["rustls-config"] }
|
||||
aquatic_http_protocol = { version = "0.2.0", path = "../aquatic_http_protocol", features = ["with-axum"] }
|
||||
aquatic_toml_config = { version = "0.2.0", path = "../aquatic_toml_config" }
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use aquatic_common::privileges::PrivilegeConfig;
|
|||
use aquatic_toml_config::TomlConfig;
|
||||
use serde::Deserialize;
|
||||
|
||||
use aquatic_cli_helpers::LogLevel;
|
||||
use aquatic_common::cli::LogLevel;
|
||||
|
||||
/// aquatic_http_private configuration
|
||||
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
||||
|
|
@ -42,7 +42,7 @@ impl Default for Config {
|
|||
}
|
||||
}
|
||||
|
||||
impl aquatic_cli_helpers::Config for Config {
|
||||
impl aquatic_common::cli::Config for Config {
|
||||
fn get_log_level(&self) -> Option<LogLevel> {
|
||||
Some(self.log_level)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use aquatic_cli_helpers::run_app_with_cli_and_config;
|
||||
use aquatic_common::cli::run_app_with_cli_and_config;
|
||||
use aquatic_http_private::config::Config;
|
||||
|
||||
#[global_allocator]
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ name = "aquatic_udp"
|
|||
cpu-pinning = ["aquatic_common/with-hwloc"]
|
||||
|
||||
[dependencies]
|
||||
aquatic_cli_helpers = { version = "0.2.0", path = "../aquatic_cli_helpers" }
|
||||
aquatic_common = { version = "0.2.0", path = "../aquatic_common" }
|
||||
aquatic_toml_config = { version = "0.2.0", path = "../aquatic_toml_config" }
|
||||
aquatic_udp_protocol = { version = "0.2.0", path = "../aquatic_udp_protocol" }
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use std::{net::SocketAddr, path::PathBuf};
|
|||
use aquatic_common::{access_list::AccessListConfig, privileges::PrivilegeConfig};
|
||||
use serde::Deserialize;
|
||||
|
||||
use aquatic_cli_helpers::LogLevel;
|
||||
use aquatic_common::cli::LogLevel;
|
||||
use aquatic_toml_config::TomlConfig;
|
||||
|
||||
/// aquatic_udp configuration
|
||||
|
|
@ -58,7 +58,7 @@ impl Default for Config {
|
|||
}
|
||||
}
|
||||
|
||||
impl aquatic_cli_helpers::Config for Config {
|
||||
impl aquatic_common::cli::Config for Config {
|
||||
fn get_log_level(&self) -> Option<LogLevel> {
|
||||
Some(self.log_level)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
||||
|
||||
fn main() {
|
||||
aquatic_cli_helpers::run_app_with_cli_and_config::<aquatic_udp::config::Config>(
|
||||
aquatic_common::cli::run_app_with_cli_and_config::<aquatic_udp::config::Config>(
|
||||
aquatic_udp::APP_NAME,
|
||||
aquatic_udp::APP_VERSION,
|
||||
aquatic_udp::run,
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ readme = "../README.md"
|
|||
name = "aquatic_udp_bench"
|
||||
|
||||
[dependencies]
|
||||
aquatic_cli_helpers = { version = "0.2.0", path = "../aquatic_cli_helpers" }
|
||||
aquatic_common = { version = "0.2.0", path = "../aquatic_common" }
|
||||
aquatic_toml_config = { version = "0.2.0", path = "../aquatic_toml_config" }
|
||||
aquatic_udp = { version = "0.2.0", path = "../aquatic_udp" }
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ impl Default for BenchConfig {
|
|||
}
|
||||
}
|
||||
|
||||
impl aquatic_cli_helpers::Config for BenchConfig {}
|
||||
impl aquatic_common::cli::Config for BenchConfig {}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ use num_format::{Locale, ToFormattedString};
|
|||
use rand::{rngs::SmallRng, thread_rng, Rng, SeedableRng};
|
||||
use std::time::Duration;
|
||||
|
||||
use aquatic_cli_helpers::run_app_with_cli_and_config;
|
||||
use aquatic_common::cli::run_app_with_cli_and_config;
|
||||
use aquatic_udp::common::*;
|
||||
use aquatic_udp::config::Config;
|
||||
use aquatic_udp_protocol::*;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ cpu-pinning = ["aquatic_common/with-hwloc"]
|
|||
name = "aquatic_udp_load_test"
|
||||
|
||||
[dependencies]
|
||||
aquatic_cli_helpers = { version = "0.2.0", path = "../aquatic_cli_helpers" }
|
||||
aquatic_common = { version = "0.2.0", path = "../aquatic_common" }
|
||||
aquatic_toml_config = { version = "0.2.0", path = "../aquatic_toml_config" }
|
||||
aquatic_udp_protocol = { version = "0.2.0", path = "../aquatic_udp_protocol" }
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use std::net::SocketAddr;
|
|||
|
||||
use serde::Deserialize;
|
||||
|
||||
use aquatic_cli_helpers::LogLevel;
|
||||
use aquatic_common::cli::LogLevel;
|
||||
#[cfg(feature = "cpu-pinning")]
|
||||
use aquatic_common::cpu_pinning::desc::CpuPinningConfigDesc;
|
||||
use aquatic_toml_config::TomlConfig;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ use worker::*;
|
|||
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
||||
|
||||
pub fn main() {
|
||||
aquatic_cli_helpers::run_app_with_cli_and_config::<Config>(
|
||||
aquatic_common::cli::run_app_with_cli_and_config::<Config>(
|
||||
"aquatic_udp_load_test: BitTorrent load tester",
|
||||
env!("CARGO_PKG_VERSION"),
|
||||
run,
|
||||
|
|
@ -30,8 +30,8 @@ pub fn main() {
|
|||
)
|
||||
}
|
||||
|
||||
impl aquatic_cli_helpers::Config for Config {
|
||||
fn get_log_level(&self) -> Option<aquatic_cli_helpers::LogLevel> {
|
||||
impl aquatic_common::cli::Config for Config {
|
||||
fn get_log_level(&self) -> Option<aquatic_common::cli::LogLevel> {
|
||||
Some(self.log_level)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ name = "aquatic_ws"
|
|||
name = "aquatic_ws"
|
||||
|
||||
[dependencies]
|
||||
aquatic_cli_helpers = { version = "0.2.0", path = "../aquatic_cli_helpers" }
|
||||
aquatic_common = { version = "0.2.0", path = "../aquatic_common", features = ["rustls-config", "with-glommio"] }
|
||||
aquatic_toml_config = { version = "0.2.0", path = "../aquatic_toml_config" }
|
||||
aquatic_ws_protocol = { version = "0.2.0", path = "../aquatic_ws_protocol" }
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use aquatic_common::cpu_pinning::asc::CpuPinningConfigAsc;
|
|||
use aquatic_common::{access_list::AccessListConfig, privileges::PrivilegeConfig};
|
||||
use serde::Deserialize;
|
||||
|
||||
use aquatic_cli_helpers::LogLevel;
|
||||
use aquatic_common::cli::LogLevel;
|
||||
use aquatic_toml_config::TomlConfig;
|
||||
|
||||
/// aquatic_ws configuration
|
||||
|
|
@ -44,7 +44,7 @@ impl Default for Config {
|
|||
}
|
||||
}
|
||||
|
||||
impl aquatic_cli_helpers::Config for Config {
|
||||
impl aquatic_common::cli::Config for Config {
|
||||
fn get_log_level(&self) -> Option<LogLevel> {
|
||||
Some(self.log_level)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use aquatic_cli_helpers::run_app_with_cli_and_config;
|
||||
use aquatic_common::cli::run_app_with_cli_and_config;
|
||||
use aquatic_ws::config::Config;
|
||||
|
||||
#[global_allocator]
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ readme = "../README.md"
|
|||
name = "aquatic_ws_load_test"
|
||||
|
||||
[dependencies]
|
||||
aquatic_cli_helpers = { version = "0.2.0", path = "../aquatic_cli_helpers" }
|
||||
aquatic_common = { version = "0.2.0", path = "../aquatic_common", features = ["with-glommio"] }
|
||||
aquatic_toml_config = { version = "0.2.0", path = "../aquatic_toml_config" }
|
||||
aquatic_ws_protocol = { version = "0.2.0", path = "../aquatic_ws_protocol" }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use std::net::SocketAddr;
|
||||
|
||||
use aquatic_cli_helpers::LogLevel;
|
||||
use aquatic_common::cli::LogLevel;
|
||||
use aquatic_common::cpu_pinning::desc::CpuPinningConfigDesc;
|
||||
use aquatic_toml_config::TomlConfig;
|
||||
use serde::Deserialize;
|
||||
|
|
@ -19,7 +19,7 @@ pub struct Config {
|
|||
pub cpu_pinning: CpuPinningConfigDesc,
|
||||
}
|
||||
|
||||
impl aquatic_cli_helpers::Config for Config {
|
||||
impl aquatic_common::cli::Config for Config {
|
||||
fn get_log_level(&self) -> Option<LogLevel> {
|
||||
Some(self.log_level)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ use network::*;
|
|||
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
||||
|
||||
pub fn main() {
|
||||
aquatic_cli_helpers::run_app_with_cli_and_config::<Config>(
|
||||
aquatic_common::cli::run_app_with_cli_and_config::<Config>(
|
||||
"aquatic_ws_load_test: WebTorrent load tester",
|
||||
env!("CARGO_PKG_VERSION"),
|
||||
run,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue