summaryrefslogtreecommitdiff
path: root/src/config
diff options
context:
space:
mode:
authorAaron Hill <aa1ronham@gmail.com>2018-10-14 20:10:10 -0400
committerAaron Hill <aa1ronham@gmail.com>2018-10-17 21:19:10 -0400
commit204cb428b38c119922ed596f27b3f36a6b33366f (patch)
treea5a8f5706385b2e0508dd4d97b5a9ff43edc58f7 /src/config
parent5e8443be7324cb1e0e93a2d0c06791c9e180ec55 (diff)
downloadroughenough-204cb428b38c119922ed596f27b3f36a6b33366f.zip
Add fuzzing config
Diffstat (limited to 'src/config')
-rw-r--r--src/config/environment.rs6
-rw-r--r--src/config/mod.rs15
2 files changed, 18 insertions, 3 deletions
diff --git a/src/config/environment.rs b/src/config/environment.rs
index b618896..2385b28 100644
--- a/src/config/environment.rs
+++ b/src/config/environment.rs
@@ -55,9 +55,9 @@ const ROUGHENOUGH_KEY_PROTECTION: &str = "ROUGHENOUGH_KEY_PROTECTION";
impl EnvironmentConfig {
pub fn new() -> Result<Self, Error> {
let mut cfg = EnvironmentConfig {
- port: 8686,
- interface: "127.0.0.1".to_string(),
- seed: hex::decode("a32049da0ffde0ded92ce10a0230d35fe615ec8461c14986baa63fe3b3bac3db").unwrap(),
+ port: 0,
+ interface: "".to_string(),
+ seed: Vec::new(),
batch_size: DEFAULT_BATCH_SIZE,
status_interval: DEFAULT_STATUS_INTERVAL,
key_protection: KeyProtection::Plaintext,
diff --git a/src/config/mod.rs b/src/config/mod.rs
index f05578b..b70bbd5 100644
--- a/src/config/mod.rs
+++ b/src/config/mod.rs
@@ -112,6 +112,21 @@ pub fn make_config(arg: &str) -> Result<Box<ServerConfig>, Error> {
}
}
+/// Creates a config suitable for fuzzing a server instance
+/// This is intended to create a minimal useable config
+/// that allows a server to respond to requests.
+#[cfg(fuzzing)]
+pub fn make_fuzzing_config(port: u16) -> Box<ServerConfig> {
+ return Box(EnvironmentConfig {
+ port,
+ interface: "127.0.0.1".to_string(),
+ seed: hex::decode("a32049da0ffde0ded92ce10a0230d35fe615ec8461c14986baa63fe3b3bac3db").unwrap(),
+ batch_size: DEFAULT_BATCH_SIZE,
+ status_interval: DEFAULT_STATUS_INTERVAL,
+ key_protection: KeyProtection::Plaintext
+ })
+}
+
///
/// Validate configuration settings. Returns `true` if the config is valid, `false` otherwise.
///