Skip to main content

Clash的linux命令行实现

Project description

clash-cli

PyPI Python License

Linux 一键安装 Clash 代理工具的 Python 实现版本。

✨ 特性

  • 🚀 一键安装pip install clash-cli 即可安装
  • 🔧 统一管理:完整的命令行界面
  • 🌐 订阅转换:内置订阅转换功能
  • 🎯 多内核支持:支持 mihomo 和 clash 内核
  • 🔒 系统集成:systemd 服务管理
  • 🌍 Web 控制台:可视化管理界面
  • 📱 Tun 模式:全局代理支持

📦 安装

pip install clash-cli

🚀 快速开始

1. 安装 Clash

# 使用默认 mihomo 内核安装
sudo clash-cli install

# 指定订阅链接安装
sudo clash-cli install -s "https://your-subscription-url.com"

# 使用 clash 内核安装
sudo clash-cli install --kernel clash

2. 基本使用

# 开启代理
clash-cli on

# 关闭代理
clash-cli off

# 查看状态
clash-cli status

# 查看 Web 控制台
clash-cli ui

📖 命令参考

基本命令

clash-cli install [--kernel mihomo|clash] [-s SUBSCRIPTION]  # 安装
clash-cli uninstall                                          # 卸载
clash-cli on                                                 # 开启代理
clash-cli off                                                # 关闭代理
clash-cli status [-n LINES] [-f]                            # 查看状态
clash-cli ui                                                 # Web 控制台信息
clash-cli info                                               # 系统信息

系统代理管理

clash-cli proxy          # 查看代理状态
clash-cli proxy on       # 开启系统代理
clash-cli proxy off      # 关闭系统代理

Web 控制台

clash-cli secret [PASSWORD]    # 设置/查看密钥

Tun 模式

clash-cli tun            # 查看 Tun 状态
clash-cli tun on         # 开启 Tun 模式
clash-cli tun off        # 关闭 Tun 模式

订阅管理

clash-cli update                    # 查看当前订阅
clash-cli update sync [URL]        # 更新订阅
clash-cli update log [-n LINES]    # 查看更新日志

配置管理

clash-cli mixin          # 查看 Mixin 配置
clash-cli mixin edit     # 编辑 Mixin 配置
clash-cli mixin runtime  # 查看运行时配置

🔧 高级配置

Mixin 配置

Mixin 配置允许您自定义 Clash 设置,这些设置会与订阅配置合并:

# 系统代理
system-proxy:
  enable: true

# Web 控制台
external-controller: "0.0.0.0:9090"
secret: "your-password"

# 自定义规则
rules:
  - DOMAIN-SUFFIX,example.com,DIRECT
  - DOMAIN-KEYWORD,google,PROXY

# Tun 模式
tun:
  enable: true
  stack: system

环境要求

  • 操作系统:Linux (支持 systemd)
  • Python:3.8+
  • 权限:root 或 sudo
  • 架构:x86_64, aarch64, armv7

🤝 贡献

欢迎提交 Issue 和 Pull Request!

📄 许可证

MIT License

🙏 致谢


如果这个项目对您有帮助,请给个 ⭐ Star 支持一下!

Made with ❤️ by whillhill

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_cli-1.0.4.tar.gz (27.4 kB view details)

Uploaded Source

Built Distribution

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

clash_cli-1.0.4-py3-none-any.whl (30.7 kB view details)

Uploaded Python 3

File details

Details for the file clash_cli-1.0.4.tar.gz.

File metadata

  • Download URL: clash_cli-1.0.4.tar.gz
  • Upload date:
  • Size: 27.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for clash_cli-1.0.4.tar.gz
Algorithm Hash digest
SHA256 6472aba7eecba62de9d7418fbbb6435b1f5db03c0164d575c78d01bc182c0079
MD5 c8362c54609ce57d4218965173ade377
BLAKE2b-256 b3ba259aa2ae431913cb4e7c16d46f3cb9a7736892470ef606df1ebf1b9db3f0

See more details on using hashes here.

File details

Details for the file clash_cli-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: clash_cli-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 30.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for clash_cli-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 70c11da51ba3fe4368f53a347d2422bf93e72f603b3ced8e9c1ac11f5823d80f
MD5 2bea32af881b3d15d234d69f8c30a3b7
BLAKE2b-256 e66aa6f27d23967d9925e4c309764860f8b06385ce1b55066c74fb5d4385fe3e

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