Skip to content

Commit

Permalink
Update capture
Browse files Browse the repository at this point in the history
  • Loading branch information
XAMPPRocky committed Feb 22, 2022
1 parent 464c000 commit 26cf1df
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/filters/capture/affix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn is_valid_size(contents: &[u8], size: u32, metrics: &Metrics) -> bool {
}

/// Capture from the start of the packet.
#[derive(serde::Serialize, serde::Deserialize, Debug, PartialEq)]
#[derive(serde::Serialize, serde::Deserialize, Debug, PartialEq, schemars::JsonSchema)]
pub struct Prefix {
/// Whether captured bytes are removed from the original packet.
#[serde(default)]
Expand All @@ -40,7 +40,7 @@ impl super::CaptureStrategy for Prefix {
}

/// Capture from the end of the packet.
#[derive(serde::Serialize, serde::Deserialize, Debug, PartialEq)]
#[derive(serde::Serialize, serde::Deserialize, Debug, PartialEq, schemars::JsonSchema)]
pub struct Suffix {
/// Whether captured bytes are removed from the original packet.
pub size: u32,
Expand Down
4 changes: 2 additions & 2 deletions src/filters/capture/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use super::{proto, Prefix, Regex, Suffix};
use crate::filters::{metadata::CAPTURED_BYTES, ConvertProtoConfigError};

/// Strategy to apply for acquiring a set of bytes in the UDP packet
#[derive(Serialize, Deserialize, Debug, PartialEq)]
#[derive(Serialize, Deserialize, Debug, PartialEq, schemars::JsonSchema)]
#[serde(tag = "kind")]
pub enum Strategy {
/// Looks for the set of bytes at the beginning of the packet
Expand All @@ -46,7 +46,7 @@ impl Strategy {
}
}

#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, schemars::JsonSchema)]
pub struct Config {
/// The key to use when storing the captured value in the filter context.
/// If a match was found it is available
Expand Down
3 changes: 2 additions & 1 deletion src/filters/capture/regex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ use crate::metadata::Value;
use super::Metrics;

/// Capture from the start of the packet.
#[derive(serde::Serialize, serde::Deserialize, Debug)]
#[derive(serde::Serialize, serde::Deserialize, Debug, schemars::JsonSchema)]
pub struct Regex {
/// The regular expression to use for capture.
#[serde(with = "serde_regex")]
#[schemars(with = "String")]
pub pattern: regex::bytes::Regex,
}

Expand Down
3 changes: 1 addition & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
* limitations under the License.
*/

use std::{sync::Arc, path::PathBuf};
use std::path::PathBuf;

use clap::{Arg, Command};
use tracing::info;

const VERSION: &str = env!("CARGO_PKG_VERSION");
Expand Down

0 comments on commit 26cf1df

Please sign in to comment.