Android Support (#166)

1. Add vpnservice tauri plugin for android.
2. add workflow for android.
3. Easytier Core support android, allow set tun fd.
This commit is contained in:
Sijie.Sun
2024-07-15 00:03:55 +08:00
committed by GitHub
parent 4938e3ed2b
commit 858ade2eee
113 changed files with 3847 additions and 537 deletions

View File

@@ -0,0 +1,45 @@
use tauri::{
plugin::{Builder, TauriPlugin},
Runtime,
};
#[cfg(mobile)]
use tauri::Manager;
#[cfg(mobile)]
mod mobile;
#[cfg(mobile)]
use mobile::Vpnservice;
mod error;
mod models;
pub use error::{Error, Result};
/// Extensions to [`tauri::App`], [`tauri::AppHandle`] and [`tauri::Window`] to access the vpnservice APIs.
#[cfg(mobile)]
pub trait VpnserviceExt<R: Runtime> {
fn vpnservice(&self) -> &Vpnservice<R>;
}
#[cfg(mobile)]
impl<R: Runtime, T: Manager<R>> crate::VpnserviceExt<R> for T {
fn vpnservice(&self) -> &Vpnservice<R> {
self.state::<Vpnservice<R>>().inner()
}
}
/// Initializes the plugin.
pub fn init<R: Runtime>() -> TauriPlugin<R> {
Builder::new("vpnservice")
.setup(|_app, _api| {
#[cfg(mobile)]
{
let vpnservice = mobile::init(_app, _api)?;
_app.manage(vpnservice);
}
Ok(())
})
.build()
}