Files
smolkik-code 7c7c88621d Initial commit: VPN Control Panel
- FastAPI REST API with JWT auth
- aiogram 3 Telegram bot with admin middleware
- APScheduler daily tasks (expiry, reminders, revoke, sync)
- SQLAlchemy 2 async ORM with Alembic migrations
- Jinja2 admin panel (Dashboard, Users, Payments, Servers, Tariffs)
- VPN provider abstraction with MockProvider
- Stats service with revenue/subscription analytics
- Docker Compose (PostgreSQL + Redis + app)
- Healthcheck endpoint
2026-07-05 17:50:11 +07:00

45 lines
915 B
Python

from abc import ABC, abstractmethod
from dataclasses import dataclass, field
from datetime import datetime
@dataclass
class VPNUserInfo:
vpn_id: str
internal_id: int
server_id: int
name: str
is_enabled: bool
access_config: str | None = None
bytes_used: int = 0
data_limit: int | None = None
created_at: datetime | None = None
class VPNProvider(ABC):
@abstractmethod
async def create_user(
self,
internal_id: int,
server_id: int,
name: str,
) -> VPNUserInfo:
...
@abstractmethod
async def delete_user(self, vpn_id: str) -> bool:
...
@abstractmethod
async def enable_user(self, vpn_id: str) -> bool:
...
@abstractmethod
async def disable_user(self, vpn_id: str) -> bool:
...
@abstractmethod
async def get_user(self, vpn_id: str) -> VPNUserInfo | None:
...