vpn/app/core/interface.py
2026-09-23 01:19:36 +00:00

31 lines
857 B
Python

from __future__ import annotations
from abc import ABC, abstractmethod
from app.models import CapabilitySet, RuntimeRequest, RuntimeSnapshot, RuntimeStats
class EngineBackend(ABC):
"""Platform-independent lifecycle contract.
Platform adapters may implement this through a desktop process or through the
Android native bridge. Python never owns Android VPN process lifetime.
"""
name: str
capabilities: CapabilitySet
@abstractmethod
async def start(self, request: RuntimeRequest) -> RuntimeSnapshot: ...
@abstractmethod
async def stop(self) -> RuntimeSnapshot: ...
@abstractmethod
async def restart(self, request: RuntimeRequest) -> RuntimeSnapshot: ...
@abstractmethod
async def get_state(self) -> RuntimeSnapshot: ...
@abstractmethod
async def get_stats(self) -> RuntimeStats: ...