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.2.tar.gz (26.1 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.2-py3-none-any.whl (29.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: clash_cli-1.0.2.tar.gz
  • Upload date:
  • Size: 26.1 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.2.tar.gz
Algorithm Hash digest
SHA256 bad36f99acc2787b86b31d0c0831492103f9b5065bd568a131d4372a951196d1
MD5 9649dab5a076efa36db31e924d416c16
BLAKE2b-256 cdc9e71c5e062f5d116bb9b83322df483812feb91f18239739e88a9ef8f2e916

See more details on using hashes here.

File details

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

File metadata

  • Download URL: clash_cli-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 29.2 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8913addc0cc51395dd4b3ef8ff34c31a5a5f4eff41820499c3a626afd09b3328
MD5 d85cbdba6efc4464714cc1ba8614b20a
BLAKE2b-256 6f2fa9198759b4c3d157cea23637544d6788db58a02ce99a1c3f323ac3e1aace

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