xsub
Convert Xray share links and subscriptions to JSON configs
xsub is a small CLI tool that converts Xray share links and subscription URLs into JSON configurations.
Built around libXray, it supports any protocol supported by Xray (vless://, trojan://... you name it), as well as subscription URLs containing multiple configs.
Features
- Convert Xray share links to JSON config
- Fetch subscription data from HTTP(S) URLs
- Automatically decode base64 HTTP responses
- Display and select available configs from a subscription
- Show protocol/transport/security references for subscription entries
Installation
go install codeberg.org/mdhr/xsub@latest
Build from source
Clone the repository and build it with Go >= 1.26.2:
git clone https://codeberg.org/mdhr/xsub
cd xsub
go build
# optional: install the binary into GOPATH/bin
go install
Usage
xsub [vless:// or trojan:// or http(s):// url]
By default, xsub writes the generated config to config.json, but you can change the path using -o flag
Convert a direct share link
xsub 'vless://xxxxxxxx-xxxx...'
Convert a subscription
xsub 'https://example.com/subscription'
If the subscription contains multiple configs, you will be prompted to choose which one to export:
1) Example config 1 (vless/tcp/tls)
2) Example config 2 (trojan/ws/tls)
select config:
Persistent URLs
If no link is provided as an argument, xsub tries to read the subscription URL from one of these files:
./url.txt
<config-dir>/xsub/url.txt
The local ./url.txt file has priority over the user-level config file.
Output
xsub outputs cleaned and formatted Xray JSON configuration file. Empty and nil fields are removed where possible to keep the config compact and readable.
Options
-o <file> Place the output into <file>
-nr Do not print protocol/transport/security reference for each config.
License
This project is free software. See LICENSE for details.