summaryrefslogtreecommitdiffhomepage
path: root/talpid-core/src
diff options
context:
space:
mode:
Diffstat (limited to 'talpid-core/src')
-rw-r--r--talpid-core/src/lib.rs2
-rw-r--r--talpid-core/src/tunnel/mod.rs22
2 files changed, 23 insertions, 1 deletions
diff --git a/talpid-core/src/lib.rs b/talpid-core/src/lib.rs
index 55df5e135f..ecc530aec3 100644
--- a/talpid-core/src/lib.rs
+++ b/talpid-core/src/lib.rs
@@ -34,6 +34,8 @@ extern crate tokio_core;
extern crate uuid;
#[cfg(target_os = "linux")]
extern crate which;
+#[cfg(windows)]
+extern crate winreg;
extern crate openvpn_plugin;
extern crate talpid_ipc;
diff --git a/talpid-core/src/tunnel/mod.rs b/talpid-core/src/tunnel/mod.rs
index 9ae88a70e9..6756f07416 100644
--- a/talpid-core/src/tunnel/mod.rs
+++ b/talpid-core/src/tunnel/mod.rs
@@ -317,5 +317,25 @@ impl CloseHandle {
}
fn is_ipv6_enabled_in_os() -> bool {
- true
+ #[cfg(windows)]
+ {
+ use winreg::enums::*;
+ use winreg::RegKey;
+
+ const IPV6_DISABLED: u8 = 0xFF;
+
+ RegKey::predef(HKEY_LOCAL_MACHINE)
+ .open_subkey(r#"SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters"#)
+ .and_then(|ipv6_config| ipv6_config.get_value("DisabledComponents"))
+ .map(|ipv6_disabled_bits: u32| (ipv6_disabled_bits & 0xFF) == IPV6_DISABLED as u32)
+ .unwrap_or(false)
+ }
+ #[cfg(target_os = "linux")]
+ {
+ true
+ }
+ #[cfg(target_os = "macos")]
+ {
+ true
+ }
}