summaryrefslogtreecommitdiffhomepage
path: root/talpid-core/src
diff options
context:
space:
mode:
Diffstat (limited to 'talpid-core/src')
-rw-r--r--talpid-core/src/lib.rs4
-rw-r--r--talpid-core/src/macos.rs12
2 files changed, 16 insertions, 0 deletions
diff --git a/talpid-core/src/lib.rs b/talpid-core/src/lib.rs
index 8d540fcdbd..648a45bda4 100644
--- a/talpid-core/src/lib.rs
+++ b/talpid-core/src/lib.rs
@@ -63,5 +63,9 @@ mod mktemp;
#[cfg(target_os = "linux")]
mod linux;
+/// Misc utilities for the macOS platform.
+#[cfg(target_os = "macos")]
+pub mod macos;
+
/// A pair of functions to monitor and establish connectivity with ICMP
pub mod ping_monitor;
diff --git a/talpid-core/src/macos.rs b/talpid-core/src/macos.rs
new file mode 100644
index 0000000000..7e6922b796
--- /dev/null
+++ b/talpid-core/src/macos.rs
@@ -0,0 +1,12 @@
+/// name of the group that should be excluded
+const EXCLUSION_GROUP: &[u8] = b"mullvad-exclusion\0";
+
+/// Returns the GID of `mullvad-exclusion` group if it exists.
+pub fn get_exclusion_gid() -> Option<u32> {
+ let group = unsafe { libc::getgrnam(EXCLUSION_GROUP.as_ptr() as *const _) };
+ if group.is_null() {
+ return None;
+ }
+ let gid = unsafe { (*group).gr_gid };
+ Some(gid)
+}