Clash Subscription Conversion#
As shown in the image above, this is a Sub-Web web interface. You can input your airport subscription or Vmess/ss, etc., here, and then generate a Clash connection with diversion rules that can be imported with one click.
Overall Deployment Logic#
- Backend: Subconverter is responsible for rendering diversion rules
- Frontend: Sub-web is responsible for handling the page
- Short link: The original link is very long and needs to be used in the form of a short link for convenience
Setting Up the Backend Subconverter#
- Docker Deployment
Project address: https://github.com/tindy2013/subconverter
Docker official guide: https://github.com/tindy2013/subconverter/blob/master/README-docker.md
#docker deployment
docker run -d --name subcon --restart=always -p 25500:25500 tindy2013/subconverter:latest
- Reverse Proxy Service
Generally, you can use Baota or NMP to handle the reverse proxy normally. If using Nginx Manager Proxy, add the domain suc.surgee.me
Note: Handling Docker's IP
There is one thing to note here; if not handled, the reverse proxy address cannot use 127.0.0.1 (it does not point to the host), and using the Docker IP address also does not work. If you want to be lazy, you can point to the server's real IP. If you want to point to the container's IP, then it needs to be handled separately because the nginx manager proxy is on a custom network (although it is also a bridge), but it is not on the same subnet. The solution is simple: add NPM to the bridge network
.
# Add NMP to the bridge network
docker network connect bridge nginx-proxy-app-1
Then use docker inspect subcon
to check the container's IP, which is 172.17.0.5
.
After that, directly accessing it shows File not found. which is okay.
Setting Up the Frontend Subweb#
Project address: https://github.com/CareyWang/sub-web
- Configure the Frontend
If using Docker to set up, you need to configure the frontend and then rebuild the image.
# Clone the project to local
git clone https://github.com/CareyWang/sub-web.git
cd sub-web
# Edit the .env configuration file
vi .env
# Modify the backend address and short link address
# API Backend
VUE_APP_SUBCONVERTER_DEFAULT_BACKEND = "https://suc.surgee.me"
# Short link backend
VUE_APP_MYURLS_DEFAULT_BACKEND = "https://i.surgee.me"
# Text hosting backend
VUE_APP_CONFIG_UPLOAD_BACKEND = "https://suc.surgee.me"
# Edit.
cd src/views vi Subconverter.vue
# Line 39
placeholder="https://suc.surgee.me/sub?"
# Line 300
backendOptions: [{ value: "https://suc.surgee.me/sub?" }],
- Add Remote Service Configuration
{
label: "Steve",
options: [
{
label: "StevePro",
value:
"https://raw.githubusercontent.com/zxfccmm4/Surge/main/Clash/rules.ini"
},
{
label: "SteveProMax",
value:
"https://raw.githubusercontent.com/zxfccmm4/Surge/main/Clash/rules1.ini"
}
]
},
{
label: "ACL4SSR",
options: [
{
label: "ACL4SSR_Online Default version with comprehensive grouping (synchronized with Github)",
value:
"https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online.ini"
},
{
label: "ACL4SSR_Online_AdblockPlus More ad removal (synchronized with Github)",
value:
"https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_AdblockPlus.ini"
},
{
label: "ACL4SSR_Online_NoAuto No automatic speed test (synchronized with Github)",
value:
"https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_NoAuto.ini"
},
{
label: "ACL4SSR_Online_NoReject No ad blocking rules (synchronized with Github)",
value:
"https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_NoReject.ini"
},
{
label: "ACL4SSR_Online_Mini Simplified version (synchronized with Github)",
value:
"https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Mini.ini"
},
{
label: "ACL4SSR_Online_Mini_AdblockPlus.ini Simplified version with more ad removal (synchronized with Github)",
value:
"https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Mini_AdblockPlus.ini"
},
{
label: "ACL4SSR_Online_Mini_NoAuto.ini Simplified version without automatic speed test (synchronized with Github)",
value:
"https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Mini_NoAuto.ini"
},
{
label: "ACL4SSR_Online_Mini_Fallback.ini Simplified version with failover (synchronized with Github)",
value:
"https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Mini_Fallback.ini"
},
{
label: "ACL4SSR_Online_Mini_MultiMode.ini Simplified version with automatic speed test, failover, load balancing (synchronized with Github)",
value:
"https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Mini_MultiMode.ini"
},
{
label: "ACL4SSR_Online_Full Full grouping for heavy users (synchronized with Github)",
value:
"https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Full.ini"
},
{
label: "ACL4SSR_Online_Full_NoAuto.ini Full grouping without automatic speed test for heavy users (synchronized with Github)",
value:
"https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Full_NoAuto.ini"
},
{
label: "ACL4SSR_Online_Full_AdblockPlus Full grouping for heavy users with more ad removal (synchronized with Github)",
value:
"https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Full_AdblockPlus.ini"
},
{
label: "ACL4SSR_Online_Full_Netflix Full grouping for heavy users with complete Netflix (synchronized with Github)",
value:
"https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Full_Netflix.ini"
},
{
label: "ACL4SSR Local Default version with comprehensive grouping",
value: "config/ACL4SSR.ini"
},
{
label: "ACL4SSR_Mini Local Simplified version",
value: "config/ACL4SSR_Mini.ini"
},
{
label: "ACL4SSR_Mini_NoAuto.ini Local Simplified version + no automatic speed test",
value: "config/ACL4SSR_Mini_NoAuto.ini"
},
{
label: "ACL4SSR_Mini_Fallback.ini Local Simplified version + fallback",
value: "config/ACL4SSR_Mini_Fallback.ini"
},
{
label: "ACL4SSR_BackCN Local Return to China",
value: "config/ACL4SSR_BackCN.ini"
},
{
label: "ACL4SSR_NoApple Local No Apple diversion",
value: "config/ACL4SSR_NoApple.ini"
},
{
label: "ACL4SSR_NoAuto Local No automatic speed test ",
value: "config/ACL4SSR_NoAuto.ini"
},
{
label: "ACL4SSR_NoAuto_NoApple Local No automatic speed test & no Apple diversion",
value: "config/ACL4SSR_NoAuto_NoApple.ini"
},
{
label: "ACL4SSR_NoMicrosoft Local No Microsoft diversion",
value: "config/ACL4SSR_NoMicrosoft.ini"
},
{
label: "ACL4SSR_WithGFW Local GFW list",
value: "config/ACL4SSR_WithGFW.ini"
}
]
},
{
label: "Tutu's Rules",
options: [
{
label: "Full grouping version",
value:
"https://raw.githubusercontent.com/bunizao/TutuBetterRules/tutu/Clash/rules.ini"
},
{
label: "Remove Apple strategy group (removed some rules about Apple, suitable for Windows and Android users)",
value:
"https://raw.githubusercontent.com/bunizao/TutuBetterRules/tutu/Clash/rules2.ini"
}
]
},
Of course, there are also other big players' diversion rule libraries.
ACL4SSR's Library: https://github.com/ACL4SSR/ACL4SSR/tree/master/Clash
blackmatrix7's Library: https://github.com/blackmatrix7/ios_rule_script/tree/master/rule/Clash
Divine Engine Rule Library: https://github.com/DivineEngine/Profiles/tree/master/Clash/RuleSet
- Build Image & Deploy Service
# Build image
docker build -t subweb-local:latest .
# Deploy service
docker run -d -p 58080:80 --restart always --name subweb subweb-local:latest
Setting Up Short Domain Myurls#
Project address: https://github.com/CareyWang/MyUrls
- Deploy Service
# Deploy Redis, as Redis is needed. If using docker-compose, it will deploy Redis automatically; I installed it directly using apt update.
apt update
apt install redis-server -y
Then test with redis-cli
# Clone the project to local
git clone https://github.com/CareyWang/MyUrls.git MyUrls
cd MyUrls
vi public/index.html
# Modify the short link domain
const backend = 'https://i.surgee.me'
# Deploy service
docker run -d --restart always --net=host --name myurls -v /root/MyUrls/public:/app/public careywong/myurls:latest -domain i.surgee.me -port 8002 -conn 127.0.0.1:6379 -ttl 180
Where the domain and port should be modified according to the actual situation, --net=host is to connect to the host Redis, and the most critical part is -v /root/MyUrls/public:/app/public to map the modified index.html directory to the container.
Conclusion#
In the end, I successfully set up Clash Subscription Conversion
https://sub.surgee.me
Thanks to the following big players for their tutorials, which have been very helpful.
https://github.com/stilleshan/dockerfiles/tree/main/sub
https://imgki.com/archives/718.html?replyTo=443
https://github.com/tindy2013/subconverter
https://github.com/CareyWang/sub-web
https://github.com/bunizao/TutuBetterRules
https://github.com/ACL4SSR/ACL4SSR/tree/master/Clash
https://github.com/blackmatrix7/ios_rule_script/tree/master/rule/Clash
https://github.com/DivineEngine/Profiles/tree/master/Clash/RuleSet