mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-02 02:35:31 +00:00
Exit with error message on unrecognized config keys
This commit is contained in:
parent
a852b290ca
commit
cedf0b61ca
10 changed files with 27 additions and 26 deletions
2
TODO.md
2
TODO.md
|
|
@ -14,7 +14,7 @@
|
||||||
* Save JoinHandles
|
* Save JoinHandles
|
||||||
* When preparing to quit because of PanicSentinel sending SIGTERM, loop
|
* When preparing to quit because of PanicSentinel sending SIGTERM, loop
|
||||||
through them, extract error and log it
|
through them, extract error and log it
|
||||||
* config: fail on unrecognized keys?
|
|
||||||
* Run cargo-deny in CI
|
* Run cargo-deny in CI
|
||||||
|
|
||||||
* aquatic_ws
|
* aquatic_ws
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ use serde::Deserialize;
|
||||||
use aquatic_toml_config::TomlConfig;
|
use aquatic_toml_config::TomlConfig;
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
||||||
#[serde(default)]
|
#[serde(default, deny_unknown_fields)]
|
||||||
pub struct PrivilegeConfig {
|
pub struct PrivilegeConfig {
|
||||||
/// Chroot and switch group and user after binding to sockets
|
/// Chroot and switch group and user after binding to sockets
|
||||||
pub drop_privileges: bool,
|
pub drop_privileges: bool,
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ use aquatic_common::cli::LogLevel;
|
||||||
|
|
||||||
/// aquatic_http configuration
|
/// aquatic_http configuration
|
||||||
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
||||||
#[serde(default)]
|
#[serde(default, deny_unknown_fields)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
/// Socket workers receive requests from the socket, parse them and send
|
/// Socket workers receive requests from the socket, parse them and send
|
||||||
/// them on to the swarm workers. They then receive responses from the
|
/// them on to the swarm workers. They then receive responses from the
|
||||||
|
|
@ -52,7 +52,7 @@ impl aquatic_common::cli::Config for Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
||||||
#[serde(default)]
|
#[serde(default, deny_unknown_fields)]
|
||||||
pub struct NetworkConfig {
|
pub struct NetworkConfig {
|
||||||
/// Bind to this address
|
/// Bind to this address
|
||||||
pub address: SocketAddr,
|
pub address: SocketAddr,
|
||||||
|
|
@ -82,7 +82,7 @@ impl Default for NetworkConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
||||||
#[serde(default)]
|
#[serde(default, deny_unknown_fields)]
|
||||||
pub struct ProtocolConfig {
|
pub struct ProtocolConfig {
|
||||||
/// Maximum number of torrents to accept in scrape request
|
/// Maximum number of torrents to accept in scrape request
|
||||||
pub max_scrape_torrents: usize,
|
pub max_scrape_torrents: usize,
|
||||||
|
|
@ -103,7 +103,7 @@ impl Default for ProtocolConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
||||||
#[serde(default)]
|
#[serde(default, deny_unknown_fields)]
|
||||||
pub struct CleaningConfig {
|
pub struct CleaningConfig {
|
||||||
/// Clean peers this often (seconds)
|
/// Clean peers this often (seconds)
|
||||||
pub torrent_cleaning_interval: u64,
|
pub torrent_cleaning_interval: u64,
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ use serde::Deserialize;
|
||||||
|
|
||||||
/// aquatic_http_load_test configuration
|
/// aquatic_http_load_test configuration
|
||||||
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
||||||
#[serde(default)]
|
#[serde(default, deny_unknown_fields)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub server_address: SocketAddr,
|
pub server_address: SocketAddr,
|
||||||
pub log_level: LogLevel,
|
pub log_level: LogLevel,
|
||||||
|
|
@ -34,7 +34,7 @@ impl aquatic_common::cli::Config for Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
||||||
#[serde(default)]
|
#[serde(default, deny_unknown_fields)]
|
||||||
pub struct TorrentConfig {
|
pub struct TorrentConfig {
|
||||||
pub number_of_torrents: usize,
|
pub number_of_torrents: usize,
|
||||||
/// Pareto shape
|
/// Pareto shape
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ use aquatic_common::cli::LogLevel;
|
||||||
|
|
||||||
/// aquatic_http_private configuration
|
/// aquatic_http_private configuration
|
||||||
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
||||||
#[serde(default)]
|
#[serde(default, deny_unknown_fields)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
/// Socket workers receive requests from the socket, parse them and send
|
/// Socket workers receive requests from the socket, parse them and send
|
||||||
/// them on to the swarm workers. They then receive responses from the
|
/// them on to the swarm workers. They then receive responses from the
|
||||||
|
|
@ -50,7 +50,7 @@ impl aquatic_common::cli::Config for Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
||||||
#[serde(default)]
|
#[serde(default, deny_unknown_fields)]
|
||||||
pub struct NetworkConfig {
|
pub struct NetworkConfig {
|
||||||
/// Bind to this address
|
/// Bind to this address
|
||||||
pub address: SocketAddr,
|
pub address: SocketAddr,
|
||||||
|
|
@ -73,7 +73,7 @@ impl Default for NetworkConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
||||||
#[serde(default)]
|
#[serde(default, deny_unknown_fields)]
|
||||||
pub struct ProtocolConfig {
|
pub struct ProtocolConfig {
|
||||||
/// Maximum number of torrents to accept in scrape request
|
/// Maximum number of torrents to accept in scrape request
|
||||||
pub max_scrape_torrents: usize,
|
pub max_scrape_torrents: usize,
|
||||||
|
|
@ -94,7 +94,7 @@ impl Default for ProtocolConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
||||||
#[serde(default)]
|
#[serde(default, deny_unknown_fields)]
|
||||||
pub struct CleaningConfig {
|
pub struct CleaningConfig {
|
||||||
/// Clean peers this often (seconds)
|
/// Clean peers this often (seconds)
|
||||||
pub torrent_cleaning_interval: u64,
|
pub torrent_cleaning_interval: u64,
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ use aquatic_toml_config::TomlConfig;
|
||||||
|
|
||||||
/// aquatic_udp configuration
|
/// aquatic_udp configuration
|
||||||
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
||||||
#[serde(default)]
|
#[serde(default, deny_unknown_fields)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
/// Socket workers receive requests from the socket, parse them and send
|
/// Socket workers receive requests from the socket, parse them and send
|
||||||
/// them on to the swarm workers. They then receive responses from the
|
/// them on to the swarm workers. They then receive responses from the
|
||||||
|
|
@ -65,7 +65,7 @@ impl aquatic_common::cli::Config for Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
||||||
#[serde(default)]
|
#[serde(default, deny_unknown_fields)]
|
||||||
pub struct NetworkConfig {
|
pub struct NetworkConfig {
|
||||||
/// Bind to this address
|
/// Bind to this address
|
||||||
pub address: SocketAddr,
|
pub address: SocketAddr,
|
||||||
|
|
@ -117,7 +117,7 @@ impl Default for NetworkConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
||||||
#[serde(default)]
|
#[serde(default, deny_unknown_fields)]
|
||||||
pub struct ProtocolConfig {
|
pub struct ProtocolConfig {
|
||||||
/// Maximum number of torrents to accept in scrape request
|
/// Maximum number of torrents to accept in scrape request
|
||||||
pub max_scrape_torrents: u8,
|
pub max_scrape_torrents: u8,
|
||||||
|
|
@ -138,7 +138,7 @@ impl Default for ProtocolConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
||||||
#[serde(default)]
|
#[serde(default, deny_unknown_fields)]
|
||||||
pub struct StatisticsConfig {
|
pub struct StatisticsConfig {
|
||||||
/// Collect and print/write statistics this often (seconds)
|
/// Collect and print/write statistics this often (seconds)
|
||||||
pub interval: u64,
|
pub interval: u64,
|
||||||
|
|
@ -168,7 +168,7 @@ impl Default for StatisticsConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
||||||
#[serde(default)]
|
#[serde(default, deny_unknown_fields)]
|
||||||
pub struct CleaningConfig {
|
pub struct CleaningConfig {
|
||||||
/// Clean torrents this often (seconds)
|
/// Clean torrents this often (seconds)
|
||||||
pub torrent_cleaning_interval: u64,
|
pub torrent_cleaning_interval: u64,
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ use aquatic_toml_config::TomlConfig;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
||||||
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct BenchConfig {
|
pub struct BenchConfig {
|
||||||
pub num_rounds: usize,
|
pub num_rounds: usize,
|
||||||
pub num_threads: usize,
|
pub num_threads: usize,
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ use aquatic_toml_config::TomlConfig;
|
||||||
|
|
||||||
/// aquatic_udp_load_test configuration
|
/// aquatic_udp_load_test configuration
|
||||||
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
||||||
#[serde(default)]
|
#[serde(default, deny_unknown_fields)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
/// Server address
|
/// Server address
|
||||||
///
|
///
|
||||||
|
|
@ -43,7 +43,7 @@ impl Default for Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
||||||
#[serde(default)]
|
#[serde(default, deny_unknown_fields)]
|
||||||
pub struct NetworkConfig {
|
pub struct NetworkConfig {
|
||||||
/// True means bind to one localhost IP per socket.
|
/// True means bind to one localhost IP per socket.
|
||||||
///
|
///
|
||||||
|
|
@ -86,7 +86,7 @@ impl Default for NetworkConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
||||||
#[serde(default)]
|
#[serde(default, deny_unknown_fields)]
|
||||||
pub struct RequestConfig {
|
pub struct RequestConfig {
|
||||||
/// Number of torrents to simulate
|
/// Number of torrents to simulate
|
||||||
pub number_of_torrents: usize,
|
pub number_of_torrents: usize,
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ use aquatic_toml_config::TomlConfig;
|
||||||
|
|
||||||
/// aquatic_ws configuration
|
/// aquatic_ws configuration
|
||||||
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
||||||
#[serde(default)]
|
#[serde(default, deny_unknown_fields)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
/// Socket workers receive requests from the socket, parse them and send
|
/// Socket workers receive requests from the socket, parse them and send
|
||||||
/// them on to the swarm workers. They then receive responses from the
|
/// them on to the swarm workers. They then receive responses from the
|
||||||
|
|
@ -51,7 +51,7 @@ impl aquatic_common::cli::Config for Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
||||||
#[serde(default)]
|
#[serde(default, deny_unknown_fields)]
|
||||||
pub struct NetworkConfig {
|
pub struct NetworkConfig {
|
||||||
/// Bind to this address
|
/// Bind to this address
|
||||||
pub address: SocketAddr,
|
pub address: SocketAddr,
|
||||||
|
|
@ -86,7 +86,7 @@ impl Default for NetworkConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
||||||
#[serde(default)]
|
#[serde(default, deny_unknown_fields)]
|
||||||
pub struct ProtocolConfig {
|
pub struct ProtocolConfig {
|
||||||
/// Maximum number of torrents to accept in scrape request
|
/// Maximum number of torrents to accept in scrape request
|
||||||
pub max_scrape_torrents: usize,
|
pub max_scrape_torrents: usize,
|
||||||
|
|
@ -107,7 +107,7 @@ impl Default for ProtocolConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
||||||
#[serde(default)]
|
#[serde(default, deny_unknown_fields)]
|
||||||
pub struct CleaningConfig {
|
pub struct CleaningConfig {
|
||||||
/// Clean peers this often (seconds)
|
/// Clean peers this often (seconds)
|
||||||
pub torrent_cleaning_interval: u64,
|
pub torrent_cleaning_interval: u64,
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ use serde::Deserialize;
|
||||||
|
|
||||||
/// aquatic_ws_load_test configuration
|
/// aquatic_ws_load_test configuration
|
||||||
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
||||||
#[serde(default)]
|
#[serde(default, deny_unknown_fields)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub server_address: SocketAddr,
|
pub server_address: SocketAddr,
|
||||||
pub log_level: LogLevel,
|
pub log_level: LogLevel,
|
||||||
|
|
@ -41,7 +41,7 @@ impl Default for Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, TomlConfig, Deserialize)]
|
||||||
#[serde(default)]
|
#[serde(default, deny_unknown_fields)]
|
||||||
pub struct TorrentConfig {
|
pub struct TorrentConfig {
|
||||||
pub offers_per_request: usize,
|
pub offers_per_request: usize,
|
||||||
pub number_of_torrents: usize,
|
pub number_of_torrents: usize,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue