# xiiifox/flutter_vless architecture

> Architecture diagram of the GitHub repository xiiifox/flutter_vless, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/xiiifox/flutter_vless
- Repository: https://github.com/xiiifox/flutter_vless

## Overview

flutter_vless is a cross-platform Flutter plugin for importing proxy/VPN profiles and running Xray through native backends. The documented user flow is profile input → configuration → permission/start → proxy or tunnel traffic, with status and delay checks. The excerpts show Android session orchestration and Windows mode dispatch; other platform implementations and Dart import/configuration code are not present in the supplied source sample, so those capabilities are represented only where the README supports them.

Main entry points: [`packages/flutter_vless_android/android/src/main/kotlin/com/github/tfox/flutter_vless/FlutterVlessPlugin.kt`](https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_android/android/src/main/kotlin/com/github/tfox/flutter_vless/FlutterVlessPlugin.kt) (Flutter plugin), [`packages/flutter_vless_android/android/src/main/kotlin/com/github/tfox/flutter_vless/xray/core/XrayCoreManager.kt`](https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_android/android/src/main/kotlin/com/github/tfox/flutter_vless/xray/core/XrayCoreManager.kt) (Xray core), [`packages/flutter_vless_android/android/src/main/kotlin/com/github/tfox/flutter_vless/xray/service/XrayVPNService.kt`](https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_android/android/src/main/kotlin/com/github/tfox/flutter_vless/xray/service/XrayVPNService.kt) (VPN service), [`packages/flutter_vless_windows/windows/v2ray_manager.cpp`](https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_windows/windows/v2ray_manager.cpp) (Runtime manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Flutter integration"]
  node_flutter_plugin["Flutter plugin"]
  node_profile_import["Profile import"]
  node_config_build["Config generation"]
end

subgraph group_android["Android runtime"]
  node_android_service["VPN service<br/>[XrayVPNService.kt]"]
  node_android_core["Xray core<br/>[XrayCoreManager.kt]"]
  node_android_config["Runtime config<br/>[XrayConfig.kt]"]
  node_android_policy["DNS and access policy"]
  node_android_socks["Authenticated SOCKS"]
  node_android_diagnostics[("Diagnostics store")]
end

subgraph group_windows["Windows runtime"]
  node_windows_plugin["Windows plugin"]
  node_windows_manager["Runtime manager<br/>[v2ray_manager.cpp]"]
  node_windows_proxy["Proxy service<br/>[proxy_service.cpp]"]
  node_windows_vpn["VPN service<br/>[vpn_service.cpp]"]
  node_windows_protection["Traffic protection"]
  node_windows_diagnostics[("Diagnostics log<br/>[diagnostics_log.h]")]
end

subgraph group_apple["Apple runtime"]
  node_ios_plugin["iOS plugin"]
  node_ios_tunnel["iOS tunnel support"]
  node_macos_plugin["macOS plugin"]
  node_macos_tunnel["Packet tunnel"]
end

node_user(("App developer"))

node_user -.->|"calls API"| node_flutter_plugin
node_user -->|"provides profile"| node_profile_import
node_profile_import -->|"generates config"| node_config_build
node_config_build -.->|"starts runtime"| node_flutter_plugin
node_flutter_plugin -.->|"dispatches session"| node_android_service
node_android_service -->|"accepts config"| node_android_config
node_android_service -->|"restarts workers"| node_android_core
node_android_core -->|"normalizes config"| node_android_config
node_android_core -->|"uses policy"| node_android_policy
node_android_core -->|"uses client"| node_android_socks
node_android_core -->|"records diagnostics"| node_android_diagnostics
node_flutter_plugin -.->|"dispatches platform"| node_windows_plugin
node_windows_plugin -.->|"controls runtime"| node_windows_manager
node_windows_manager -->|"starts proxy"| node_windows_proxy
node_windows_manager -->|"starts tunnel"| node_windows_vpn
node_windows_proxy -->|"appends logs"| node_windows_diagnostics
node_windows_vpn -.->|"activates protection"| node_windows_protection
node_flutter_plugin -.->|"dispatches platform"| node_ios_plugin
node_ios_plugin -.->|"starts tunnel"| node_ios_tunnel
node_flutter_plugin -.->|"dispatches platform"| node_macos_plugin
node_macos_plugin -.->|"starts tunnel"| node_macos_tunnel

click node_flutter_plugin "https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_android/android/src/main/kotlin/com/github/tfox/flutter_vless/FlutterVlessPlugin.kt"
click node_android_service "https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_android/android/src/main/kotlin/com/github/tfox/flutter_vless/xray/service/XrayVPNService.kt"
click node_android_core "https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_android/android/src/main/kotlin/com/github/tfox/flutter_vless/xray/core/XrayCoreManager.kt"
click node_android_config "https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_android/android/src/main/kotlin/com/github/tfox/flutter_vless/xray/dto/XrayConfig.kt"
click node_android_policy "https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_android/android/src/main/kotlin/com/github/tfox/flutter_vless/xray/core/AndroidTunnelDnsPolicy.kt"
click node_android_socks "https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_android/android/src/main/kotlin/com/github/tfox/flutter_vless/xray/core/AuthenticatedSocksClient.kt"
click node_android_diagnostics "https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_android/android/src/main/kotlin/com/github/tfox/flutter_vless/xray/core/XrayDiagnosticsStore.kt"
click node_windows_plugin "https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_windows/windows/flutter_vless_plugin.cpp"
click node_windows_manager "https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_windows/windows/v2ray_manager.cpp"
click node_windows_proxy "https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_windows/windows/proxy_service.cpp"
click node_windows_vpn "https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_windows/windows/vpn_service.cpp"
click node_windows_protection "https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_windows/windows/traffic_protection.cpp"
click node_windows_diagnostics "https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_windows/windows/diagnostics_log.h"
click node_ios_plugin "https://github.com/xiiifox/flutter_vless/blob/main/ios/flutter_vless/Sources/flutter_vless/FlutterVlessPlugin.swift"
click node_ios_tunnel "https://github.com/xiiifox/flutter_vless/blob/main/ios/flutter_vless/Sources/flutter_vless_tunnel_support/TunnelRuntimeSupport.swift"
click node_macos_plugin "https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_macos/macos/flutter_vless_macos/Sources/flutter_vless_macos/FlutterVlessPlugin.swift"
click node_macos_tunnel "https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_macos/macos/flutter_vless_macos/Sources/flutter_vless_macos_tunnel_support/FlutterVlessPacketTunnelProvider.swift"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_flutter_plugin,node_profile_import,node_config_build toneBlue
class node_android_service,node_android_core,node_android_config,node_android_policy,node_android_socks,node_android_diagnostics toneAmber
class node_windows_plugin,node_windows_manager,node_windows_proxy,node_windows_vpn,node_windows_protection,node_windows_diagnostics toneMint
class node_ios_plugin,node_ios_tunnel,node_macos_plugin,node_macos_tunnel toneRose
class node_user toneIndigo
```

## Components

### Flutter integration

- [Flutter plugin](https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_android/android/src/main/kotlin/com/github/tfox/flutter_vless/FlutterVlessPlugin.kt): `packages/flutter_vless_android/android/src/main/kotlin/com/github/tfox/flutter_vless/FlutterVlessPlugin.kt`
- **Profile import**
- **Config generation**

### Android runtime

- [VPN service](https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_android/android/src/main/kotlin/com/github/tfox/flutter_vless/xray/service/XrayVPNService.kt): `packages/flutter_vless_android/android/src/main/kotlin/com/github/tfox/flutter_vless/xray/service/XrayVPNService.kt`
- [Xray core](https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_android/android/src/main/kotlin/com/github/tfox/flutter_vless/xray/core/XrayCoreManager.kt): `packages/flutter_vless_android/android/src/main/kotlin/com/github/tfox/flutter_vless/xray/core/XrayCoreManager.kt`
- [Runtime config](https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_android/android/src/main/kotlin/com/github/tfox/flutter_vless/xray/dto/XrayConfig.kt): `packages/flutter_vless_android/android/src/main/kotlin/com/github/tfox/flutter_vless/xray/dto/XrayConfig.kt`
- [DNS and access policy](https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_android/android/src/main/kotlin/com/github/tfox/flutter_vless/xray/core/AndroidTunnelDnsPolicy.kt): `packages/flutter_vless_android/android/src/main/kotlin/com/github/tfox/flutter_vless/xray/core/AndroidTunnelDnsPolicy.kt`
- [Authenticated SOCKS](https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_android/android/src/main/kotlin/com/github/tfox/flutter_vless/xray/core/AuthenticatedSocksClient.kt): `packages/flutter_vless_android/android/src/main/kotlin/com/github/tfox/flutter_vless/xray/core/AuthenticatedSocksClient.kt`
- [Diagnostics store](https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_android/android/src/main/kotlin/com/github/tfox/flutter_vless/xray/core/XrayDiagnosticsStore.kt): `packages/flutter_vless_android/android/src/main/kotlin/com/github/tfox/flutter_vless/xray/core/XrayDiagnosticsStore.kt`

### Windows runtime

- [Windows plugin](https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_windows/windows/flutter_vless_plugin.cpp): `packages/flutter_vless_windows/windows/flutter_vless_plugin.cpp`
- [Runtime manager](https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_windows/windows/v2ray_manager.cpp): `packages/flutter_vless_windows/windows/v2ray_manager.cpp`
- [Proxy service](https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_windows/windows/proxy_service.cpp): `packages/flutter_vless_windows/windows/proxy_service.cpp`
- [VPN service](https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_windows/windows/vpn_service.cpp): `packages/flutter_vless_windows/windows/vpn_service.cpp`
- [Traffic protection](https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_windows/windows/traffic_protection.cpp): `packages/flutter_vless_windows/windows/traffic_protection.cpp`
- [Diagnostics log](https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_windows/windows/diagnostics_log.h): `packages/flutter_vless_windows/windows/diagnostics_log.h`

### Apple runtime

- [iOS plugin](https://github.com/xiiifox/flutter_vless/blob/main/ios/flutter_vless/Sources/flutter_vless/FlutterVlessPlugin.swift): `ios/flutter_vless/Sources/flutter_vless/FlutterVlessPlugin.swift`
- [iOS tunnel support](https://github.com/xiiifox/flutter_vless/blob/main/ios/flutter_vless/Sources/flutter_vless_tunnel_support/TunnelRuntimeSupport.swift): `ios/flutter_vless/Sources/flutter_vless_tunnel_support/TunnelRuntimeSupport.swift`
- [macOS plugin](https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_macos/macos/flutter_vless_macos/Sources/flutter_vless_macos/FlutterVlessPlugin.swift): `packages/flutter_vless_macos/macos/flutter_vless_macos/Sources/flutter_vless_macos/FlutterVlessPlugin.swift`
- [Packet tunnel](https://github.com/xiiifox/flutter_vless/blob/main/packages/flutter_vless_macos/macos/flutter_vless_macos/Sources/flutter_vless_macos_tunnel_support/FlutterVlessPacketTunnelProvider.swift): `packages/flutter_vless_macos/macos/flutter_vless_macos/Sources/flutter_vless_macos_tunnel_support/FlutterVlessPacketTunnelProvider.swift`

### Other components

- **App developer**

## Connections

- App developer → Flutter plugin: calls API (evidence: `README.md`)
- App developer → Profile import: provides profile (evidence: `README.md`)
- Profile import → Config generation: generates config (evidence: `README.md`)
- Config generation → Flutter plugin: starts runtime (evidence: `README.md`)
- Flutter plugin → VPN service: dispatches session
- VPN service → Runtime config: accepts config (evidence: `packages/flutter_vless_android/android/src/main/kotlin/com/github/tfox/flutter_vless/xray/service/XrayVPNService.kt`)
- VPN service → Xray core: restarts workers (evidence: `packages/flutter_vless_android/android/src/main/kotlin/com/github/tfox/flutter_vless/xray/service/XrayVPNService.kt`)
- Xray core → Runtime config: normalizes config (evidence: `packages/flutter_vless_android/android/src/main/kotlin/com/github/tfox/flutter_vless/xray/core/XrayCoreManager.kt`)
- Xray core → DNS and access policy: uses policy (evidence: `packages/flutter_vless_android/android/src/main/kotlin/com/github/tfox/flutter_vless/xray/core/XrayCoreManager.kt`)
- Xray core → Authenticated SOCKS: uses client (evidence: `packages/flutter_vless_android/android/src/main/kotlin/com/github/tfox/flutter_vless/xray/core/XrayCoreManager.kt`)
- Xray core → Diagnostics store: records diagnostics (evidence: `packages/flutter_vless_android/android/src/main/kotlin/com/github/tfox/flutter_vless/xray/core/XrayCoreManager.kt`)
- Flutter plugin → Windows plugin: dispatches platform
- Windows plugin → Runtime manager: controls runtime
- Runtime manager → Proxy service: starts proxy (evidence: `packages/flutter_vless_windows/windows/v2ray_manager.cpp`)
- Runtime manager → VPN service: starts tunnel (evidence: `packages/flutter_vless_windows/windows/v2ray_manager.cpp`)
- Proxy service → Diagnostics log: appends logs (evidence: `packages/flutter_vless_windows/windows/proxy_service.cpp`)
- VPN service → Traffic protection: activates protection
- Flutter plugin → iOS plugin: dispatches platform
- iOS plugin → iOS tunnel support: starts tunnel
- Flutter plugin → macOS plugin: dispatches platform
- macOS plugin → Packet tunnel: starts tunnel
