# filterrr/flclash architecture

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

- Interactive diagram: https://gitdiagram.com/filterrr/flclash
- Repository: https://github.com/filterrr/flclash

## Overview

FlClash is a cross-platform ClashMeta proxy client. The documented user workflow is to configure proxy or VPN use in the client, start it, and route traffic; Android’s sampled path exposes the app/plugin bridge, shared run state, and platform services. The repository tree does not include the Flutter application sources, so subscription management, WebDAV sync, and the UI are documented capabilities but their implementation paths and connections cannot be traced here. Core Go and helper-service internals are only partly sampled; the graph avoids inferring calls between them.

Main entry points: [`android/app/src/main/kotlin/com/follow/clask/GlobalState.kt`](https://github.com/filterrr/flclash/blob/main/android/app/src/main/kotlin/com/follow/clask/GlobalState.kt) (Shared run state), [`android/app/src/main/kotlin/com/follow/clask/MainActivity.kt`](https://github.com/filterrr/flclash/blob/main/android/app/src/main/kotlin/com/follow/clask/MainActivity.kt) (Android app host), [`android/app/src/main/kotlin/com/follow/clask/plugins/VpnPlugin.kt`](https://github.com/filterrr/flclash/blob/main/android/app/src/main/kotlin/com/follow/clask/plugins/VpnPlugin.kt) (VPN plugin), [`android/app/src/main/kotlin/com/follow/clask/services/FlClashVpnService.kt`](https://github.com/filterrr/flclash/blob/main/android/app/src/main/kotlin/com/follow/clask/services/FlClashVpnService.kt) (VPN service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_android["Android runtime"]
  node_android_app["Android app host<br/>[MainActivity.kt]"]
  node_global["Shared run state<br/>[GlobalState.kt]"]
  node_app_plugin["App plugin<br/>[AppPlugin.kt]"]
  node_service_plugin["Service plugin<br/>[ServicePlugin.kt]"]
  node_vpn_plugin["VPN plugin<br/>[VpnPlugin.kt]"]
  node_tile_plugin["Tile plugin<br/>[TilePlugin.kt]"]
  node_update_plugin["Update plugin<br/>[UpdatePlugin.kt]"]
  node_vpn_service["VPN service"]
  node_proxy_service["Proxy service<br/>[FlClashService.kt]"]
  node_tile_service["Quick settings tile"]
  node_screen_watcher["Screen watcher"]
end

subgraph group_engine["Proxy engine"]
  node_core_api["Go client API<br/>[lib.go]"]
  node_core_hub["Core hub<br/>[hub.go]"]
  node_core_server["Core server<br/>[server.go]"]
  node_core_state["Core state<br/>[state.go]"]
  node_core_tun["Tunnel support<br/>[tun.go]"]
end

subgraph group_desktop["Desktop integration"]
  node_helper_api["Helper HTTP service<br/>[hub.rs]"]
  node_helper_process["Helper process service<br/>[windows.rs]"]
  node_window_ext["Window integration"]
  node_proxy_plugin["Windows proxy plugin<br/>[proxy_plugin.cpp]"]
end

node_user(("Client user"))

node_user -.->|"opens client"| node_android_app
node_android_app -->|"registers"| node_app_plugin
node_android_app -->|"registers"| node_vpn_plugin
node_android_app -->|"registers"| node_service_plugin
node_android_app -->|"registers"| node_tile_plugin
node_android_app -->|"registers"| node_update_plugin
node_global -->|"installs"| node_app_plugin
node_global -->|"installs"| node_vpn_plugin
node_global -->|"installs"| node_tile_plugin
node_global -->|"installs"| node_service_plugin
node_service_plugin -->|"initializes engine"| node_global
node_vpn_plugin -->|"binds service"| node_vpn_service
node_vpn_plugin -->|"binds service"| node_proxy_service
node_vpn_plugin -->|"updates run state"| node_global
node_vpn_service -->|"initializes engine"| node_global
node_vpn_service -->|"uses watcher"| node_screen_watcher
node_proxy_service -->|"uses watcher"| node_screen_watcher
node_tile_service -->|"toggles run"| node_global
node_helper_api -.->|"starts and stops"| node_helper_process

click node_android_app "https://github.com/filterrr/flclash/blob/main/android/app/src/main/kotlin/com/follow/clask/MainActivity.kt"
click node_global "https://github.com/filterrr/flclash/blob/main/android/app/src/main/kotlin/com/follow/clask/GlobalState.kt"
click node_app_plugin "https://github.com/filterrr/flclash/blob/main/android/app/src/main/kotlin/com/follow/clask/plugins/AppPlugin.kt"
click node_service_plugin "https://github.com/filterrr/flclash/blob/main/android/app/src/main/kotlin/com/follow/clask/plugins/ServicePlugin.kt"
click node_vpn_plugin "https://github.com/filterrr/flclash/blob/main/android/app/src/main/kotlin/com/follow/clask/plugins/VpnPlugin.kt"
click node_tile_plugin "https://github.com/filterrr/flclash/blob/main/android/app/src/main/kotlin/com/follow/clask/plugins/TilePlugin.kt"
click node_update_plugin "https://github.com/filterrr/flclash/blob/main/android/app/src/main/kotlin/com/follow/clask/plugins/UpdatePlugin.kt"
click node_vpn_service "https://github.com/filterrr/flclash/blob/main/android/app/src/main/kotlin/com/follow/clask/services/FlClashVpnService.kt"
click node_proxy_service "https://github.com/filterrr/flclash/blob/main/android/app/src/main/kotlin/com/follow/clask/services/FlClashService.kt"
click node_tile_service "https://github.com/filterrr/flclash/blob/main/android/app/src/main/kotlin/com/follow/clask/services/FlClashTileService.kt"
click node_screen_watcher "https://github.com/filterrr/flclash/blob/main/android/app/src/main/kotlin/com/follow/clask/services/ScreenStateWatcher.kt"
click node_core_api "https://github.com/filterrr/flclash/blob/main/core/lib.go"
click node_core_hub "https://github.com/filterrr/flclash/blob/main/core/hub.go"
click node_core_server "https://github.com/filterrr/flclash/blob/main/core/server.go"
click node_core_state "https://github.com/filterrr/flclash/blob/main/core/state/state.go"
click node_core_tun "https://github.com/filterrr/flclash/blob/main/core/tun/tun.go"
click node_helper_api "https://github.com/filterrr/flclash/blob/main/services/helper/src/service/hub.rs"
click node_helper_process "https://github.com/filterrr/flclash/blob/main/services/helper/src/service/windows.rs"
click node_window_ext "https://github.com/filterrr/flclash/blob/main/plugins/window_ext/macos/Classes/WindowExtPlugin.swift"
click node_proxy_plugin "https://github.com/filterrr/flclash/blob/main/plugins/proxy/windows/proxy_plugin.cpp"

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_android_app,node_global,node_app_plugin,node_service_plugin,node_vpn_plugin,node_tile_plugin,node_update_plugin,node_vpn_service,node_proxy_service,node_tile_service,node_screen_watcher,node_user toneBlue
class node_core_api,node_core_hub,node_core_server,node_core_state,node_core_tun toneAmber
class node_helper_api,node_helper_process,node_window_ext,node_proxy_plugin toneMint
```

## Components

### Android runtime

- [Android app host](https://github.com/filterrr/flclash/blob/main/android/app/src/main/kotlin/com/follow/clask/MainActivity.kt): `android/app/src/main/kotlin/com/follow/clask/MainActivity.kt`
- [Shared run state](https://github.com/filterrr/flclash/blob/main/android/app/src/main/kotlin/com/follow/clask/GlobalState.kt): `android/app/src/main/kotlin/com/follow/clask/GlobalState.kt`
- [App plugin](https://github.com/filterrr/flclash/blob/main/android/app/src/main/kotlin/com/follow/clask/plugins/AppPlugin.kt): `android/app/src/main/kotlin/com/follow/clask/plugins/AppPlugin.kt`
- [Service plugin](https://github.com/filterrr/flclash/blob/main/android/app/src/main/kotlin/com/follow/clask/plugins/ServicePlugin.kt): `android/app/src/main/kotlin/com/follow/clask/plugins/ServicePlugin.kt`
- [VPN plugin](https://github.com/filterrr/flclash/blob/main/android/app/src/main/kotlin/com/follow/clask/plugins/VpnPlugin.kt): `android/app/src/main/kotlin/com/follow/clask/plugins/VpnPlugin.kt`
- [Tile plugin](https://github.com/filterrr/flclash/blob/main/android/app/src/main/kotlin/com/follow/clask/plugins/TilePlugin.kt): `android/app/src/main/kotlin/com/follow/clask/plugins/TilePlugin.kt`
- [Update plugin](https://github.com/filterrr/flclash/blob/main/android/app/src/main/kotlin/com/follow/clask/plugins/UpdatePlugin.kt): `android/app/src/main/kotlin/com/follow/clask/plugins/UpdatePlugin.kt`
- [VPN service](https://github.com/filterrr/flclash/blob/main/android/app/src/main/kotlin/com/follow/clask/services/FlClashVpnService.kt): `android/app/src/main/kotlin/com/follow/clask/services/FlClashVpnService.kt`
- [Proxy service](https://github.com/filterrr/flclash/blob/main/android/app/src/main/kotlin/com/follow/clask/services/FlClashService.kt): `android/app/src/main/kotlin/com/follow/clask/services/FlClashService.kt`
- [Quick settings tile](https://github.com/filterrr/flclash/blob/main/android/app/src/main/kotlin/com/follow/clask/services/FlClashTileService.kt): `android/app/src/main/kotlin/com/follow/clask/services/FlClashTileService.kt`
- [Screen watcher](https://github.com/filterrr/flclash/blob/main/android/app/src/main/kotlin/com/follow/clask/services/ScreenStateWatcher.kt): `android/app/src/main/kotlin/com/follow/clask/services/ScreenStateWatcher.kt`

### Proxy engine

- [Go client API](https://github.com/filterrr/flclash/blob/main/core/lib.go): `core/lib.go`
- [Core hub](https://github.com/filterrr/flclash/blob/main/core/hub.go): `core/hub.go`
- [Core server](https://github.com/filterrr/flclash/blob/main/core/server.go): `core/server.go`
- [Core state](https://github.com/filterrr/flclash/blob/main/core/state/state.go): `core/state/state.go`
- [Tunnel support](https://github.com/filterrr/flclash/blob/main/core/tun/tun.go): `core/tun/tun.go`

### Desktop integration

- [Helper HTTP service](https://github.com/filterrr/flclash/blob/main/services/helper/src/service/hub.rs): `services/helper/src/service/hub.rs`
- [Helper process service](https://github.com/filterrr/flclash/blob/main/services/helper/src/service/windows.rs): `services/helper/src/service/windows.rs`
- [Window integration](https://github.com/filterrr/flclash/blob/main/plugins/window_ext/macos/Classes/WindowExtPlugin.swift): `plugins/window_ext/macos/Classes/WindowExtPlugin.swift`
- [Windows proxy plugin](https://github.com/filterrr/flclash/blob/main/plugins/proxy/windows/proxy_plugin.cpp): `plugins/proxy/windows/proxy_plugin.cpp`

### Other components

- **Client user**

## Connections

- Client user → Android app host: opens client
- Android app host → App plugin: registers (evidence: `android/app/src/main/kotlin/com/follow/clask/MainActivity.kt`)
- Android app host → VPN plugin: registers (evidence: `android/app/src/main/kotlin/com/follow/clask/MainActivity.kt`)
- Android app host → Service plugin: registers (evidence: `android/app/src/main/kotlin/com/follow/clask/MainActivity.kt`)
- Android app host → Tile plugin: registers (evidence: `android/app/src/main/kotlin/com/follow/clask/MainActivity.kt`)
- Android app host → Update plugin: registers (evidence: `android/app/src/main/kotlin/com/follow/clask/MainActivity.kt`)
- Shared run state → App plugin: installs (evidence: `android/app/src/main/kotlin/com/follow/clask/GlobalState.kt`)
- Shared run state → VPN plugin: installs (evidence: `android/app/src/main/kotlin/com/follow/clask/GlobalState.kt`)
- Shared run state → Tile plugin: installs (evidence: `android/app/src/main/kotlin/com/follow/clask/GlobalState.kt`)
- Shared run state → Service plugin: installs (evidence: `android/app/src/main/kotlin/com/follow/clask/GlobalState.kt`)
- Service plugin → Shared run state: initializes engine (evidence: `android/app/src/main/kotlin/com/follow/clask/plugins/ServicePlugin.kt`)
- VPN plugin → VPN service: binds service (evidence: `android/app/src/main/kotlin/com/follow/clask/plugins/VpnPlugin.kt`)
- VPN plugin → Proxy service: binds service (evidence: `android/app/src/main/kotlin/com/follow/clask/plugins/VpnPlugin.kt`)
- VPN plugin → Shared run state: updates run state (evidence: `android/app/src/main/kotlin/com/follow/clask/plugins/VpnPlugin.kt`)
- VPN service → Shared run state: initializes engine (evidence: `android/app/src/main/kotlin/com/follow/clask/services/FlClashVpnService.kt`)
- VPN service → Screen watcher: uses watcher (evidence: `android/app/src/main/kotlin/com/follow/clask/services/FlClashVpnService.kt`)
- Proxy service → Screen watcher: uses watcher (evidence: `android/app/src/main/kotlin/com/follow/clask/services/FlClashService.kt`)
- Quick settings tile → Shared run state: toggles run (evidence: `android/app/src/main/kotlin/com/follow/clask/services/FlClashTileService.kt`)
- Helper HTTP service → Helper process service: starts and stops
