1 unstable release
new 0.1.0 | Mar 24, 2025 |
---|
#173 in Configuration
90 downloads per month
1.5MB
33K
SLoC
subconverter-rs
A more powerful utility to convert between proxy subscription format, the original codes are transformed from the cpp version subconverter by Cursor!
Transform. Optimize. Simplify. A blazingly fast proxy subscription converter rewritten in Rust.
⚠️ WORK IN PROGRESS ⚠️ - This project is currently under active development. Features may be incomplete or subject to change.
subconverter-rs takes the power of the original subconverter project and reimplements it in Rust, bringing memory safety, concurrency without data races, and significantly improved performance.
Why Rust?
- Performance: Experience comparable or better performance than C++ with Rust's zero-cost abstractions
- Memory Safety: Eliminate segmentation faults and buffer overflows without sacrificing performance
- Concurrency: Safe concurrent processing for handling multiple subscriptions simultaneously
- Modern Tooling: Benefit from Cargo's dependency management, testing framework, and documentation generation
- Cross-Platform: Easily compile for various platforms with minimal configuration
- Maintainability: More readable, modular code that's easier to extend and contribute to
Why ?
The subconverter is not easy to use and can be really hard to contribute, more than half of PRs are aborted.
However, the subconverter is almost the only one tool that could provide compatibility about a bunch of proxy tools.
Supported Features
- Converting between various proxy subscription formats
- Filtering nodes based on remarks and rules
- Adding emojis to node remarks
- Renaming nodes based on custom rules
- Preprocessing nodes with custom rules
- Parsing local configuration files
- Command line interface
Supported Proxy Types
- VMess
- Shadowsocks
- ShadowsocksR
- Trojan
- HTTP/HTTPS
- SOCKS
- Hysteria/Hysteria2
- WireGuard
- Snell
Supported Output Formats
- Clash
- Surge
- Quantumult
- Quantumult X
- Loon
- ShadowsocksD (SSD)
- Mellow
- SingBox
Installation
From Source
git clone https://github.com/yourusername/subconverter-rs.git
cd subconverter-rs
cargo build --release
The binary will be available at target/release/subconverter-rs
.
From Cargo
cargo install subconverter-rs
Usage
Command Line
subconverter-rs [options]
Library
You can use subconverter-rs as a library in your Rust projects:
use subconverter_rs::generator::config::proxy::Proxy;
use subconverter_rs::generator::{
add_nodes, filter_nodes, node_rename, preprocess_nodes, ExtraSettings, ParseSettings,
RegexMatchConfig,
};
fn main() {
// Create sample nodes
let mut nodes = Vec::new();
// Parse configuration files or links
let parse_settings = ParseSettings::default();
add_nodes("config.txt", &mut nodes, 1, &parse_settings);
// Preprocess nodes with custom rules
let mut ext = ExtraSettings::default();
preprocess_nodes(&mut nodes, &ext);
// Convert to different formats
let clash_config = subconverter_rs::generator::config::formats::clash::proxy_to_clash(
&mut nodes, "", &[], &[], false, &ext
);
}
Examples
Check out the examples
directory for more usage examples:
cargo run --example node_manip_example
Configuration
subconverter-rs uses similar configuration to the original subconverter.
Development
Contributions are welcome! Please feel free to submit a Pull Request.
How to Contribute
- Pick an issue: Check our issue tracker for tasks labeled
good first issue
orhelp wanted
- Implement new proxy types: Help expand support for additional proxy protocols
- Improve parsing: Enhance the robustness of the various format parsers
- Add tests: Increase test coverage to ensure stability
- Documentation: Improve docs or add examples to help others use the project
- Performance optimizations: Help make the converter even faster
For questions or discussions, you can:
- Open an issue on GitHub
Roadmap
- Basic proxy parsing and conversion
- Node filtering and manipulation
- Complete VMess protocol support
- Web interface for online conversion
- HTTP server for subscription conversion
- RESTful API
- Plugin system for easy extension
- Complete feature parity with original subconverter
- Performance benchmarks vs. original implementation
- Docker container and CI/CD pipelines
License
This project is licensed under the MIT License - see the LICENSE file for details.
Architecture
The project is organized into several key modules:
models
module
- Contains core data structures used throughout the application
- Defines
Proxy
andProxyType
as the canonical type definitions - Separates data models from processing logic for better maintainability
parser
module
types
: Defines configuration types likeConfType
explodes
: Contains parsers for different proxy formats (VMess, Shadowsocks, etc.)subparser
: High-level parsing functionality
generator
module
- Handles conversion between different formats
- Contains node manipulation functions like filtering and renaming
utils
module
- Common utilities used across the codebase
This architecture separates concerns between data models, parsing logic, and output generation, making the codebase easier to maintain and extend.
Dependencies
~21–37MB
~643K SLoC