mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-05-07 02:09:06 +00:00
support ohos (#974)
* support ohos --------- Co-authored-by: FrankHan <2777926911@qq.com>
This commit is contained in:
@@ -110,7 +110,7 @@ enum PacketProtocol {
|
||||
|
||||
// Note: the protocol in the packet information header is platform dependent.
|
||||
impl PacketProtocol {
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
#[cfg(any(target_os = "linux", target_os = "android", target_env = "ohos"))]
|
||||
fn into_pi_field(self) -> Result<u16, io::Error> {
|
||||
use nix::libc;
|
||||
match self {
|
||||
@@ -328,7 +328,7 @@ impl VirtualNic {
|
||||
Ok(tun::create(&config)?)
|
||||
}
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
#[cfg(any(target_os = "android", target_env = "ohos"))]
|
||||
pub async fn create_dev_for_android(
|
||||
&mut self,
|
||||
tun_fd: std::os::fd::RawFd,
|
||||
@@ -690,7 +690,7 @@ impl NicCtx {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
#[cfg(any(target_os = "android", target_env = "ohos"))]
|
||||
pub async fn run_for_android(&mut self, tun_fd: std::os::fd::RawFd) -> Result<(), Error> {
|
||||
let tunnel = {
|
||||
let mut nic = self.nic.lock().await;
|
||||
|
||||
Reference in New Issue
Block a user