Web Analytics

clash

⭐ 152 stars English by colin1114

🌐 Language

CDN acceleration and security protection for this project are sponsored by Tencent EdgeOne.

image

The author of this project is colin1114.

🚀 Clash Subscription Converter

A beautiful and powerful online tool for converting various proxy subscription links to Clash configuration format. Supports automatic deployment via Cloudflare Workers & Pages, providing fast and reliable subscription conversion services.

✨ Features

📁 Project Structure

clash/
├── index.html              # 前端页面
├── worker.js               # Cloudflare Worker 后端代码
├── wrangler.jsonc          # Wrangler 配置文件
├── _headers                # Cloudflare Pages HTTP头配置
├── .github/
│   └── workflows/
│       └── deploy.yml      # GitHub Actions 部署配置
├── README.md              # 项目说明文档
└── package.json           # 项目配置文件

🚀 Quick Start

Method 1: Run Locally

   git clone 
   cd clash
   ``

  • Start the local server
`bash # 使用 Python python -m http.server 8000 # 或使用 Node.js npx serve . `

  • Access the Application
  • Open your browser and visit http://localhost:8000
  • The sample configuration will be displayed in the local environment

Method 2: Deploy with Cloudflare Workers

#### Step 1: Create a Worker

  • Visit Cloudflare Workers
  • Register/Login to your Cloudflare account
  • Click "Create a Worker"
  • Copy the entire code from worker.js into the editor
  • Click "Save and Deploy"
#### Step 2: Deploy using Wrangler CLI
bash

安装 Wrangler CLI

npm install -g wrangler

登录到 Cloudflare

wrangler login

部署 Worker

npm run deploy:worker

#### Step 3: Configure Domain Name (Optional)

  • Add a custom domain name in Worker settings
  • Or use the default domain provided by Cloudflare

Method 3: Deploy with Cloudflare Pages

#### Option A: GitHub Integration (Recommended)

  • Prepare Repository
  • Push the code to your GitHub repository
  • Ensure all necessary files are included
  • Create Pages Project
  • Visit Cloudflare Pages
  • Connect your GitHub repository
  • Select the project repository
  • Build Settings
  • Build command: leave blank or echo "No build required"
  • Build output directory: / (root directory)
  • Environment variables: no need to set
#### Option B: Direct Upload
bash

使用 Wrangler Pages 部署

npm run deploy:pages

🛠️ Technical Architecture

Frontend Tech Stack

  • HTML5 - Modern markup language
  • CSS3 - Responsive design and animation effects
  • Vanilla JavaScript - Lightweight frontend interactions

Backend Tech Stack

  • Cloudflare Workers - Edge computing platform
  • Web APIs - Standard Fetch API and response handling

Supported Protocol Formats

  • VMess - V2Ray standard protocol
  • VLESS - V2Ray lightweight protocol (supports Reality)
  • Shadowsocks - Classic proxy protocol
  • Trojan - Emerging proxy protocol

API Endpoints

  • GET / - Main page
  • POST /convert - Subscription conversion API
  • GET /clash/{config-id} - Retrieve YAML configuration file (subscription link)
  • GET /yaml/{config-id} - Download YAML configuration file
  • OPTIONS /* - CORS preflight request

📖 User Guide

Basic Usage

  • Enter Subscription Link
  • Paste your proxy subscription link into the input box
  • Supports Base64-encoded subscription links
  • Set Configuration Name
  • Optionally set a custom name for your configuration file
  • Defaults to "My Clash Config"
  • Convert Configuration
  • Click the "Convert Subscription" button
  • Wait for the conversion to complete
  • Using Configuration
  • Copy the generated YAML configuration
  • Import it into the Clash client for use
  • Using Subscription Link (Recommended)
  • Copy the generated subscription link
  • Add the subscription in the Clash client
  • The configuration will automatically sync, no manual update needed

Advanced Configuration

The generated Clash configuration includes the following features:

  • Proxy Group Policies
  • 🚀 Node Selection - Manually select proxy
  • ♻️ Auto Selection - Delay test auto selection
  • 🎯 Global Direct - Direct connection
  • DNS Configuration
  • Enable DNS resolution
  • Supports fake-ip mode
  • Domestic and overseas DNS split
  • Routing Rules
  • Local addresses direct connection
  • Domestic IP direct connection
  • Other traffic via proxy

🔧 Deployment Troubleshooting

Common Issues

#### 1. Wrangler Cannot Find Entry Point Error Message: Missing entry-point to Worker script

Solution:

  • Make sure there is a wrangler.jsonc file in the project root directory
  • Check that the main field in wrangler.jsonc points to worker.js
#### 2. GitHub Actions Deployment Failed Solution:
  • Add the following Secrets in your GitHub repository settings:
  • CLOUDFLARE_API_TOKEN: Cloudflare API token
  • CLOUDFLARE_ACCOUNT_ID: Cloudflare account ID
#### 3. Pages Build Failed Solution:
  • Set the build command to empty or echo "No build required"
  • Make sure the build output directory is set to /

Deployment Configuration File Description

  • wrangler.jsonc: Wrangler CLI configuration for Worker deployment
  • _headers: Cloudflare Pages HTTP header configuration
  • .github/workflows/deploy.yml: GitHub Actions automatic deployment configuration

🔧 Custom Configuration

Modify Proxy Groups

You can edit the convertToClash function in worker.js to customize proxy groups:

javascript 'proxy-groups': [ { name: '🚀 节点选择', type: 'select', proxies: ['♻️ 自动选择', '🎯 全球直连', ...proxyNames] }, // 添加更多代理组... ]

Custom Routing Rules

Modify the rules array to add custom routing rules:

javascript rules: [ 'DOMAIN-SUFFIX,youtube.com,🚀 节点选择', 'DOMAIN-SUFFIX,local,DIRECT', // 添加更多规则... ]
`

📊 Performance Features

  • Global CDN - Cloudflare covers global edge nodes
  • Fast Response - Average response time < 100ms
  • High Availability - 99.9% service uptime
  • Free Quota - 100,000 requests per day

🔒 Security Instructions

  • Data Privacy - Subscription data is only used during conversion and is not stored
  • HTTPS Encryption - All communication is encrypted via HTTPS
  • Open Source Transparency - Full source code is public and can be independently audited

🤝 Contribution Guide

Issues and Pull Requests are welcome!

📝 Changelog

v1.1.0

v1.0.0

📞 Support and Feedback

If you encounter any problems or have suggestions during use, please:

📄 License

This project uses the MIT License - see the LICENSE file for details

🙏 Acknowledgements

---

⭐ If this project is helpful to you, please give it a Star!

--- Tranlated By Open Ai Tx | Last indexed: 2025-09-06 ---