# z-siqi/clash-for-windows_chinese architecture

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

- Interactive diagram: https://gitdiagram.com/z-siqi/clash-for-windows_chinese
- Repository: https://github.com/z-siqi/clash-for-windows_chinese

## Overview

This repository supports a modified Clash for Windows application, documented as offering a choice between legacy Clash and Mihomo cores, including AnyTLS support. The supplied tree and excerpts do not expose the main application implementation, so its documented capabilities are represented as subsystems without inferred call paths. The excerpts do show a Linux service helper that manages a proxy-core process and serves HTTP endpoints, plus TAP multicast packet policy. Release packaging code is omitted because it is build infrastructure, not product runtime.

Main entry points: [`app/main`](https://github.com/z-siqi/clash-for-windows_chinese/tree/main/app/main) (Core selection), [`scripts/native/linux-service-helper/main.go`](https://github.com/z-siqi/clash-for-windows_chinese/blob/main/scripts/native/linux-service-helper/main.go) (Linux service HTTP), [`scripts/native/tap-forwarder/packet_policy_cli.go`](https://github.com/z-siqi/clash-for-windows_chinese/blob/main/scripts/native/tap-forwarder/packet_policy_cli.go) (Packet policy CLI), [`scripts/native/linux-service-helper/policy.go`](https://github.com/z-siqi/clash-for-windows_chinese/blob/main/scripts/native/linux-service-helper/policy.go) (Service policy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application capabilities"]
  node_desktop["Clash for Windows"]
  node_corechoice["Core selection"]
  node_mihomo["Mihomo core"]
  node_legacy["Legacy Clash core"]
  node_anytls["AnyTLS editing"]
end

subgraph group_linux["Linux service"]
  node_linuxclient["Service API client"]
  node_service["Linux service HTTP<br/>[main.go]"]
  node_manager["Core process manager<br/>[main.go]"]
  node_policy["Service policy<br/>[policy.go]"]
end

subgraph group_tap["TAP forwarding"]
  node_tapcli["Packet policy CLI"]
  node_multicast["Multicast policy"]
  node_tun["TAP tunnel library"]
end

node_user(("Desktop user"))

node_user -->|"uses"| node_desktop
node_desktop -->|"offers"| node_corechoice
node_corechoice -->|"selects"| node_mihomo
node_corechoice -->|"selects"| node_legacy
node_mihomo -->|"supports"| node_anytls
node_service -->|"starts and stops"| node_manager
node_service -->|"loads"| node_policy
node_tapcli -->|"configures"| node_tun

click node_desktop "https://github.com/z-siqi/clash-for-windows_chinese/tree/main/app/main"
click node_corechoice "https://github.com/z-siqi/clash-for-windows_chinese/tree/main/app/main"
click node_mihomo "https://github.com/z-siqi/clash-for-windows_chinese/tree/main/app/main"
click node_legacy "https://github.com/z-siqi/clash-for-windows_chinese/tree/main/app/main"
click node_anytls "https://github.com/z-siqi/clash-for-windows_chinese/tree/main/app/main"
click node_linuxclient "https://github.com/z-siqi/clash-for-windows_chinese/tree/main/app/main"
click node_service "https://github.com/z-siqi/clash-for-windows_chinese/blob/main/scripts/native/linux-service-helper/main.go"
click node_manager "https://github.com/z-siqi/clash-for-windows_chinese/blob/main/scripts/native/linux-service-helper/main.go"
click node_policy "https://github.com/z-siqi/clash-for-windows_chinese/blob/main/scripts/native/linux-service-helper/policy.go"
click node_tapcli "https://github.com/z-siqi/clash-for-windows_chinese/blob/main/scripts/native/tap-forwarder/packet_policy_cli.go"
click node_multicast "https://github.com/z-siqi/clash-for-windows_chinese/blob/main/scripts/native/tap-forwarder/multicast_policy.go"

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_desktop,node_corechoice,node_mihomo,node_legacy,node_anytls,node_user toneBlue
class node_linuxclient,node_service,node_manager,node_policy toneAmber
class node_tapcli,node_multicast,node_tun toneMint
```

## Components

### Application capabilities

- [Clash for Windows](https://github.com/z-siqi/clash-for-windows_chinese/tree/main/app/main): `app/main`
- [Core selection](https://github.com/z-siqi/clash-for-windows_chinese/tree/main/app/main): `app/main`
- [Mihomo core](https://github.com/z-siqi/clash-for-windows_chinese/tree/main/app/main): `app/main`
- [Legacy Clash core](https://github.com/z-siqi/clash-for-windows_chinese/tree/main/app/main): `app/main`
- [AnyTLS editing](https://github.com/z-siqi/clash-for-windows_chinese/tree/main/app/main): `app/main`

### Linux service

- [Service API client](https://github.com/z-siqi/clash-for-windows_chinese/tree/main/app/main): `app/main`
- [Linux service HTTP](https://github.com/z-siqi/clash-for-windows_chinese/blob/main/scripts/native/linux-service-helper/main.go): `scripts/native/linux-service-helper/main.go`
- [Core process manager](https://github.com/z-siqi/clash-for-windows_chinese/blob/main/scripts/native/linux-service-helper/main.go): `scripts/native/linux-service-helper/main.go`
- [Service policy](https://github.com/z-siqi/clash-for-windows_chinese/blob/main/scripts/native/linux-service-helper/policy.go): `scripts/native/linux-service-helper/policy.go`

### TAP forwarding

- [Packet policy CLI](https://github.com/z-siqi/clash-for-windows_chinese/blob/main/scripts/native/tap-forwarder/packet_policy_cli.go): `scripts/native/tap-forwarder/packet_policy_cli.go`
- [Multicast policy](https://github.com/z-siqi/clash-for-windows_chinese/blob/main/scripts/native/tap-forwarder/multicast_policy.go): `scripts/native/tap-forwarder/multicast_policy.go`
- **TAP tunnel library**

### Other components

- **Desktop user**

## Connections

- Desktop user → Clash for Windows: uses (evidence: `README.md`)
- Clash for Windows → Core selection: offers (evidence: `README.md`)
- Core selection → Mihomo core: selects (evidence: `README.md`)
- Core selection → Legacy Clash core: selects (evidence: `README.md`)
- Mihomo core → AnyTLS editing: supports (evidence: `README.md`)
- Linux service HTTP → Core process manager: starts and stops (evidence: `scripts/native/linux-service-helper/main.go`)
- Linux service HTTP → Service policy: loads (evidence: `scripts/native/linux-service-helper/main.go`)
- Packet policy CLI → TAP tunnel library: configures (evidence: `scripts/native/tap-forwarder/packet_policy_cli.go`)
