mirror of
https://mirror.suhoan.cn/https://github.com/EasyTier/EasyTier.git
synced 2025-12-12 04:37:23 +08:00
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:
35
tauri-plugin-vpnservice/guest-js/index.ts
Normal file
35
tauri-plugin-vpnservice/guest-js/index.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { invoke } from '@tauri-apps/api/core'
|
||||
|
||||
export async function ping(value: string): Promise<string | null> {
|
||||
return await invoke<{ value?: string }>('plugin:vpnservice|ping', {
|
||||
payload: {
|
||||
value,
|
||||
},
|
||||
}).then((r) => (r.value ? r.value : null));
|
||||
}
|
||||
|
||||
export interface InvokeResponse {
|
||||
errorMsg?: string;
|
||||
}
|
||||
|
||||
export interface StartVpnRequest {
|
||||
ipv4Addr?: string;
|
||||
routes?: string[];
|
||||
dns?: string;
|
||||
disallowedApplications?: string[];
|
||||
mtu?: number;
|
||||
}
|
||||
|
||||
export async function prepare_vpn(): Promise<InvokeResponse | null> {
|
||||
return await invoke<InvokeResponse>('plugin:vpnservice|prepare_vpn', {})
|
||||
}
|
||||
|
||||
export async function start_vpn(request: StartVpnRequest): Promise<InvokeResponse | null> {
|
||||
return await invoke<InvokeResponse>('plugin:vpnservice|start_vpn', {
|
||||
...request,
|
||||
})
|
||||
}
|
||||
|
||||
export async function stop_vpn(): Promise<InvokeResponse | null> {
|
||||
return await invoke<InvokeResponse>('plugin:vpnservice|stop_vpn', {})
|
||||
}
|
||||
Reference in New Issue
Block a user