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

fix(macos): enable_tun block the process #232

Merged
merged 1 commit into from
Jan 4, 2024
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
22 changes: 7 additions & 15 deletions backend/tauri/src/core/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,21 +112,13 @@ impl CoreManager {
if enable_tun {
log::debug!(target: "app", "try to set system dns");

match (|| async {
let tun_device_ip = Config::clash().clone().latest().get_tun_device_ip();
// 执行 networksetup -setdnsservers Wi-Fi $tun_device_ip
Command::new("networksetup")
.args(["-setdnsservers", "Wi-Fi", tun_device_ip.as_str()])
.output()
})()
.await
{
Ok(_) => return Ok(()),
Err(err) => {
// 修改这个值,免得stop出错
log::error!(target: "app", "{err}");
}
}
let tun_device_ip = Config::clash().clone().latest().get_tun_device_ip();
// 执行 networksetup -setdnsservers Wi-Fi $tun_device_ip
let (mut rx, _) = Command::new("networksetup")
.args(["-setdnsservers", "Wi-Fi", tun_device_ip.as_str()])
.spawn()?;
let event = rx.recv().await;
log::debug!(target: "app", "{event:?}");
}
}
#[cfg(target_os = "windows")]
Expand Down
2 changes: 2 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[toolchain]
channel = "1.74.1"
Loading