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.6.tar.gz (27.8 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.6-py3-none-any.whl (31.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: clash_cli-1.0.6.tar.gz
  • Upload date:
  • Size: 27.8 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.6.tar.gz
Algorithm Hash digest
SHA256 3c6739daf276c84ad1d3afabb0173b2bee330e3ee627ce6548ef73aca12a2a22
MD5 5cfe960365681a44d70b3fccff08e706
BLAKE2b-256 b1a0333fb8b42739a54df88fa118de2e536a1ff572387a694a61485ea24c15b9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: clash_cli-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 31.1 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 cdfea12847e9b0625720250ca078a55eac723581c349edc04d5f3aae80e15ec1
MD5 35f4345e4bffb9fd80bf8e45286db423
BLAKE2b-256 b8b80f6e2c8d370044a76ad73393f5d4ba37d387c04a21ab7e0b8772b5ed484a

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