Skip to content

Commit

Permalink
add lz4 support to pcap-rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
johanmazelanssi authored and chifflier committed May 4, 2023
1 parent 1d8fb0f commit df8aec1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions pcap-rewrite/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ clap = { version = "3.2", features = ["cargo", "derive"] }
libpcap-tools = { version="0.1.0", path="../libpcap-tools" }
log = { version = "0.4", features = ["max_level_debug", "release_max_level_warn"] }
flate2 = { version = "1.0", features = ["zlib"], default-features = false }
lz4 = "1.23"
pnet_packet = "0.31"
simplelog = { version="0.12", default-features = false }
xz2 = "0.1"
Expand Down
4 changes: 4 additions & 0 deletions pcap-rewrite/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
extern crate lz4;

use std::fs::File;
use std::io::{self, Read};
use std::path::Path;
Expand Down Expand Up @@ -86,6 +88,8 @@ fn get_reader(input_filename: &str) -> io::Result<Box<dyn Read>> {
Box::new(GzDecoder::new(file))
} else if input_filename.ends_with(".xz") {
Box::new(XzDecoder::new(file))
} else if input_filename.ends_with(".lz4") {
Box::new(lz4::Decoder::new(file)?)
} else {
Box::new(file) as Box<dyn io::Read>
}
Expand Down

0 comments on commit df8aec1

Please sign in to comment.