███████╗██╗ ██╗██████╗ ██╗ ██╗██████╗ █████╗ ██╗ ██╗ ██╔════╝██║ ██║██╔══██╗╚██╗██╔╝██╔══██╗██╔══██╗╚██╗ ██╔╝ ███████╗██║ ██║██████╔╝ ╚███╔╝ ██████╔╝███████║ ╚████╔╝ ╚════██║██║ ██║██╔══██╗ ██╔██╗ ██╔══██╗██╔══██║ ╚██╔╝ ███████║╚██████╔╝██████╔╝██╔╝ ██╗██║ ██║██║ ██║ ██║ ╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝
A simple, powerful command-line tool to fetch proxy configurations from subscription links and convert them into individual JSON files for Xray-core.
This project was born out of the frustration of manually converting proxy share links (like those for VLESS, VMess, Trojan, etc.) into the JSON format required by command-line clients and servers. I got tired of the tedious copy-pasting, and figured others were too.
This tool automates the entire process. It takes a subscription URL, fetches all the share links, intelligently parses each one, and saves it as a properly formatted outbound JSON configuration file. It's designed to be a universal tool that supports a wide variety of protocols and transport settings, including REALITY.
This repository provides more than just a parser; it offers a complete setup for a high-performance, resilient connection. The JSON files generated by this tool are outbound configurations only. They are designed to be used with the main configuration files provided here.
This modular approach means you can generate dozens of outbound configs and the main config will load them all automatically.
The main config is split into two parts to keep things organized:
common.json: This file contains all the common boilerplate stuff—inbounds, basic DNS settings, etc.leastPing.json(The Magic Part): This file contains the advanced routing logic. It uses Xray's Observatory and Routing Balancer to automatically test all your servers and route your traffic through the one with the lowest latency. If the fastest server goes down, it seamlessly switches to the next fastest one. Because waiting for pages to load is almost as bad as waiting for a certain regime to fall.
To create your final config.json, you will combine the contents of these two files.
You have two options: use the pre-compiled executable for simplicity, or run the script directly with Python for more flexibility.
This is the easiest way. No need to install Python or any dependencies.
-
Go to the Releases page of this repository.
-
Download the executable (
subxray). -
Download the
common.jsonandleastPing.jsonfiles as well. -
Open your terminal, navigate to where you downloaded the files, and run the parser tool:
Basic Usage:
./subxray-linux "YOUR_SUBSCRIPTION_URL"To omit the first link (often a usage stats link):
./subxray-macos --omit-first "YOUR_SUBSCRIPTION_URL" -
Start Xray with the command
xray run -confdir .. It will automatically load all your servers at the same time!
- Make sure you have Python 3.6+ installed.
- Clone this repository:
git clone https://github.com/saniyar-dev/subxray.git cd subxray - Install the required dependency:
pip install -r requirements.txt
- Follow steps 4 and 5 from Option 1, but run the script using
python:python main.py "YOUR_SUBSCRIPTION_URL"
This tool is useful for anyone who:
- Runs Xray-core on a server or router and needs to quickly add new configurations.
- Wants a resilient connection that automatically uses the fastest server.
- Uses command-line clients that require JSON configuration files.
- Wants to automate the process of updating a large number of proxy configurations.
- Needs to inspect or debug the underlying parameters of a share link.
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project: Click the 'Fork' button at the top right of this page.
- Create your Feature Branch:
git checkout -b feature/AmazingFeature
- Commit your Changes:
git commit -m 'Add some AmazingFeature' - Push to the Branch:
git push origin feature/AmazingFeature
- Open a Pull Request: Go back to the original repository on GitHub and click the 'New pull request' button.
You can also open an issue to report a bug or suggest a new feature.
This tool is built on the principle of open access to information. We stand in solidarity with the people of Iran and everyone around the world fighting for digital freedom.
To a free and unfiltered internet for all. #FreeInternetForIran