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.3.tar.gz (26.7 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.3-py3-none-any.whl (30.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: clash_cli-1.0.3.tar.gz
  • Upload date:
  • Size: 26.7 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.3.tar.gz
Algorithm Hash digest
SHA256 e7af01867cd6cb0e46276267d6f2d859dd4f711d562b9db00f2b18476a92aa01
MD5 4ab8e9b4a16d9f9d214dcb46d52d8d30
BLAKE2b-256 5061929cf658b5ae44d7c119d733ba1fd51cd9b28ea13c8f0156f047cd8d24cd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: clash_cli-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 30.0 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1e46cab0ec7e9ca93d644379ce8fd8bb43959342c70a00a49650a08245b95407
MD5 aa92ce41768ee02eda535cb8509c8960
BLAKE2b-256 fdc61c07fce7793b8fc8a8adbbb2855dca0f7a8cbd38ff38696dedad4188ca8f

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