# concord-net/flclash architecture

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

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

## Overview

FlClash is a cross-platform Clash.Meta proxy client. The principal workflow is importing a profile, configuring proxy/rule behavior, then running traffic through the core in system-proxy or TUN mode; users can monitor live connections, DNS, requests and logs. The supplied tree omits the Flutter application sources, so its profile, backup, editor and live-view subsystems are represented from README capabilities without guessed implementation paths. Android service control and the Go core have stronger source evidence; edges are limited to documented or excerpted relationships.

Main entry points: [`core/lib.go`](https://github.com/concord-net/flclash/blob/main/core/lib.go) (Clash.Meta core), [`android/app/src/main/kotlin/com/follow/clash/ServiceController.kt`](https://github.com/concord-net/flclash/blob/main/android/app/src/main/kotlin/com/follow/clash/ServiceController.kt) (Service control), [`android/service/src/main/java/com/follow/clash/service/VpnService.kt`](https://github.com/concord-net/flclash/blob/main/android/service/src/main/java/com/follow/clash/service/VpnService.kt) (Android VPN), [`plugins/rust_api/rust/src/hotkey/service.rs`](https://github.com/concord-net/flclash/blob/main/plugins/rust_api/rust/src/hotkey/service.rs) (Global hotkeys)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client capabilities"]
  node_client_ui["Client interface"]
  node_profiles["Profiles"]
  node_editor["Profile editor<br/>[editor.rs]"]
  node_backup["Backup restore"]
  node_live_views["Live views"]
end

subgraph group_runtime["Proxy runtime"]
  node_core["Clash.Meta core<br/>[lib.go]"]
  node_routing["Rules and routing<br/>[service_rules.go]"]
  node_proxy_groups["Proxy groups<br/>[proxy.go]"]
  node_latency["Latency tests<br/>[delay.go]"]
  node_system_proxy["System proxy<br/>[proxy.rs]"]
  node_tun["TUN mode<br/>[tun.go]"]
end

subgraph group_android["Android integration"]
  node_android_control["Service control"]
  node_android_state["Service state<br/>[ServiceState.kt]"]
  node_android_vpn["Android VPN<br/>[VpnService.kt]"]
  node_android_core["Android core bridge<br/>[Core.kt]"]
  node_service_modules["Service modules<br/>[ServiceModules.kt]"]
end

subgraph group_desktop["Desktop integration"]
  node_hotkeys["Global hotkeys<br/>[service.rs]"]
  node_ipc["Local IPC<br/>[server.rs]"]
  node_tray["Tray menu<br/>[tray.rs]"]
end

node_user(("User"))
node_webdav[("WebDAV service")]

node_user -->|"uses"| node_client_ui
node_client_ui -->|"imports"| node_profiles
node_client_ui -->|"backs up"| node_backup
node_webdav -.->|"stores backup"| node_backup
node_client_ui -->|"views activity"| node_live_views
node_profiles -->|"edits profile"| node_editor
node_client_ui -->|"configures"| node_core
node_core -->|"applies rules"| node_routing
node_core -->|"uses groups"| node_proxy_groups
node_core -->|"tests latency"| node_latency
node_core -->|"supports mode"| node_system_proxy
node_core -->|"runs mode"| node_tun
node_user -.->|"starts proxy"| node_android_control
node_android_control -->|"updates state"| node_android_state
node_android_control -->|"starts service"| node_android_vpn
node_android_vpn -->|"starts TUN"| node_android_core
node_android_vpn -->|"starts modules"| node_service_modules
node_hotkeys -.->|"emits actions"| node_client_ui
node_client_ui -->|"controls tray"| node_tray
node_ipc -.->|"exchanges messages"| node_client_ui

click node_editor "https://github.com/concord-net/flclash/blob/main/plugins/rust_api/rust/src/api/editor.rs"
click node_core "https://github.com/concord-net/flclash/blob/main/core/lib.go"
click node_routing "https://github.com/concord-net/flclash/blob/main/core/service_rules.go"
click node_proxy_groups "https://github.com/concord-net/flclash/blob/main/core/proxy.go"
click node_latency "https://github.com/concord-net/flclash/blob/main/core/delay.go"
click node_system_proxy "https://github.com/concord-net/flclash/blob/main/plugins/rust_api/rust/src/api/proxy.rs"
click node_tun "https://github.com/concord-net/flclash/blob/main/core/tun/tun.go"
click node_android_control "https://github.com/concord-net/flclash/blob/main/android/app/src/main/kotlin/com/follow/clash/ServiceController.kt"
click node_android_state "https://github.com/concord-net/flclash/blob/main/android/app/src/main/kotlin/com/follow/clash/ServiceState.kt"
click node_android_vpn "https://github.com/concord-net/flclash/blob/main/android/service/src/main/java/com/follow/clash/service/VpnService.kt"
click node_android_core "https://github.com/concord-net/flclash/blob/main/android/core/src/main/java/com/follow/clash/core/Core.kt"
click node_service_modules "https://github.com/concord-net/flclash/blob/main/android/service/src/main/java/com/follow/clash/service/modules/ServiceModules.kt"
click node_hotkeys "https://github.com/concord-net/flclash/blob/main/plugins/rust_api/rust/src/hotkey/service.rs"
click node_ipc "https://github.com/concord-net/flclash/blob/main/plugins/rust_api/rust/src/ipc/server.rs"
click node_tray "https://github.com/concord-net/flclash/blob/main/plugins/rust_api/rust/src/api/tray.rs"

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_client_ui,node_profiles,node_editor,node_backup,node_live_views,node_user toneBlue
class node_core,node_routing,node_proxy_groups,node_latency,node_system_proxy,node_tun,node_webdav toneAmber
class node_android_control,node_android_state,node_android_vpn,node_android_core,node_service_modules toneMint
class node_hotkeys,node_ipc,node_tray toneRose
```

## Components

### Client capabilities

- **Client interface**
- **Profiles**
- [Profile editor](https://github.com/concord-net/flclash/blob/main/plugins/rust_api/rust/src/api/editor.rs): `plugins/rust_api/rust/src/api/editor.rs`
- **Backup restore**
- **Live views**

### Proxy runtime

- [Clash.Meta core](https://github.com/concord-net/flclash/blob/main/core/lib.go): `core/lib.go`
- [Rules and routing](https://github.com/concord-net/flclash/blob/main/core/service_rules.go): `core/service_rules.go`
- [Proxy groups](https://github.com/concord-net/flclash/blob/main/core/proxy.go): `core/proxy.go`
- [Latency tests](https://github.com/concord-net/flclash/blob/main/core/delay.go): `core/delay.go`
- [System proxy](https://github.com/concord-net/flclash/blob/main/plugins/rust_api/rust/src/api/proxy.rs): `plugins/rust_api/rust/src/api/proxy.rs`
- [TUN mode](https://github.com/concord-net/flclash/blob/main/core/tun/tun.go): `core/tun/tun.go`

### Android integration

- [Service control](https://github.com/concord-net/flclash/blob/main/android/app/src/main/kotlin/com/follow/clash/ServiceController.kt): `android/app/src/main/kotlin/com/follow/clash/ServiceController.kt`
- [Service state](https://github.com/concord-net/flclash/blob/main/android/app/src/main/kotlin/com/follow/clash/ServiceState.kt): `android/app/src/main/kotlin/com/follow/clash/ServiceState.kt`
- [Android VPN](https://github.com/concord-net/flclash/blob/main/android/service/src/main/java/com/follow/clash/service/VpnService.kt): `android/service/src/main/java/com/follow/clash/service/VpnService.kt`
- [Android core bridge](https://github.com/concord-net/flclash/blob/main/android/core/src/main/java/com/follow/clash/core/Core.kt): `android/core/src/main/java/com/follow/clash/core/Core.kt`
- [Service modules](https://github.com/concord-net/flclash/blob/main/android/service/src/main/java/com/follow/clash/service/modules/ServiceModules.kt): `android/service/src/main/java/com/follow/clash/service/modules/ServiceModules.kt`

### Desktop integration

- [Global hotkeys](https://github.com/concord-net/flclash/blob/main/plugins/rust_api/rust/src/hotkey/service.rs): `plugins/rust_api/rust/src/hotkey/service.rs`
- [Local IPC](https://github.com/concord-net/flclash/blob/main/plugins/rust_api/rust/src/ipc/server.rs): `plugins/rust_api/rust/src/ipc/server.rs`
- [Tray menu](https://github.com/concord-net/flclash/blob/main/plugins/rust_api/rust/src/api/tray.rs): `plugins/rust_api/rust/src/api/tray.rs`

### Other components

- **User**
- **WebDAV service**

## Connections

- User → Client interface: uses (evidence: `README.md`)
- Client interface → Profiles: imports (evidence: `README.md`)
- Client interface → Backup restore: backs up (evidence: `README.md`)
- WebDAV service → Backup restore: stores backup (evidence: `README.md`)
- Client interface → Live views: views activity (evidence: `README.md`)
- Profiles → Profile editor: edits profile (evidence: `README.md`)
- Client interface → Clash.Meta core: configures (evidence: `README.md`)
- Clash.Meta core → Rules and routing: applies rules (evidence: `README.md`)
- Clash.Meta core → Proxy groups: uses groups (evidence: `README.md`)
- Clash.Meta core → Latency tests: tests latency (evidence: `README.md`)
- Clash.Meta core → System proxy: supports mode (evidence: `README.md`)
- Clash.Meta core → TUN mode: runs mode (evidence: `README.md`)
- User → Service control: starts proxy
- Service control → Service state: updates state (evidence: `android/app/src/main/kotlin/com/follow/clash/ServiceController.kt`)
- Service control → Android VPN: starts service (evidence: `android/app/src/main/kotlin/com/follow/clash/ServiceController.kt`)
- Android VPN → Android core bridge: starts TUN (evidence: `android/service/src/main/java/com/follow/clash/service/VpnService.kt`)
- Android VPN → Service modules: starts modules (evidence: `android/service/src/main/java/com/follow/clash/service/VpnService.kt`)
- Global hotkeys → Client interface: emits actions
- Client interface → Tray menu: controls tray (evidence: `README.md`)
- Local IPC → Client interface: exchanges messages
