Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for more operating systems. #110

Merged
merged 1 commit into from
Jan 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/network/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ impl Protocol {
// Currently, linux implementation doesn't use this function.
// Without this #[cfg] clippy complains about dead code, and CI refuses
// to pass.
#[cfg(target_os = "macos")]
#[cfg(any(target_os = "macos", target_os = "freebsd"))]
pub fn from_str(string: &str) -> Option<Self> {
match string {
"TCP" => Some(Protocol::Tcp),
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions src/os/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#[cfg(target_os = "linux")]
pub(self) mod linux;

#[cfg(target_os = "macos")]
pub(self) mod macos;
#[cfg(any(target_os = "macos", target_os = "freebsd"))]
pub(self) mod lsof;

#[cfg(target_os = "macos")]
#[cfg(any(target_os = "macos", target_os = "freebsd"))]
mod lsof_utils;

mod shared;
Expand Down
6 changes: 3 additions & 3 deletions src/os/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ use signal_hook::iterator::Signals;

#[cfg(target_os = "linux")]
use crate::os::linux::get_open_sockets;
#[cfg(target_os = "macos")]
use crate::os::macos::get_open_sockets;
#[cfg(any(target_os = "macos", target_os = "freebsd"))]
use crate::os::lsof::get_open_sockets;
use crate::{network::dns, OsInputOutput};

pub type OnSigWinch = dyn Fn(Box<dyn Fn()>) + Send;
Expand Down Expand Up @@ -143,7 +143,7 @@ pub fn get_input(
}

#[inline]
#[cfg(target_os = "macos")]
#[cfg(any(target_os = "macos", target_os = "freebsd"))]
fn eperm_message() -> &'static str {
"Insufficient permissions to listen on network interface(s). Try running with sudo."
}
Expand Down