开源 · 跨平台 · 安全

Clash — 跨平台智能代理客户端

支持多协议分流与智能路由,实现快速、安全的网络访问。基于规则精细控制流量,让代理更智能、更高效。

为什么选择 Clash?

Clash 不仅仅是一个代理工具,它是一套完整的网络流量管理方案,赋予你对每一字节流量的完全掌控力。

🔌

多协议兼容

支持 Shadowsocks(R)、VMess、Trojan、Snell、SOCKS5、HTTP(S)、Wireguard 等多种协议。

🧠

智能分流

按域名、IP、进程名精准分流,国内直连、境外代理,支持 JavaScript 动态脚本规则。

💻

跨平台支持

覆盖 Windows、macOS、Linux、Android、iOS、OpenWrt 等主流平台,生态丰富。

🔒

安全隐私

开源可审计,配置与日志本地化存储,优先支持 TLS 加密传输,保障数据安全。

策略组管理

支持 url-test 延迟优选、fallback 故障转移、load-balance 负载均衡等多种策略组类型。

🌐

Fake-IP DNS

特有的 Fake-IP DNS 机制,最大限度减少 DNS 污染影响,同时显著提升网络性能。

🔄

远程 Providers

动态加载远程代理列表和规则集,订阅链接一键更新,减少手动维护成本。

📡

RESTful API

提供完整的 RESTful API 接口,方便集成与自动化管理,满足高级用户定制需求。

选择您的平台

Clash 拥有丰富的跨平台客户端生态,请选择适合您设备的版本开始使用。

🪟

Windows

Clash Verge Rev 下载 Windows 版 Clash for Windows
🍎

macOS

ClashX / Stash 下载 macOS 版 Stash (App Store)
🤖

Android

Clash for Android 下载 Android 版
📱

iOS

Stash / Shadowrocket Stash (App Store) Shadowrocket
🐧

Linux / OpenWrt

命令行 / OpenClash Linux AppImage OpenClash
⚠ 安全提示:请优先使用上述可信来源下载 Clash 相关客户端,避免从不明第三方网站获取安装包,以防范安全风险与捆绑软件。建议下载后校验文件完整性。

三步开始使用

只需简单三步,即可完成 Clash 的安装与配置,开启智能代理之旅。

第一步:下载安装

根据您的操作系统,从上方下载区选择对应的 Clash 客户端版本进行下载并完成安装。安装过程简单快捷,无需复杂设置。

第二步:导入配置

获取订阅链接或 YAML 配置文件后,在客户端中找到"配置导入"入口,粘贴链接或上传文件即可自动加载节点与规则。支持远程订阅自动更新。

第三步:启用代理

配置导入成功后,点击"开启"或"连接"按钮启用代理。您可以通过访问测试网站来验证代理是否生效,确保流量已正确路由。

💡 提示:订阅链接通常由您的服务提供商提供,YAML 配置文件可手动编写或从社区获取模板。

您的安全,我们的承诺

Clash 始终将用户安全与隐私放在首位,以开源精神构建可信赖的网络工具。

📖

开源生态

项目基于 GPL-3.0 开源许可证发布,代码完全公开透明,任何人均可审查、审计和贡献代码,杜绝后门隐患。

💾

数据本地化

所有配置文件和运行日志默认保存在本地设备上,不会自动上传至任何远程服务器,避免关键访问凭据泄露风险。

🛡️

加密传输

优先支持 TLS 等加密协议进行数据传输,确保您的网络流量在传输过程中得到充分保护,防止中间人攻击与窃听。

解答您的疑问

以下整理了关于 Clash 的常见问题,涵盖产品介绍、安装部署、配置使用、技术原理及安全隐私等类别。

类别一:产品介绍
Clash 是什么?它和传统 VPN 有什么区别?

Clash 是一个基于规则的开源代理工具,与传统 VPN 有本质区别。以下是详细解答:

  1. 工作原理不同:传统 VPN 将所有流量通过加密隧道转发到远程服务器,而 Clash 基于规则选择性代理,只有匹配规则的流量才会走代理,其余流量直连,效率更高。
  2. 分流能力:Clash 支持按域名、IP 地址、进程名称等多维度进行精细分流,可实现国内网站直连、境外网站代理的智能路由,VPN 通常只能全量转发。
  3. 配置灵活度:Clash 使用 YAML 配置文件,用户可以自定义策略组、规则集和节点选择逻辑,灵活性远超传统 VPN 的固定模式。
  4. 协议兼容性:Clash 支持 Shadowsocks、VMess、Trojan、Snell 等多种代理协议,而传统 VPN 通常只支持单一协议如 OpenVPN 或 WireGuard。
  5. 部署方式:Clash 可作为客户端运行在个人设备上,也可部署在网关或路由器上实现全屋代理,VPN 通常需要专用服务器和客户端配对使用。
  6. 生态开放性:Clash 拥有活跃的开源社区和丰富的第三方图形界面客户端,用户可根据需求自由选择,VPN 生态相对封闭且商业化程度较高。
类别二:安装部署
如何在 Windows、macOS 和 Android 上安装 Clash?

Clash 在各大平台上拥有成熟的客户端生态,安装过程简便快捷。具体步骤如下:

  1. 选择客户端:Windows 用户推荐使用 Clash Verge Rev 或 Clash for Windows;macOS 用户推荐 ClashX 或 Stash;Android 用户推荐 Clash for Android。请从官网或 GitHub 官方仓库获取安装包。
  2. 下载安装包:访问对应客户端的 GitHub Releases 页面,选择最新稳定版本,根据系统架构下载 .exe、.dmg 或 .apk 格式的安装文件,注意校验文件哈希值以确保完整性。
  3. 完成安装:Windows 双击运行安装程序按向导完成;macOS 将 .app 拖入 Applications 文件夹;Android 开启"允许安装未知来源应用"后安装 APK 文件。
  4. 首次启动:安装完成后启动客户端,此时界面可能显示"无配置"状态,需要导入订阅链接或 YAML 配置文件才能正常使用代理功能。
  5. 授予权限:macOS 首次启动可能需要授予网络扩展权限,Android 需要授予 VPN 权限,请按系统提示操作以确保代理功能正常运行。
  6. 验证安装:成功导入配置并启用代理后,可访问测试网站确认 IP 地址是否已变更,验证代理是否生效。如遇问题可查阅官方文档或社区资源排查。
类别三:配置导入
如何导入订阅链接和 YAML 配置文件?

导入配置是使用 Clash 的关键步骤,支持订阅链接和本地 YAML 文件两种方式。详细步骤如下:

  1. 获取配置来源:订阅链接通常由您的服务提供商提供,是一段以 http(s):// 开头的 URL;YAML 文件可从社区模板获取或自行编写,包含代理节点信息和规则定义。
  2. 打开配置界面:启动 Clash 客户端后,在界面中找到"配置"或"Profiles"选项卡,不同客户端的入口位置略有差异但功能相似,通常位于侧边栏或顶部菜单中。
  3. 导入订阅链接:点击"添加订阅"或"从 URL 导入",在输入框中粘贴订阅链接,设置自动更新间隔(建议 24 小时),保存后客户端会自动拉取远程节点和规则配置。
  4. 导入本地文件:选择"导入本地配置"或"从文件加载",浏览文件系统找到 .yaml 或 .yml 格式的配置文件,确认导入后客户端会解析文件内容并加载所有节点与规则。
  5. 选择激活配置:导入成功后,在配置列表中选中刚刚导入的配置文件并点击"激活"或"切换",使该配置生效。客户端会显示当前使用的配置名称和节点数量。
  6. 验证配置正确性:激活配置后检查节点列表是否正常显示,规则是否按预期匹配。如有报错信息,请检查 YAML 语法或订阅链接的有效性,必要时联系服务提供商获取支持。
类别四:使用技巧
如何使用策略组和智能分流功能?

策略组是 Clash 的核心功能之一,配合智能分流可实现最优的网络访问体验。使用步骤如下:

  1. 理解策略组类型:url-test 自动测试延迟并选择最低节点;fallback 在主节点不可用时自动切换备用节点;load-balance 将流量分散到多个节点以实现负载均衡,每种类型适用于不同使用场景。
  2. 查看默认策略组:打开客户端后,在"代理"或"Proxies"页面可以看到所有策略组,常见的包括"自动选择""全球直连""广告拦截"等预设组,每个组包含若干可用节点。
  3. 手动切换节点:点击策略组展开节点列表,手动选择一个节点即可将流量导向该节点。适用于需要临时切换地区或测试特定节点速度的场景,灵活便捷。
  4. 配置分流规则:在 YAML 配置文件的 rules 部分定义域名匹配规则,例如将 .cn 域名设为 DIRECT(直连),将 .google.com 设为 Proxy(走代理),实现精细化的流量路由控制。
  5. 使用规则集:通过 rule-providers 引用远程规则集,如 GeoIP 数据库或社区维护的域名列表,可自动更新规则而无需手动编辑配置文件,大幅降低维护工作量。
  6. 优化策略组设置:根据实际网络环境调整 url-test 的测试间隔和容差参数,合理设置 fallback 的检测URL,确保策略组在延迟、可用性和负载之间达到最佳平衡。
类别五:技术原理
Clash 的 Fake-IP DNS 和透明代理是如何工作的?

Fake-IP DNS 和透明代理是 Clash 的两项核心技术,它们协同工作以提升网络性能并避免 DNS 污染。工作原理如下:

  1. Fake-IP 机制概述:当应用发起 DNS 查询时,Clash 不直接返回真实 IP,而是返回一个虚拟的 Fake IP 地址段(通常为 198.18.x.x),同时将真实域名与 Fake IP 的映射关系记录在内存中供后续路由使用。
  2. DNS 污染防护:由于 DNS 查询走的是代理通道而非本地网络,Fake-IP 机制可有效规避本地 DNS 服务器可能遭遇的污染和劫持问题,确保域名解析结果的准确性。
  3. 性能优化原理:Fake-IP 模式下 DNS 查询与代理连接可并行进行,减少了传统模式下"先解析再连接"的串行等待时间,显著降低首字节延迟并提升网页加载速度。
  4. 透明代理概念:透明代理允许 Clash 在用户无感知的情况下接管设备的所有网络流量,通过自动修改系统路由表或使用 TProxy 技术将 TCP/UDP 流量重定向到 Clash 进行处理。
  5. Redirect TCP 模式:在 Linux 系统上使用 iptables 或 nftables 规则将出站 TCP 连接重定向到 Clash 的监听端口,Clash 根据规则决定直连或代理,实现全设备级别的透明路由服务。
  6. TProxy UDP 支持:对于 UDP 流量(如 DNS 查询、QUIC 协议),TProxy 技术可保留原始目标地址信息,使 Clash 能够正确路由 UDP 数据包,配合 Fake-IP 实现完整的透明代理解决方案。
类别六:安全隐私
使用 Clash 时如何确保网络安全和隐私保护?

网络安全和隐私保护是使用代理工具时的核心关切,Clash 提供了多重机制来保障用户的数据安全。建议遵循以下步骤:

  1. 从可信来源获取软件:仅从官方 GitHub 仓库或经过验证的应用商店下载 Clash 客户端,避免使用来路不明的修改版或破解版,这些版本可能被植入恶意代码或后门程序。
  2. 审查配置文件内容:在导入任何 YAML 配置或订阅链接之前,建议先浏览文件内容,确认其中不包含可疑的远程脚本调用或未知的服务器地址,防止配置被恶意篡改。
  3. 启用加密协议:优先选择支持 TLS 加密的代理协议(如 VMess+TLS、Trojan、Shadowsocks AEAD 等),避免使用明文传输的协议,确保数据在传输过程中受到充分保护。
  4. 定期更新客户端:及时升级到最新版本的 Clash 客户端和内核,新版本通常会修复已知的安全漏洞并强化防护能力,降低被攻击者利用的风险。
  5. 管理本地日志文件:Clash 默认将运行日志保存在本地,其中可能包含访问记录和配置信息。定期清理或禁用详细日志记录,防止敏感信息因设备丢失或共享而被泄露。
  6. 使用防火墙和规则加固:结合系统防火墙规则限制不必要的入站连接,在 Clash 规则中添加广告拦截和恶意域名屏蔽规则,构建多层次的网络安全防护体系,全面提升使用安全性。
Open Source · Cross-Platform · Secure

Clash — Cross-Platform Smart Proxy Client

Multi-protocol routing with intelligent traffic splitting for fast, secure network access. Rule-based fine-grained control makes proxying smarter and more efficient.

Why Choose Clash?

Clash is more than a proxy tool — it's a complete network traffic management solution, giving you full control over every byte of your data.

🔌

Multi-Protocol

Supports Shadowsocks(R), VMess, Trojan, Snell, SOCKS5, HTTP(S), Wireguard, and more.

🧠

Smart Routing

Rule-based splitting by domain, IP, and process name. JavaScript scripting support for advanced routing logic.

💻

Cross-Platform

Available on Windows, macOS, Linux, Android, iOS, and OpenWrt with a rich ecosystem of GUI clients.

🔒

Security & Privacy

Open-source and auditable. Local-only config and logs. TLS encryption prioritized for data protection.

Proxy Groups

Supports url-test, fallback, and load-balance strategy groups for optimal node selection and failover.

🌐

Fake-IP DNS

Unique Fake-IP DNS mechanism minimizes DNS poisoning while significantly improving network performance.

🔄

Remote Providers

Dynamically load remote proxy lists and rule sets. One-click subscription updates reduce manual maintenance.

📡

RESTful API

Full RESTful API for integration and automation, meeting the needs of advanced users and custom deployments.

Choose Your Platform

Clash has a rich cross-platform client ecosystem. Select the version that matches your device to get started.

🪟

Windows

Clash Verge Rev Download for Windows Clash for Windows
🍎

macOS

ClashX / Stash Download for macOS Stash (App Store)
🤖

Android

Clash for Android Download for Android
📱

iOS

Stash / Shadowrocket Stash (App Store) Shadowrocket
🐧

Linux / OpenWrt

CLI / OpenClash Linux AppImage OpenClash
⚠ Safety Notice: Please download Clash clients only from the trusted sources listed above. Avoid third-party sites to prevent security risks and bundled malware. Verify file integrity after downloading.

Three Steps to Get Started

Just three simple steps to install and configure Clash, and begin your smart proxy journey.

Step 1: Download & Install

Choose the Clash client version that matches your operating system from the download section above. Installation is quick and straightforward with minimal setup required.

Step 2: Import Configuration

After obtaining a subscription link or YAML config file, navigate to the "Profile" or "Config" section in the client, paste the link or upload the file to load nodes and rules automatically.

Step 3: Enable Proxy

Once the configuration is imported, click "Connect" or "Turn On" to activate the proxy. Visit a test website to verify that your traffic is being routed correctly through the proxy.

💡 Tip: Subscription links are usually provided by your service provider. YAML configs can be written manually or obtained from community templates.

Your Security, Our Commitment

Clash always puts user security and privacy first, building trustworthy network tools with an open-source spirit.

📖

Open Source

The project is released under the GPL-3.0 open-source license. Code is fully transparent and auditable by anyone, eliminating backdoor risks.

💾

Data Localization

All configuration files and logs are stored locally on your device by default. No data is automatically uploaded to remote servers, preventing credential leakage.

🛡️

Encrypted Transport

TLS and other encryption protocols are prioritized for data transmission, ensuring your network traffic is fully protected against man-in-the-middle attacks and eavesdropping.

Answers to Your Questions

Below are common questions about Clash, covering product introduction, installation, configuration, technical principles, and security & privacy.

Category 1: Product Introduction
What is Clash and how does it differ from a traditional VPN?

Clash is a rule-based open-source proxy tool that fundamentally differs from traditional VPNs. Here's a detailed breakdown:

  1. Working Principle: Traditional VPNs route all traffic through an encrypted tunnel to a remote server, while Clash selectively proxies only matched-rule traffic, leaving the rest direct for better efficiency.
  2. Traffic Splitting: Clash supports fine-grained routing by domain, IP address, and process name, enabling smart split-tunneling where domestic sites go direct and foreign sites go through proxy — something VPNs typically cannot do.
  3. Configuration Flexibility: Clash uses YAML config files, allowing users to customize proxy groups, rules, and node selection logic with far greater flexibility than a traditional VPN's fixed setup.
  4. Protocol Compatibility: Clash supports multiple proxy protocols including Shadowsocks, VMess, Trojan, and Snell, whereas traditional VPNs usually support only a single protocol like OpenVPN or WireGuard.
  5. Deployment Options: Clash can run as a client on personal devices or be deployed on gateways and routers for whole-home coverage, while VPNs typically require dedicated server-client pairing.
  6. Ecosystem Openness: Clash has an active open-source community and a rich selection of third-party GUI clients, giving users freedom of choice that commercial VPN ecosystems rarely offer.
Category 2: Installation
How do I install Clash on Windows, macOS, and Android?

Clash has a mature client ecosystem across all major platforms, with a simple and straightforward installation process. Follow these steps:

  1. Choose Your Client: Windows users should pick Clash Verge Rev or Clash for Windows; macOS users, ClashX or Stash; Android users, Clash for Android. Always download from official GitHub repositories or trusted app stores.
  2. Download the Installer: Visit the client's GitHub Releases page, select the latest stable version, and download the appropriate .exe, .dmg, or .apk file for your system architecture. Verify the file hash to ensure integrity.
  3. Complete Installation: On Windows, run the installer and follow the wizard. On macOS, drag the .app into the Applications folder. On Android, enable "Install unknown apps" and then install the APK file.
  4. First Launch: After installation, launch the client. It may show "No configuration" status initially — you'll need to import a subscription link or YAML config file to enable proxy functionality.
  5. Grant Permissions: macOS may require granting network extension permissions on first launch. Android requires VPN permission. Follow the system prompts to ensure proper proxy operation.
  6. Verify Installation: After importing a configuration and enabling the proxy, visit a test website to confirm your IP address has changed, verifying that the proxy is working correctly. Consult official docs or community resources if issues arise.
Category 3: Configuration Import
How do I import a subscription link and YAML configuration file?

Importing configuration is a critical step in using Clash, supporting both subscription links and local YAML files. Here's how:

  1. Obtain Configuration Source: Subscription links are typically provided by your service provider as a URL starting with http(s)://. YAML files can be obtained from community templates or written manually, containing proxy node info and rule definitions.
  2. Open Configuration Interface: After launching the Clash client, find the "Profiles" or "Config" tab. Entry points vary slightly between clients but functionality is similar, usually located in the sidebar or top menu.
  3. Import Subscription Link: Click "Add Subscription" or "Import from URL," paste the subscription link into the input field, set an auto-update interval (recommended: 24 hours), and save. The client will automatically fetch remote nodes and rule configurations.
  4. Import Local File: Select "Import Local Config" or "Load from File," browse your file system to find the .yaml or .yml configuration file, and confirm the import. The client will parse the file and load all nodes and rules.
  5. Activate Configuration: After importing, select the configuration from the list and click "Activate" or "Switch" to make it effective. The client will display the current active configuration name and node count.
  6. Verify Correctness: After activation, check that the node list displays correctly and rules match as expected. If errors appear, check YAML syntax or subscription link validity, and contact your service provider if needed.
Category 4: Usage Tips
How do I use proxy groups and smart routing features?

Proxy groups are one of Clash's core features, working with smart routing to deliver the best network access experience. Here's how to use them:

  1. Understand Group Types: url-test automatically tests latency and selects the lowest-latency node; fallback switches to a backup node when the primary fails; load-balance distributes traffic across multiple nodes. Each type suits different use cases.
  2. View Default Groups: After opening the client, navigate to the "Proxies" page to see all proxy groups. Common presets include "Auto Select," "Global Direct," and "Ad Block," each containing several available nodes.
  3. Manually Switch Nodes: Expand a proxy group to see its node list, then manually select a node to route traffic through it. This is useful for temporarily changing regions or testing specific node speeds with flexibility and ease.
  4. Configure Routing Rules: In the rules section of your YAML config, define domain matching rules — for example, set .cn domains to DIRECT and .google.com to Proxy — achieving fine-grained traffic routing control.
  5. Use Rule Sets: Reference remote rule sets via rule-providers, such as GeoIP databases or community-maintained domain lists. These auto-update without manual config edits, significantly reducing maintenance effort.
  6. Optimize Group Settings: Adjust url-test interval and tolerance parameters based on your actual network environment. Set appropriate fallback test URLs to ensure the best balance between latency, availability, and load across your proxy groups.
Category 5: Technical Principles
How does Clash's Fake-IP DNS and transparent proxy work?

Fake-IP DNS and transparent proxy are two core technologies in Clash that work together to enhance performance and prevent DNS poisoning. Here's how:

  1. Fake-IP Mechanism Overview: When an application initiates a DNS query, Clash does not return the real IP address. Instead, it returns a virtual Fake IP from the 198.18.x.x range, while recording the real domain-to-Fake-IP mapping in memory for subsequent routing.
  2. DNS Poisoning Protection: Because DNS queries travel through the proxy channel rather than the local network, the Fake-IP mechanism effectively circumvents DNS poisoning and hijacking that local DNS servers may suffer from, ensuring accurate domain resolution.
  3. Performance Optimization: In Fake-IP mode, DNS resolution and proxy connection establishment can proceed in parallel, eliminating the serial "resolve-then-connect" wait time of traditional modes and significantly reducing time-to-first-byte for faster page loads.
  4. Transparent Proxy Concept: Transparent proxy allows Clash to intercept all device network traffic without user awareness, redirecting TCP/UDP flows to Clash for processing by automatically modifying system routing tables or using TProxy technology.
  5. Redirect TCP Mode: On Linux systems, iptables or nftables rules redirect outbound TCP connections to Clash's listening port. Clash then decides whether to route directly or through proxy based on rules, enabling device-level transparent routing.
  6. TProxy UDP Support: For UDP traffic such as DNS queries and QUIC protocol, TProxy technology preserves the original destination address, allowing Clash to correctly route UDP packets. Combined with Fake-IP, this delivers a complete transparent proxy solution.
Category 6: Security & Privacy
How do I ensure network security and privacy protection when using Clash?

Network security and privacy protection are core concerns when using proxy tools. Clash provides multiple mechanisms to safeguard your data. Follow these steps:

  1. Download from Trusted Sources: Only obtain Clash clients from official GitHub repositories or verified app stores. Avoid using modified or cracked versions from unknown sources, as these may contain malicious code or backdoors.
  2. Review Configuration Files: Before importing any YAML config or subscription link, browse the file contents to confirm there are no suspicious remote script calls or unknown server addresses, preventing malicious configuration tampering.
  3. Enable Encrypted Protocols: Prioritize proxy protocols that support TLS encryption such as VMess+TLS, Trojan, and Shadowsocks AEAD. Avoid plaintext protocols to ensure data is fully protected during transmission.
  4. Keep Clients Updated: Regularly upgrade to the latest versions of Clash clients and kernels. New releases typically fix known security vulnerabilities and strengthen protection capabilities, reducing exploitation risks.
  5. Manage Local Log Files: Clash stores runtime logs locally by default, which may contain access records and configuration details. Regularly clear or disable verbose logging to prevent sensitive information exposure if your device is lost or shared.
  6. Layer Security with Firewall Rules: Combine system firewall rules to restrict unnecessary inbound connections. Add ad-blocking and malicious domain blocking rules within Clash to build a multi-layered network security defense system for comprehensive protection.