mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-01 18:25:30 +00:00
Include documentation in printed config files (#41)
* Start work on printing toml config with comments * WIP: toml_config: extract default values for fields * WIP: toml_config: handle single-level nested structs * WIP: toml_config: improve comment handling, std type trait impls * WIP: toml_config: add Private trait, improve comment handling, clean up * toml_config: fix default value bug; improve tests * Use toml_config in all applicable crates; add toml_config enum support * toml_config: improve comments * toml_config_derive: support enum comments * Improve config comments for udp, cli_helpers, common * Improve config comments * Add tests for Config struct TomlConfig implementations * Improve Config comments * Improve Config comments * ws, http: add config comments for tls cert and private key lines * small fixes to toml_config and toml_config_derive * Run cargo fmt * Fix typo in several config comments * Update README * Update README
This commit is contained in:
parent
d694785244
commit
a208775104
28 changed files with 581 additions and 92 deletions
|
|
@ -26,6 +26,7 @@ rand = { version = "0.8", features = ["small_rng"] }
|
|||
rand_distr = "0.4"
|
||||
rustls = { version = "0.20", features = ["dangerous_configuration"] }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
toml_config = "0.1.0"
|
||||
|
||||
[dev-dependencies]
|
||||
quickcheck = "1"
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
use std::net::SocketAddr;
|
||||
|
||||
use aquatic_cli_helpers::LogLevel;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde::Deserialize;
|
||||
use toml_config::TomlConfig;
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
/// aquatic_http_load_test configuration
|
||||
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct Config {
|
||||
pub server_address: SocketAddr,
|
||||
|
|
@ -14,7 +16,7 @@ pub struct Config {
|
|||
/// How often to check if num_connections connections are open, and
|
||||
/// open a new one otherwise. A value of 0 means that connections are
|
||||
/// opened as quickly as possible, which is useful when the tracker
|
||||
/// doesn't keep connections alive.
|
||||
/// does not keep connections alive.
|
||||
pub connection_creation_interval_ms: u64,
|
||||
pub duration: usize,
|
||||
pub torrents: TorrentConfig,
|
||||
|
|
@ -28,7 +30,7 @@ impl aquatic_cli_helpers::Config for Config {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct TorrentConfig {
|
||||
pub number_of_torrents: usize,
|
||||
|
|
@ -73,3 +75,10 @@ impl Default for TorrentConfig {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::Config;
|
||||
|
||||
::toml_config::gen_serialize_deserialize_test!(Config);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue