import { invoke } from '@tauri-apps/api/core' export async function ping(value: string): Promise { 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 { return await invoke('plugin:vpnservice|prepare_vpn', {}) } export async function start_vpn(request: StartVpnRequest): Promise { return await invoke('plugin:vpnservice|start_vpn', { ...request, }) } export async function stop_vpn(): Promise { return await invoke('plugin:vpnservice|stop_vpn', {}) }