From c631f2bb0db02c4fd5329a9ad9ebd3d597c8c2c0 Mon Sep 17 00:00:00 2001 From: lbl8603 <49143209+lbl8603@users.noreply.github.com> Date: Tue, 7 Feb 2023 17:37:03 +0800 Subject: [PATCH] Update tun_handler.rs --- switch/src/handle/tun_handler.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/switch/src/handle/tun_handler.rs b/switch/src/handle/tun_handler.rs index 570d2dc..e14200f 100644 --- a/switch/src/handle/tun_handler.rs +++ b/switch/src/handle/tun_handler.rs @@ -148,7 +148,9 @@ pub async fn handler_start( ) where F: FnOnce() + Send + 'static, { - use std::os::fd::AsRawFd; + #[cfg(target_os = "linux")] + use std::os::unix::io::AsRawFd; + #[cfg(target_os = "macos")] let raw_fd = tun_reader.0.as_raw_fd(); tokio::spawn(async move { let _ = status_watch.changed().await;