中文 | English | Русский | فارسی
Chimera Client is a Rust reimplementation of the Clash proxy client stack. The goal is to stay as compatible as practical with Clash / Mihomo configuration style and operational workflow, while taking advantage of Rust's stronger type safety, async runtime, observability, and cross-platform maintainability.
The current codebase mainly follows the architecture of upstream clash-rs and continues extending protocols, runtime behavior, and control interfaces for Chimera-specific needs. The project already includes core modules such as the CLI, configuration parsing, runtime assembly, DNS, routing, inbound and outbound management, proxy protocols, TUN, REST API, and hot reload.
- Clash-compatible configuration experience: keep the familiar YAML workflow and continue expanding support for proxies, proxy groups, rules, DNS, TUN, profiles, and external controller APIs.
- Rust-native runtime: build on
tokio, strong typing, structured error handling, andtracingto improve reliability and maintainability. - Modular proxy core: keep DNS, router, dispatcher, inbound, outbound, profile, and API responsibilities separated so they can be developed and tested independently.
- Cross-platform and embeddable design: reserve integration paths through crates such as
clash-ffiandclash-netstackfor GUI, mobile, TUN, and FFI scenarios.
- XHTTP
- VLESS + Reality + TCP
- Trojan + TLS + WebSocket
- Hysteria2
- SOCKS5 inbound / outbound
- HTTP / Mixed listening ports
- TUN mode
- DNS resolver, DNS listener, Fake IP, and DNS filtering
- Proxy groups, including Selector, URLTest, and Fallback
- REST API controller
- Configuration hot reload
- MMDB, ASN MMDB, and Geosite download / lookup
- TLS crypto provider selection through
aws-lc-rsorring
Some modules are still being completed. Protocol compatibility, cross-platform behavior, and test coverage will continue improving as development progresses.
Start the client with:
cargo run -p clash-rs -- -c config.yamlStartup flow:
clash-binparses CLI arguments withclap.- If the config file does not exist, the CLI creates a minimal file whose default content is
port: 7890. - If
-tor--test-configis passed, the process only parses the config and returns the validation result. - During normal startup,
clash-bincallsclash-lib::start_scaffold. clash-libcreates a Tokio runtime, parses the YAML configuration, and converts it into the internal runtime config.- The core initializes logging, cache, DNS resolver, outbound manager, router, dispatcher, authenticator, inbound manager, DNS listener, TUN runner, and REST API runner.
- The runtime listens for Ctrl+C or an internal shutdown token and supports config hot reload through the API.
Common commands:
cargo run -p clash-rs -- -c config.yaml
cargo run -p clash-rs -- --config config.yaml --directory .
cargo run -p clash-rs -- -t -c config.yaml
cargo run -p clash-rs -- --versionThe project uses Cargo features to control optional functionality. Common features include:
tls: enable Rustls / Tokio Rustls TLS support.ws: enable WebSocket transport.trojan: enable Trojan protocol support.hysteria: enable Hysteria / Hysteria2 QUIC / H3 support.reality: enable Reality transport support.tun: enable TUN, netstack, and system routing support.port,http_port,mixed_port: enable HTTP / Mixed listening ports.aws-lc-rs,ring: choose the underlying crypto provider.tproxy,redir: transparent proxy related features.
clash-bin enables standard and aws-lc-rs by default. The standard feature pulls in trojan, ws, tls, hysteria, reality, port, tun, and other core capabilities.
cargo check --all
cargo build
cargo run -p clash-rs -- -c config.yaml
cargo fmt
cargo clippy --all-targets --all-features
cargo test --allRun a single crate or a focused test:
cargo test -p clash-lib
cargo test -p clash-lib put_configs_reloads_runtime_from_fileRun CI-like tests:
CLASH_RS_CI=true cargo test --all --all-features- The project is still evolving quickly. Some protocols, platform behavior, and API behavior still need follow-up work.
- The Rust edition is
2024. - During development, it is recommended to run
cargo check --allfirst, thencargo fmt,cargo clippy --all-targets --all-features, andcargo test --allaccording to the scope of the change. - When changing config, DNS, routing, proxy behavior, or runtime lifecycle code, prefer adding focused tests to protect reload and controller behavior.
- TUN, Reality, Hysteria2, WebSocket, TLS, and similar features depend on Cargo features and platform environment. Debugging them usually requires checking build features, system permissions, and network conditions together.
- Organize the project wiki.
- Continue improving Clash / Mihomo configuration compatibility so common real-world configs can be parsed and converted reliably.
- Strengthen protocol implementations, especially VLESS Reality, Trojan, Hysteria2, WebSocket, TLS, and UDP behavior.
- Improve handling of TUN, DNS hijack, Fake IP, and system routing differences across Windows, Linux, and macOS.
- Improve REST API compatibility with Clash / Mihomo controllers.
- Expand integration tests to cover config loading, hot reload, rule matching, DNS, inbound listeners, and outbound dialing flows.