Added encryption configuration and handle empty ack packets

This commit is contained in:
QuantumEntangledAndy authored and Andrew King committed 2023-02-27 09:14:07 +07:00
1 parent 7dae880bb2
commit 7ebe73b226
11 files changed
+115 -42

No files matched your search

+14
View File
@@ -11,6 +11,8 @@ lazy_static! {
static ref RE_TLS_CLIENT_AUTH: Regex = Regex::new(r"^(none|request|require)$").unwrap();
static ref RE_PAUSE_MODE: Regex = Regex::new(r"^(black|still|test|none)$").unwrap();
static ref RE_DISC_SRC: Regex = Regex::new(r"^([nN]one|[lL]ocal|[rR]emote|[rR]elay)$").unwrap();
static ref RE_MAXENC_SRC: Regex =
Regex::new(r"^([nN]one|[Aa][Ee][Ss]|[Bb][Cc][Ee][Nn][Cc][Rr][Yy][Pp][Tt])$").unwrap();
}
#[derive(Debug, Deserialize, Validate, Clone)]
@@ -84,6 +86,14 @@ pub(crate) struct CameraConfig {
code = "discovery"
))]
pub(crate) discovery: String,
#[serde(default = "default_maxenc")]
#[validate(regex(
path = "RE_MAXENC_SRC",
message = "Invalid maximum encryption method",
code = "max_encryption"
))]
pub(crate) max_encryption: String,
}
#[derive(Debug, Deserialize, Validate, Clone)]
@@ -132,6 +142,10 @@ fn default_discovery() -> String {
"Relay".to_string()
}
fn default_maxenc() -> String {
"Aes".to_string()
}
#[derive(Debug, Deserialize, Validate, Clone)]
pub(crate) struct PauseConfig {
#[serde(default = "default_on_motion")]