δΈζζζ‘£ | English
Clash Subscription Configuration Manager - Add Preferred IPs and Custom Configurations to Your Clash Subscription
- What is This?
- Why Do You Need It?
- How It Works
- Core Features
- Quick Start
- Usage Guide
- Configuration Description
- Configuration System
- Performance Characteristics
- Security Features
- Documentation
- Contributing
- Support the Project
- License
ClashSubManager is a subscription proxy service that sits between your Clash client and the original subscription service, automatically processing and optimizing your subscription configuration.
Simply put:
Original Subscription β ClashSubManager Processing β Optimized Subscription β Clash Client
- Preferred IP Replacement: Your subscription has domain-based nodes like
cdn.example.com, but you want to use speed-tested preferred IPs (like104.29.125.182) to improve connection speed - Batch Node Generation: Automatically expand one domain node into multiple preferred IP nodes without manual configuration editing
- Personalized Configuration: Add your own rules, proxy groups, and other configurations without modifying the original subscription
- Unified Management: Manage preferred IP lists and Clash templates through a web interface without manual YAML editing
- You have an airport subscription but want to use Cloudflare preferred IPs for acceleration
- You want to use different preferred IP configurations for different devices
- You want to add your own rules and proxy groups on top of the subscription
- You want to centrally manage subscription configurations for multiple users
1. Clash client requests subscription
β
2. ClashSubManager fetches original subscription
β
3. Reads preferred IP list (cloudflare-ip.csv)
β
4. Reads Clash template configuration (clash.yaml)
β
5. Processes subscription:
- Expands domain nodes into multiple preferred IP nodes
- Merges template configuration (rules, proxy groups, etc.)
β
6. Returns processed configuration to Clash client
Original subscription node:
proxies:
- name: "US-Node"
type: vmess
server: cdn.example.com
port: 443Preferred IP list (cloudflare-ip.csv):
IP Address,Average Latency
104.29.125.182,152.45ms
104.26.0.188,158.10ms
104.20.20.191,161.38msProcessed nodes:
proxies:
- name: "US-Node"
type: vmess
server: cdn.example.com
port: 443
- name: "US-Node [104.29.125.182]"
type: vmess
server: 104.29.125.182
port: 443
- name: "US-Node [104.26.0.188]"
type: vmess
server: 104.26.0.188
port: 443
- name: "US-Node [104.20.20.191]"
type: vmess
server: 104.20.20.191
port: 443One node automatically becomes 4 nodes (original domain + 3 preferred IPs), and you can select the one with the lowest latency in Clash.
- Unified Subscription Entry: Provides standardized subscription interface through
/sub/[user_id] - Automatic Preferred IP Expansion: Automatically expands domain proxy nodes into multiple preferred IP address nodes
- Dynamic Configuration Merging: Intelligently merges original subscription with custom templates (rules, proxy groups, etc.)
- Multi-User Support: Each user can have independent preferred IP lists and Clash templates
- Web Management Interface: Visual management of preferred IPs, Clash templates, and user lists
- Internationalization Support: Full English and Chinese interface support
- Lightweight Architecture: Single application with minimal resource usage (< 50MB memory)
- .NET 10 - Main development framework
- ASP.NET Core Razor Pages - Web development mode
- Bootstrap - Frontend UI framework
- Docker - Containerized deployment
- Docker (recommended) or .NET 10 runtime
- A valid Clash subscription URL
Minimal Configuration:
docker run -d \
-p 8080:80 \
-e AdminUsername=admin \
-e AdminPassword=your_password \
-e CookieSecretKey=your_32_character_minimum_secret_key_here \
-e SUBSCRIPTION_URL_TEMPLATE=https://your-airport.com/sub/{userId} \
-v $(pwd)/data:/app/data \
--name clash-sub-manager \
clashsubmanager:latestParameter Explanation:
AdminUsername: Administrator username (customize)AdminPassword: Administrator password (customize)CookieSecretKey: Cookie encryption key (at least 32 characters, randomly generated)SUBSCRIPTION_URL_TEMPLATE: Your original subscription URL template,{userId}will be replaced with actual user ID
Full Configuration Example:
docker run -d \
-p 8080:80 \
-e AdminUsername=admin \
-e AdminPassword=MySecurePassword123 \
-e CookieSecretKey=abcdef1234567890abcdef1234567890 \
-e SUBSCRIPTION_URL_TEMPLATE=https://api.example.com/sub/{userId} \
-e SessionTimeoutMinutes=30 \
-e DataPath=/app/data \
-v $(pwd)/data:/app/data \
--name clash-sub-manager \
--restart unless-stopped \
clashsubmanager:latest# Windows
./ClashSubManager.exe
# Linux/macOS
./ClashSubManager
# Custom data path
./ClashSubManager --DataPath /custom/data/pathClashSubManager/
βββ server/ # Server application
βββ doc/ # Project documentation
βββ data/ # Data directory (created at runtime)
β βββ cloudflare-ip.csv # Default preferred IP list
β βββ clash.yaml # Default Clash template
β βββ users.txt # User access records
β βββ [userId]/ # User-specific configurations
βββ README.md # Project description
After starting the service according to the "Quick Start" section, visit:
http://localhost:8080
Access the admin interface:
http://localhost:8080/admin
Login with your configured admin credentials.
In the admin interface:
- Click "Default Preferred IP Management"
- Upload or edit your preferred IP list (CSV format)
- CSV format example:
IP Address,Sent,Received,Packet Loss Rate,Average Latency,Download Speed
104.29.125.182,4,4,0.00%,152.45ms,0.00
104.26.0.188,4,4,0.00%,158.10ms,0.00In the admin interface:
- Click "Default Clash Template Management"
- Edit your Clash configuration template
- You can add custom rules, proxy groups, etc.
Change your Clash client's subscription URL to:
http://your-server:8080/sub/your_user_id
For example:
http://localhost:8080/sub/user123
If you want to set independent preferred IPs or templates for a specific user:
- Find the user in the "User List" in the admin interface
- Click "Manage" to enter user-specific configuration
- Upload the user's preferred IP list or Clash template
- The user's subscription will prioritize user-specific configuration, falling back to default if not available
GET /sub/{id}- Get user Clash subscription configurationPOST /sub/{id}- Update user preferred IP configurationDELETE /sub/{id}- Delete user preferred IP configuration
/app/data/
βββ cloudflare-ip.csv # Default preferred IP list
βββ clash.yaml # Default Clash template
βββ users.txt # User access records (auto-generated)
βββ [userId]/ # User-specific configuration directory
βββ cloudflare-ip.csv # User-specific preferred IPs
βββ clash.yaml # User-specific template
| Variable | Description | Default | Example |
|---|---|---|---|
AdminUsername |
Administrator username | Required | admin |
AdminPassword |
Administrator password | Required | MyPassword123 |
CookieSecretKey |
Cookie encryption key | Required (β₯32 chars) | abcdef1234567890abcdef1234567890 |
SUBSCRIPTION_URL_TEMPLATE |
Original subscription URL template | Required | https://api.example.com/sub/{userId} |
SessionTimeoutMinutes |
Session timeout (minutes) | 60 | 30 |
DataPath |
Data directory path | Docker: /app/dataStandalone: ./data |
/custom/path |
LOG_LEVEL |
Log level | Information |
Debug |
Notes:
SUBSCRIPTION_URL_TEMPLATEmust contain{userId}placeholderCookieSecretKeyrequires at least 32 characters, recommend using random string
ClashSubManager supports flexible cross-platform configuration management with multiple configuration methods:
- Command Line Arguments - Highest priority
- Environment Variables - Second priority
- User Configuration File -
appsettings.User.json - Environment Type Configuration -
appsettings.{EnvironmentType}.json(e.g. Docker/Standalone) - Default Configuration File -
appsettings.json - Code Default Values - Lowest priority
- Docker Environment: Automatically detects container environment, uses
/app/dataas default data path - Standalone Mode: Windows/Linux/macOS direct execution, uses
./datapath in program directory - Development/Production Environment: Automatically recognizes based on
ASPNETCORE_ENVIRONMENTvariable
docker run -d \
-e AdminUsername=admin \
-e AdminPassword=your_password \
-e CookieSecretKey=your_32_character_minimum_key \
-e SUBSCRIPTION_URL_TEMPLATE=https://api.example.com/sub/{userId} \
-e SessionTimeoutMinutes=30 \
-p 8080:80 \
clash-sub-managerCreate appsettings.User.json in program directory:
{
"AdminUsername": "admin",
"AdminPassword": "your_password",
"CookieSecretKey": "your_32_character_minimum_key",
"SessionTimeoutMinutes": 30,
"DataPath": "/custom/data/path",
"SubscriptionUrlTemplate": "https://api.example.com/sub/{userId}"
}./ClashSubManager \
--AdminUsername admin \
--AdminPassword your_password \
--DataPath /custom/data/pathThe system automatically validates the following required configurations on startup:
AdminUsername- Administrator username (required)AdminPassword- Administrator password (required)CookieSecretKey- Cookie secret key (required, minimum 32 characters)SessionTimeoutMinutes- Session timeout (5-1440 minutes)DataPath- Data path (must be creatable/writable)
The UI language is determined by the .AspNetCore.Culture cookie (set via the built-in language switcher), with fallback to en-US.
- Response Time: < 100ms
- Concurrent Processing: 10-50 requests/second
- Memory Usage: < 50MB
- File Limits: CSV max 10MB, YAML max 1MB
- Cookie security settings (HttpOnly, Secure, SameSite=Strict)
- Session timeout mechanism
- Request rate limiting (10 requests per IP per second)
- Strict data format validation
- Docker containerized deployment
Issues and Pull Requests are welcome to improve the project.
If this project has been helpful to you, consider supporting its development:
See DONATE.md for cryptocurrency donation addresses.
This project is licensed under the GPL-3.0 License. Copyright (c) 2026 Soren S.