Skip to content

Watfaq/clash-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

167eccd Β· Mar 3, 2025
Feb 22, 2025
Mar 3, 2025
Jun 17, 2024
Feb 28, 2025
Aug 2, 2024
Feb 21, 2025
Mar 3, 2025
Sep 21, 2023
Jan 16, 2025
Jul 31, 2023
Feb 25, 2025
Dec 31, 2023
Sep 18, 2023
Mar 3, 2025
Feb 25, 2025
Mar 3, 2025
Sep 20, 2022
Aug 31, 2024
Jul 14, 2024
Feb 15, 2025
Mar 3, 2025
Feb 21, 2025

Repository files navigation

ClashRS

A custom protocol, rule based network proxy software.

CI codecov

✨ Features

  • 🌈 Flexible traffic routing rules based off source/destination IP/Domain/GeoIP etc.
  • πŸ“¦ Local anti spoofing DNS with support of UDP/TCP/DoH/DoT remote, and expose it as a local UDP/TCP/DoH/DoT server.
  • πŸ›‘ Run as an HTTP/Socks5 proxy, or utun device as a home network gateway.
  • βš™οΈ Shadowsocks/Trojan/Vmess/Wireguard(userspace)/Tor/Tuic/Socks5(TCP/UDP) outbound support with different underlying trasports(gRPC/TLS/H2/WebSocket/etc.).
  • 🌍 Dynamic remote rule/proxy loader.
  • 🎡 Tracing with Jaeger

πŸ–₯ Environment Support

  • Linux
  • macOS
  • Windows
    • You need to copy the wintun.dll file which matches your architecture to the same directory as your executable and run you program as administrator.
  • iOS - TestFlight

πŸ“¦ Install

Use With GUI

https://github.com/LibNyanpasu/clash-nyanpasu

Download Prebuilt Binary

Can be found at https://github.com/Watfaq/clash-rs/releases

Docker Image

https://github.com/Watfaq/clash-rs/pkgs/container/clash-rs

Local Build

Dependencies

  • cmake (3.29 or newer)
  • libclang(LLVM)
  • nasm (Windows)
  • protoc(for geodata proto generation)
$ cargo build

πŸ”¨ Usage

Example Config

sample.yaml:

port: 7890

Run

-> % ./target/debug/clash -c sample.yaml

Help

-> % ./target/debug/clash -h
Usage: clash [OPTIONS]

Options:
  -d, --directory <DIRECTORY>
  -c, --config <FILE>          [default: config.yaml]
  -t, --test
  -h, --help                   Print help
  -V, --version                Print version

FFI

Compile for apple platforms

To create a framework for iOS and macOS platforms

git clone https://github.com/Watfaq/clash-rs.git
cd clash-rs
chmod +x scripts/build_apple.sh
./scripts/build_apple.sh

This command will generate a clashrs.xcframework file in the build directory.

πŸ”— Links

🀝 Contributing

❀️ Inspired By