Skip to main content

clash_tools - Clash Proxy Management Toolkit

clash_tools is a comprehensive collection of utilities for managing Clash proxy configurations and services. It provides multiple command-line tools for different purposes, making it easy to work with Clash in various environments.

Docs: https://clash-tools.readthedocs.io/en/latest/

PyPI version PyPI downloads Test status Codecov

Features

  • 🚀 Docker Integration: One-click enable/disable Docker client and daemon proxy

  • 🔧 Environment Setup: Easy proxy environment variable configuration

  • 🎯 Service Management: Simple Clash service startup and management

  • 📊 Status Monitoring: Real-time proxy status checking

  • 🔄 Configuration Reset: Convenient reset functionality

  • 💻 Multi-platform: Works on Linux systems with systemd support

Tools Overview

The toolkit includes three main utilities:

clash_docker

Docker proxy management tool for enabling/disabling Docker proxy settings

clash_proxy

Shell script for setting up proxy environment variables in the current session

clash_serve

Simple utility for starting the Clash service with proper configuration

Installation

To install clash_tools, use pip:

$ python -m pip install clash_tools

Quick Start

  1. Start Clash service:

$ clash_serve
  1. Set up proxy environment variables (in a new terminal):

$ source clash_proxy
  1. Configure Docker proxy:

$ clash_docker enable
  1. Check proxy status:

$ clash_docker status
  1. Disable proxy when done:

$ clash_docker disable

Configuration

All tools use a config.yaml file to configure the Clash proxy server.

Example configuration:

port: 7890
socks-port: 7891
redir-port: 7892
allow-lan: true
mode: rule
log-level: info
external-controller: '0.0.0.0:9090'
secret: ''

proxies:
  -
    name: 'my-proxy'
    type: ss
    server: your-proxy-server
    port: your-proxy-port
    cipher: your-cipher
    password: your-password
    udp: true

proxy-groups:
  - name: "PROXY"
    type: select
    proxies:
      - 'my-proxy'

rules:
  - MATCH,PROXY

Usage Examples

Complete Workflow:

# Terminal 1: Start Clash service
$ clash_serve

# Terminal 2: Set up environment and test
$ source clash_proxy
$ curl -I http://google.com
$ sudo clash_docker enable
$ docker pull hello-world

Development Environment:

$ source clash_proxy
$ npm install
$ pip install -r requirements.txt
$ git clone https://github.com/example/repo.git

Docker-Only Setup:

$ clash_serve &
$ sudo clash_docker enable
$ docker pull nginx

Documentation

For detailed documentation, visit: https://clash-tools.readthedocs.io/

The documentation includes:

  • Complete installation guide

  • Detailed usage instructions for all tools

  • Configuration examples

  • Troubleshooting guide

  • Best practices and workflows

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License.

Metadata

Release files for clash-tools 3.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for clash-tools 3.3.1
File Size Uploaded Provenance Actions
clash_tools-3.3.1.tar.gz 6.0 MB Without provenance Details for clash_tools-3.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for clash-tools 3.3.1
File Interpreter ABI Platform Actions
clash_tools-3.3.1-py3-none-any.whl Python 3 none any Details for clash_tools-3.3.1-py3-none-any.whl

Total release size: 12.1 MB

Release files / clash_tools-3.3.1.tar.gz

Download URL clash_tools-3.3.1.tar.gz
Size 6.0 MB
Tags Source
SHA-256 checksum
How to use checksums
0103b7af229cef2c04e354d0e0f16792fde7528ae5d878fe6f29662dffa2c80e
BLAKE2b-256 checksum
How to use checksums
b692302d815a33a2127f68ad4db0f56d7e9657ff2066a12769ad686aaf17016c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / clash_tools-3.3.1-py3-none-any.whl

Download URL clash_tools-3.3.1-py3-none-any.whl
Size 6.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
0cd43ac80266ce386907fe3af9785538d757bb3f8449dfc54d94f5ef8357af70
BLAKE2b-256 checksum
How to use checksums
7fc1e5cfad5e50bde55b3b5bd3b04d186aa88aca9393f9623b129fbf0814f580
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Security for clash-tools 3.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page