diff --git a/src/lib.rs b/src/lib.rs index 7af1dc9..4731b9a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,7 +3,7 @@ use indicatif::ProgressBarIter; use png; use pyo3::exceptions::PyValueError; use pyo3::prelude::*; -use std::fs::File; +use std::fs::{File, OpenOptions}; use std::io::BufWriter; use std::path::Path; @@ -72,7 +72,11 @@ impl Iterator for PacketsIterator { impl PacketsIterator { fn new(filename: &str) -> anyhow::Result { - let file = File::open(filename)?; + let file = OpenOptions::new() + .read(true) + .write(false) + .create(false) + .open(filename)?; let pb = ProgressBar::new(file.metadata()?.len()); let wrap = pb.wrap_read(file); let cap = PcapNGReader::new(65535, wrap)?; @@ -121,6 +125,7 @@ impl Header { const HDR_SIZE: usize = std::mem::size_of::
(); pub struct Frame { + #[allow(dead_code)] header: Header, raw: Vec, }