Feature Architecture

Feature Architecture
Deep Dive

From routing engines to YAML config, from Fake-IP DNS to multi-protocol compatibility—master Clash architecture and unleash its full potential.

Core Capabilities

6 Core Capabilities
Building a Professional Proxy Ecosystem

Based on a high-performance core built in Go, Clash integrates all essential proxy capabilities—each refined by the community over years to become industry standards.

Rule-based Routing Engine

Precise multi-dimensional routing based on domains, IPs, GeoIP, and process names. Separate local and international traffic to eliminate bandwidth waste.

Learn More →

Multi-protocol Compatibility

Native support for Shadowsocks, VMess, Trojan, VLESS, Hysteria 2, TUIC, and more. A single core to replace fragmented clients.

View Protocols →

YAML Declarative Config

Uses human-friendly YAML syntax. Supports version control and one-click sync via subscription links, eliminating manual maintenance.

View Config Examples →

DNS & Fake-IP Leak Protection

Take over system DNS with Fake-IP to prevent DNS leaks to ISPs. Protect your real location and digital fingerprint in any network environment.

How it Works →

Proxy Groups & Auto-Speedtest

Supports select, url-test, fallback, and load-balance group types for high-availability proxy routing.

Proxy Groups Detail →

RESTful API External Control

Built-in HTTP RESTful API allows third-party dashboards like Yacd or MetaCubeX to switch nodes, monitor traffic, and manage rules visually.

API Docs →
Rule-Based Routing Engine

Rule-based Routing Engine
Precise Traffic Routing

Clash's core strength is its powerful Rule-based Proxy system. Unlike traditional tools limited to global proxy or simple PAC lists, Clash offers fine-grained multi-dimensional routing.

Rules are matched top-to-bottom. On a hit, the action (PROXY / DIRECT / REJECT) is executed. The final MATCH rule acts as a fallback.

DOMAIN
Exact Domain Match Match full domain, e.g., google.com
DOMAIN-SUFFIX
Domain Suffix Match Match specified domain and all subdomains
DOMAIN-KEYWORD
Domain Keyword Match Match if the domain contains the specified keyword
GEOIP
GeoIP Match Precise identification of IPs (e.g., CN) based on the MaxMind GeoIP database
IP-CIDR
IP CIDR Match Match specified CIDR range, supports IPv4 / IPv6
PROCESS-NAME
Process Name Match Set exclusive routing for specific applications at the process level
RULE-SET
Remote Rule Set Subscription Dynamically load rule sets from remote URLs with periodic auto-updates
MATCH
Fallback Rule (Must be at the end) Final action for traffic that doesn't match any other rule
config.yaml · rules snippet
# ── Rule-based routing configuration ── rules: # Exact domain → proxy - DOMAIN,google.com,PROXY - DOMAIN,youtube.com,PROXY - DOMAIN,openai.com,PROXY # Suffix matching → forward all subdomains - DOMAIN-SUFFIX,github.com,PROXY - DOMAIN-SUFFIX,twitter.com,PROXY # Keyword matching → catch CDN variants - DOMAIN-KEYWORD,googleapis,PROXY - DOMAIN-KEYWORD,gstatic,PROXY # Ad/tracker rejection - DOMAIN-SUFFIX,doubleclick.net,REJECT # Remote rule-set subscription (auto-updates) - RULE-SET,proxy-list,PROXY - RULE-SET,cn-domain,DIRECT # GeoIP: mainland China traffic → direct - GEOIP,CN,DIRECT # Final fallback - MATCH,PROXY
💡

Rule Providers: Import remote YAML/TEXT rule files via the rule-providers field. Clash auto-fetches updates, eliminating the need to manually maintain massive config files.

Multi-Protocol Support

Full Protocol Support
One Core for Everything

Clash Meta (mihomo) core expands upon the original Clash to support nearly all mainstream proxy protocols. Native compatibility with any provider ensures a single client for all needs.

Protocol Transport Encryption Obfuscation Use Case Support
Shadowsocks TCP / UDP AEAD Encryption Base Widest compatibility, provider standard Original + Meta
ShadowsocksR TCP / UDP Multi-Obfuscation Obfuscation Legacy provider compatibility Original + Meta
VMess TCP / WS / H2 / GRPC AES / ChaCha20 WebSocket TLS Preferred for V2Ray ecosystem Original + Meta
VLESS TCP / WS / H2 / GRPC No built-in encryption (depends on TLS) TLS / Reality Lightweight & high-performance, recommended for new setups Meta Only
Trojan TCP Native TLS HTTPS Website Obfuscation Strongest anti-probing Original + Meta
Hysteria 2 UDP (QUIC) TLS 1.3 QUIC Obfuscation Ultra-fast on high-latency/packet-loss networks Meta Only
TUIC UDP (QUIC) TLS 1.3 QUIC Multiplexing Optimized for low-latency scenarios Meta Only
Snell TCP AES-256-GCM Base Used with Surge ecosystem Original + Meta
Socks5 / HTTP TCP Optional TLS None LAN internal transit Original + Meta
Reality TCP XTLS / Vision Real website TLS fingerprinting Best for resisting TLS fingerprinting Meta Only

Protocol Recommendations for New Users

For new nodes, we recommend VLESS + Reality (best anti-detection) or Hysteria 2 (fastest on high-latency networks). Both require Clash Meta (mihomo). For widest compatibility, Shadowsocks (AEAD) remains the safest choice.

Configuration Standard

YAML Declarative Config
Full Structure Reference

Clash uses YAML as its sole configuration format. A complete config consists of several top-level fields—understanding them is the first step to mastering Clash.

01 · Base Network Config
# ── Basic network settings ── port: 7890 # HTTP proxy port socks-port: 7891 # SOCKS5 proxy port redir-port: 7892 # Transparent proxy port (Linux/macOS) tproxy-port: 7893 # TProxy port (Linux only) mixed-port: 7897 # HTTP + SOCKS5 combined port allow-lan: true # Allow LAN devices to use as gateway bind-address: '*' # Bind to all interfaces # Running mode: rule | global | direct mode: rule # Log level: silent | error | warning | info | debug log-level: info # External controller for dashboard panels (Yacd / MetaCubeX) external-controller: 127.0.0.1:9090 secret: 'your_api_secret'
02 · DNS Config (inc. Fake-IP)
# ── DNS configuration with Fake-IP ── dns: enable: true listen: 0.0.0.0:1053 ipv6: false # Fake-IP mode: prevents DNS leaks enhanced-mode: fake-ip fake-ip-range: 198.18.0.1/16 # Domains excluded from Fake-IP (LAN / local) fake-ip-filter: - '*.lan' - 'localhost.ptlogin2.qq.com' # Upstream DNS over HTTPS servers nameserver: - https://doh.pub/dns-query - https://dns.alidns.com/dns-query # Fallback DNS for non-CN domains (bypasses GFW) fallback: - https://1.1.1.1/dns-query - https://8.8.8.8/dns-query fallback-filter: geoip: true geoip-code: CN
03 · Proxy Nodes (proxies)
# ── Proxy server declarations ── proxies: # Shadowsocks node - name: "SS-US-01" type: ss server: us1.example.com port: 8388 cipher: chacha20-ietf-poly1305 password: "your_password" udp: true # VLESS + Reality node (Meta only) - name: "VLESS-Reality-HK" type: vless server: hk1.example.com port: 443 uuid: "your-uuid-here" tls: true reality-opts: public-key: "your-public-key" short-id: "abcdef01" # Hysteria 2 node (Meta only) - name: "HY2-JP-01" type: hysteria2 server: jp1.example.com port: 443 password: "your_password" sni: jp1.example.com
04 · Proxy Groups (proxy-groups)
# ── Proxy groups configuration ── proxy-groups: # Manual selection group - name: "PROXY" type: select proxies: ["Auto-Speed", "SS-US-01", "VLESS-Reality-HK"] # Auto url-test: picks lowest latency - name: "Auto-Speed" type: url-test url: "http://www.gstatic.com/generate_204" interval: 300 proxies: ["SS-US-01", "VLESS-Reality-HK", "HY2-JP-01"] # Fallback: switches on node failure - name: "Fallback" type: fallback url: "http://www.gstatic.com/generate_204" interval: 60 proxies: ["SS-US-01", "HY2-JP-01"] # Load balance across multiple nodes - name: "LoadBalance" type: load-balance strategy: round-robin proxies: ["SS-US-01", "VLESS-Reality-HK"]
Strategy Groups Architecture

4 Proxy Group Types
High-Availability Routing

select Manual Select

Manually switch proxy groups

Users manually select the active proxy node or subgroup via the client UI. Ideal for precise control, such as always using a US node for Netflix.

  • Supports nesting other proxy groups
  • Supports proxy-providers for importing subscriptions
  • Supports DIRECT / REJECT special nodes
url-test Auto Speedtest

Auto-latency speedtest proxy group

Periodically sends HTTP probes to all nodes in the group and auto-selects the one with the lowest latency. Fully automated for the best experience.

  • url:Latency test URL (gstatic 204 recommended)
  • interval:Interval (seconds), 300s recommended
  • tolerance:Tolerance value to avoid frequent switching
fallback Fallback

Fallback high-availability proxy group

Uses nodes in order; auto-switches to the next if the current one fails. Ideal for critical stability to ensure uninterrupted service.

  • Ordered degradation: prioritized top-of-list nodes
  • Auto-revert when node recovers
  • Ideal for streaming unblocking guarantees
load-balance Load Balance

Load-balance proxy group

Distributes traffic across multiple nodes. Supports consistent-hashing (fixed node per domain) and round-robin to maximize bandwidth and throughput.

  • consistent-hashing: fixed routing per source IP
  • round-robin: even distribution
  • Ideal for high-traffic multi-tasking and downloads
DNS & Privacy Architecture

Fake-IP Mechanism
Eliminate DNS Leaks

Why do standard proxies leak DNS?

In traditional proxying, browsers query the local ISP's DNS first, exposing access intent to the ISP even if traffic is encrypted.

How does Fake-IP solve this?

Clash's Fake-IP mode takes over system DNS, returning a fake local IP (e.g., 198.18.x.x) immediately so apps can connect. Clash then resolves the real domain via an encrypted tunnel to the remote proxy, preventing DNS leaks to ISPs.

Standard Proxy DNS Flow (with Leaks)
Browser Request Local ISP DNS Query
(Leaks intent)
Proxy Tunnel Connection
Fake-IP Mode (Zero Leaks)
Browser Request Clash Local Fake-IP
(Immediate 198.18.x.x response)
Domain Resolved Remotely
via Encrypted Tunnel
fake-ip mode Recommended

Returns a fake local IP; domain is sent via encrypted tunnel for remote resolution. Prevents DNS leaks with lowest connection latency.

redir-host mode Compatibility Mode

Resolves DNS locally first, then routes based on IP rules. Good compatibility, but risks DNS leaks.

⚠️

Fake-IP Filter (fake-ip-filter): Some local services (e.g., WeChat, QQ login domains) are incompatible with Fake-IP and should be excluded via fake-ip-filter.

🔒

Recommended DoH Upstreams: For China, https://doh.pub/dns-query or https://dns.alidns.com/dns-query; for Fallback, https://1.1.1.1/dns-query (Cloudflare).

RESTful API & External Control

Built-in RESTful API
For Visual Dashboards

The Clash core's HTTP RESTful API (opened via external-controller) allows dashboards like Yacd, MetaCubeX, or clash-dashboard to manage nodes, monitor traffic, and more in real-time without restarts.

GET Proxy & Node Management
GET /proxies Get all proxy and group info
PUT /proxies/:name Switch nodes for a specific group
GET /proxies/:name/delay Test real-time node latency (ms)
GET Traffic Monitoring & Connections
GET /traffic WebSocket real-time traffic throughput
GET /connections Get current active connections
DELETE /connections/:id Close specified connections
PUT Hot Updates
PUT /configs Hot reload config (no restart needed)
PATCH /configs Dynamically modify single fields
PUT /rules Hot update routing rule sets
WS Real-time Logs
GET /logs WebSocket real-time logs with level filtering
GET /version Get core version info
GET /memory Get real-time core memory usage
Recommended Dashboards
Yacd Lightweight and minimalist; fastest loading; best for beginners GitHub →
MetaCubeX Feature-rich; supports Meta-only features; best for advanced users GitHub →
Clash Dashboard Classic official dashboard; stable compatibility for all core versions GitHub →
Performance Architecture

Go Language Core
High-Performance Foundation

~5MB
Core Memory Usage
Far lower than the 200MB+ of Electron clients
10k+
Concurrent Connections
Go goroutine model; effortless high concurrency
<1%
Idle CPU Usage
Event-driven; near-zero resource consumption when idle
ARM
Native Multi-Arch Support
Full coverage for x86, ARM64, ARMv7, and MIPS

Go Goroutine Concurrency

Each connection is handled by a separate goroutine. Performance scales linearly with CPU cores under high concurrency without thread-switching overhead.

O(1) Rule Matching Hash Lookups

Domain rules use hash tables. Matching completes in constant time regardless of rule count, ensuring performance even with massive configs.

DNS Caching & Pre-resolution

Built-in DNS caching and Fake-IP mode allow immediate connections without waiting for remote DNS, significantly reducing perceived latency.

Cross-platform Single Binary

Compiled to a single binary with no dependencies. Supports Windows, macOS, Linux, and Android for zero-threshold deployment.

Quick Start Guide

5 Steps for Beginners
From Install to Global Access

Follow these steps to complete Clash setup in about 5 minutes on any OS and enjoy stable, smooth international access.

01

Download the right client for your platform

Pick a GUI client for your OS: Windows users (Clash Verge Rev), macOS users (Clash Verge Rev or ClashX Pro), Android users (Clash Meta for Android), Linux users (Clash Meta core with Yacd).

Go to Download Page →
02

Installation Complete & First Launch

Windows: Double-click .exe and follow the wizard. macOS: Drag the app from the .dmg to the Applications folder. Android: Enable 'Unknown Sources' and install the APK. On first launch, allow any system proxy permission prompts.

03

Import Subscription Link

Find the 'Profiles' or 'Subscription' page in the client UI. Paste your provider's subscription URL and click 'Download' or 'Update'. Clash will auto-parse all nodes and groups—no manual server entry needed.

04

Select Nodes & Test Latency

Go to 'Proxies' and run a 'Latency Test' on groups. Pick the node with the lowest latency (usually in green). If your subscription includes a 'url-test' group, Clash will auto-select the best node for you.

05

Enable System Proxy & Enjoy

Turn on 'System Proxy' in the main UI. Clash now handles all system traffic—visit Google, YouTube, or GitHub to see the speed boost. We recommend enabling 'Start on Boot' for convenience.

Frequently Asked Questions

Configuration FAQ
Troubleshooting Guide

Why can't I browse after starting Clash?

Check: 1) 'System Proxy' is ON. 2) Subscription is downloaded (node list visible). 3) Selected node has valid latency (not timeout). 4) Firewall allows Clash. Windows users: verify that system proxy settings point to 127.0.0.1:7890.

How to check for DNS leaks?

Visit dnsleaktest.com or ipleak.net. If DNS servers from your local ISP (e.g., China Telecom) appear, you have a leak. Set DNS enhanced-mode to 'fake-ip' in your config and restart.

Why didn't nodes update after refreshing?

Some clients use local cache. Use 'Force Refresh' or 'Update' in the 'Profiles' page. If issues persist, try re-adding the link or check if your subscription has expired.

How to enable TUN mode for all traffic?

Add 'tun: enable: true' and 'stack: mixed' to your config, and run the client as admin/root. TUN mode captures non-proxy-aware traffic (games, CLI tools) for true transparent proxying. Windows requires the Wintun driver.

Are Clash Meta and original Clash configs compatible?

Mostly. Original Clash configs work on Clash Meta (mihomo). However, Meta's new fields (VLESS, Reality, Hysteria 2, TUIC) won't work on the original core, which was deprecated in 2023. We recommend migrating to Meta.

How to set up Clash as a transparent gateway on Linux?

1) Download the Clash Meta binary. 2) Set 'tproxy-port: 7893' and 'allow-lan: true' in YAML. 3) Forward traffic to port 7893 via iptables/nftables. 4) Use systemd for boot startup. Point other LAN devices' gateways to this server.

Ready to start?

Download the Clash client for your platform. Set it up in 3 minutes and enjoy fast, stable international access.

Free Download Latest Version GitHub Repository