vpn/docs/building.md
2026-09-23 01:19:36 +00:00

2.6 KiB

Сборка и запуск

Development

uv sync
uv run pytest
uv run flet run app/main.py

uv уже был установлен в рабочем окружении. Flet current build creates a Flutter shell and packages the Python app; the native Android bridge is registered as a local Flet extension from native/android/flet_vpn_bridge.

Backend

Generate a Fernet key and configure the operator token:

export VPNAPP_ADMIN_TOKEN="$(python -c 'import secrets; print(secrets.token_urlsafe(32))')"
export VPNAPP_SECRET_KEY="$(uv run --project backend python -c 'from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())')"
export VPNAPP_BASE_URL=http://127.0.0.1:8080
./scripts/run-backend.sh

Open http://127.0.0.1:8080/admin. The page is one self-contained HTML file with no frontend build. It asks for the configured token, lists users/devices, creates/deletes them and generates enrollment/subscription links. Deploy behind HTTPS and do not put the admin token in a public URL.

Android

The Flet shell can be built without native core artifacts; runtime connections then return UNSUPPORTED honestly. A release build can enforce both artifacts:

./scripts/fetch-engine-artifacts.sh
REQUIRE_NATIVE_ARTIFACTS=1 ./scripts/build-android.sh

For a native-bridge/permissions smoke APK without cores, run ./scripts/build-android.sh. The script targets arm64-v8a.

Build prerequisites are current JDK/Android SDK/Flutter as required by Flet. Use a device/emulator with API 26+ for LocalOnlyHotspot; API 33+ needs runtime NEARBY_WIFI_DEVICES. Android VPN consent must be granted interactively by the user.

FreeTurn AAR:

git clone --depth 1 --branch <pinned-ref> https://github.com/samosvalishe/free-turn-proxy.git /tmp/free-turn-proxy
cd /tmp/free-turn-proxy
task build:android
cp dist/freeturn.aar /path/to/repo/native/android/libs/

For SignBox, use the exact artifact that exposes the API expected by native/android/flet_vpn_bridge/src/flutter/vpn_native_bridge/android/.../EngineAdapter.kt. A generic sing-box libbox.aar is not silently assumed to be the user's private SignBox fork. Record its commit, build tags, ABIs, license and SHA-256 in THIRD_PARTY_NOTICES.md, then replace the adapter with calls from that artifact and add a native integration test.

Desktop

SIGNBOX_BIN=/absolute/path/to/sign-box ./scripts/build-desktop.sh linux
SIGNBOX_BIN=/absolute/path/to/sign-box.exe ./scripts/build-desktop.sh windows

Desktop SignBox proxy mode is process based. System proxy changes are not performed.