clash
Proxy network traffic based on rules
TLDR
Specify a configuration [d]irectory
Specify a configuration [f]ile
SYNOPSIS
clash [OPTION]...
clash -f CONFIG_FILE [OPTION]...
PARAMETERS
-f, --config <file>
Specifies the path to the YAML configuration file to use for Clash. This is typically required for operation.
-d, --dir <dir>
Sets the working directory for Clash, where it stores data like logs, cached geo-IP databases, and configuration backups.
-t, --test
Tests the syntax and validity of the specified configuration file without actually starting the Clash proxy.
-v, --version
Displays the current version information of the Clash client and exits.
-h, --help
Shows a brief help message detailing available command-line options and usage.
-s, --strict
Enables strict mode, which might alter how certain rules or network behaviors are handled, often related to DNS or connection handling.
DESCRIPTION
Clash is a cross-platform, rule-based proxy client that supports multiple proxy protocols, including Socks5, HTTP, Shadowsocks, VMess, Trojan, and more. It acts as a gateway for your network traffic, allowing you to define granular rules for how different connections are routed. This enables users to bypass geo-restrictions, enhance privacy, and manage network traffic effectively based on domains, IP ranges, process names, or geographical locations.
Utilizing a declarative YAML configuration file, Clash provides extensive customization options for proxy selection, load balancing, and complex traffic routing scenarios. It also features a built-in RESTful API and a web-based dashboard for real-time monitoring, management, and easy configuration changes. While not a native Linux command in the traditional sense, it's widely used as a powerful network utility for advanced proxying needs.
CAVEATS
Clash is not a standard Linux utility shipped with most distributions; it needs to be installed separately. Its effective use requires a good understanding of network concepts and YAML configuration. Improper configuration can lead to network connectivity issues or expose your traffic to unintended proxies. Security is paramount; ensure your configuration files and proxy servers are trustworthy.
CONFIGURATION FILE FORMAT
Clash relies entirely on a YAML-formatted configuration file. This file defines everything from proxy servers, proxy groups (for load balancing or failover), and DNS settings to a sophisticated set of rules governing how traffic is routed, e.g., 'DIRECT' for no proxy, 'PROXY' for a specific proxy, or 'REJECT' for blocking.
DASHBOARD AND API
Beyond its command-line interface, Clash includes a powerful RESTful API and a web-based dashboard. The dashboard provides a graphical interface for monitoring network connections, viewing logs, switching proxy groups, and dynamically reloading the configuration without restarting the service, offering real-time control and visibility.
HISTORY
Developed as an open-source project, Clash rapidly gained popularity, particularly among users seeking flexible and robust proxy solutions for bypassing internet censorship and managing complex network routing. Its adoption soared due to its support for a wide array of modern proxy protocols and its powerful rule-based engine, making it a go-to tool for advanced network proxying tasks across various operating systems.