summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorcyqsimon <28627918+cyqsimon@users.noreply.github.com>2023-08-25 10:40:04 +0800
committercyqsimon <28627918+cyqsimon@users.noreply.github.com>2023-08-25 10:40:04 +0800
commit94b09e2b823622e5595644eb67c1b0e7b70e6e82 (patch)
treed612f69483b706eceb9e2aff83d8b59794a3d1a9 /src
parent491c72f4654cc23762e5c5c3186cab415b4abbfa (diff)
Fix MacOS clippy warnings (hopefully?)
Diffstat (limited to 'src')
-rw-r--r--src/main.rs2
-rw-r--r--src/os/lsof.rs9
-rw-r--r--src/os/lsof_utils.rs8
-rw-r--r--src/os/mod.rs6
4 files changed, 7 insertions, 18 deletions
diff --git a/src/main.rs b/src/main.rs
index c5fcd33..445e4fb 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -288,7 +288,7 @@ where
let sniffer_threads = os_input
.network_interfaces
.into_iter()
- .zip(os_input.network_frames.into_iter())
+ .zip(os_input.network_frames)
.map(|(iface, frames)| {
let name = format!("sniffing_handler_{}", iface.name);
let running = running.clone();
diff --git a/src/os/lsof.rs b/src/os/lsof.rs
index bb17948..77331ed 100644
--- a/src/os/lsof.rs
+++ b/src/os/lsof.rs
@@ -5,15 +5,6 @@ use crate::OpenSockets;
use super::lsof_utils;
-#[derive(Debug)]
-struct RawConnection {
- ip: String,
- local_port: String,
- remote_port: String,
- protocol: String,
- process_name: String,
-}
-
pub(crate) fn get_open_sockets() -> OpenSockets {
let mut open_sockets = HashMap::new();
diff --git a/src/os/lsof_utils.rs b/src/os/lsof_utils.rs
index 3d715b8..46fe8fc 100644
--- a/src/os/lsof_utils.rs
+++ b/src/os/lsof_utils.rs
@@ -5,6 +5,7 @@ use std::ffi::OsStr;
use std::net::IpAddr;
use std::process::Command;
+#[allow(dead_code)]
#[derive(Debug, Clone)]
pub struct RawConnection {
remote_ip: String,
@@ -116,7 +117,7 @@ impl RawConnection {
}
pub fn get_connections() -> RawConnections {
- let content = run(&["-n", "-P", "-i4", "-i6", "+c", "0"]);
+ let content = run(["-n", "-P", "-i4", "-i6", "+c", "0"]);
RawConnections::new(content)
}
@@ -139,10 +140,7 @@ pub struct RawConnections {
impl RawConnections {
pub fn new(content: String) -> RawConnections {
- let lines: Vec<RawConnection> = content
- .lines()
- .flat_map(|string| RawConnection::new(string))
- .collect();
+ let lines: Vec<RawConnection> = content.lines().flat_map(RawConnection::new).collect();
RawConnections { content: lines }
}
diff --git a/src/os/mod.rs b/src/os/mod.rs
index 4db5b0a..7770de9 100644
--- a/src/os/mod.rs
+++ b/src/os/mod.rs
@@ -1,14 +1,14 @@
#[cfg(target_os = "linux")]
-pub(self) mod linux;
+mod linux;
#[cfg(any(target_os = "macos", target_os = "freebsd"))]
-pub(self) mod lsof;
+mod lsof;
#[cfg(any(target_os = "macos", target_os = "freebsd"))]
mod lsof_utils;
#[cfg(target_os = "windows")]
-pub(self) mod windows;
+mod windows;
mod errors;
pub(crate) mod shared;