Clash for Magisk

Magisk KSU APatch

Take total command over your Android device's network traffic. Clash for Magisk by entr0pia is a robust, systemless networking module that brings the industry-standard rule-based tunnel engine to your smartphone. Whether you need sophisticated proxy management, traffic routing for specific applications, or a powerful bypass tool for restricted networks, this module provides the granular control that standard Android VPNs simply cannot match.

Rule-Based Network Control

A sophisticated, low-latency tunnel engine designed to intercept and route traffic according to precise, user-defined YAML rule sets.

Rule-Based Routing

Route specific apps, domains, or IP ranges through different proxy servers or direct connections with pinpoint accuracy. Perfect for localized network policy enforcement.

High-Performance Tunneling

Engineered in high-performance languages to ensure minimal latency overhead. Experience near-native connection speeds while maintaining complex proxy tunnels.

Protocol Flexibility

Supports a wide array of proxy protocols including Shadowsocks, VMess, Trojan, and SOCKS5, making it the most versatile networking tool for power users.

Native Root Integration

Installs binary components directly into the systemless root layer. Compatible with Magisk, KernelSU, APatch, and KSUNext, allowing seamless execution at boot.

YAML Configuration

Harness the power of a standard YAML config. Define groups, selectors, and complex load-balancing rules just as you would on a desktop Clash server.

Systemless Deployment

Operates purely in memory or via systemless mounts. No partition modification ensures your device remains clean for security patches and OTA updates.

Under the Hood: Network Stack Integration

Clash for Magisk doesn't just manage traffic; it actively intercepts the entire device's network flow at the routing table level. When active, it deploys a custom iptables chain that forces all non-whitelisted traffic through the Clash tun interface.

By utilizing the systemless root infrastructure, it injects high-speed binaries and dynamic configuration loaders during the boot initialization phase. This allows the Clash core to manage traffic with significantly higher stability and throughput than traditional VPN applications that rely on the Android VpnService API.

# YAML rule-based traffic management configuration
rules:
- DOMAIN-SUFFIX,google.com,Proxy
- DOMAIN-SUFFIX,github.com,Proxy
- GEOIP,CN,DIRECT
- MATCH,Proxy
# Kernel-level traffic interception via iptables
iptables -t nat -A OUTPUT -p tcp -j CLASH_TUN
iptables -t nat -A OUTPUT -p udp -j CLASH_TUN
Rule Logic
The core engine performs intelligent domain-based inspection, ensuring that local traffic remains untouched while foreign traffic is routed via your proxy tunnels.
Systemless Bind
Binary files are injected systemlessly into the root path, ensuring the Clash process has elevated permissions required to manipulate system network tables on boot.

Module Info

  • Version v1.20.0
  • Module By
    entr0pia
  • Contributors entr0pia, network-maintainers
  • Source Code View Repository
  • Tags
    #Clash #Networking #Proxy #Magisk Module #KernelSU #APatch #entr0pia #Traffic Control
  • Requirement
    Magisk KernelSU APatch
  • Latest Update