Skip to main content

clash_tools is a comprehensive collection of utilities for managing Clash proxy configurations and services.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

clash_tools-3.0.2.tar.gz (6.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

clash_tools-3.0.2-py3-none-any.whl (6.1 MB view details)

Uploaded Python 3

File details

Details for the file clash_tools-3.0.2.tar.gz.

File metadata

  • Download URL: clash_tools-3.0.2.tar.gz
  • Upload date:
  • Size: 6.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for clash_tools-3.0.2.tar.gz
Algorithm Hash digest
SHA256 b0e71a9a0eac78ec4b432ec01bb4c1443f426ef2ddcf72a38f0e80385dd1fbed
MD5 1dff2b98fb0ea04288cb7486b93aa1b2
BLAKE2b-256 e38b189a60b85e471da2a8b9edba94d13f996404dfc6563b7e5c46369d8ee11c

See more details on using hashes here.

File details

Details for the file clash_tools-3.0.2-py3-none-any.whl.

File metadata

  • Download URL: clash_tools-3.0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for clash_tools-3.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e5f17415eb5a524708490e40cf3fb6e11cfb2a77ac374880c442f177ead98c4d
MD5 6eab5ee9980c1f3025c5fb43ecf3d786
BLAKE2b-256 dd009b05057fa455ab88800ce46d7aaf922e8e60ab55001ecc80b35be181b364

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page