clash-kit 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -25
- package/bin/index.js +10 -5
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
# Clash
|
|
1
|
+
# Clash Kit
|
|
2
|
+
|
|
3
|
+
<img width="800" alt="clash-kit" src="https://github.com/user-attachments/assets/dd7dfd29-f59a-418b-8623-6ab08ece9ddb" />
|
|
2
4
|
|
|
3
5
|
一个基于 Node.js 的 Clash 命令行管理工具,旨在简化 Clash 的配置管理、订阅切换和节点测速等操作。
|
|
4
6
|
|
|
@@ -12,7 +14,7 @@
|
|
|
12
14
|
- 🛠 **自动初始化**:自动处理二进制文件权限问题。
|
|
13
15
|
|
|
14
16
|
- 💻 **系统代理**:一键开启/关闭 macOS 系统 HTTP 代理。
|
|
15
|
-
- 🛡 **TUN
|
|
17
|
+
- 🛡 **TUN 模式**:高级网络模式,接管系统所有流量(真 · 全局代理)。
|
|
16
18
|
|
|
17
19
|
## 使用
|
|
18
20
|
|
|
@@ -30,6 +32,8 @@ pnpm add -g clash-kit
|
|
|
30
32
|
|
|
31
33
|
```bash
|
|
32
34
|
clash init
|
|
35
|
+
# 推荐用简化命令(文档后续均以简化命令为例)
|
|
36
|
+
ck init
|
|
33
37
|
```
|
|
34
38
|
|
|
35
39
|
### 3. 启动服务
|
|
@@ -38,58 +42,62 @@ clash init
|
|
|
38
42
|
|
|
39
43
|
```bash
|
|
40
44
|
# 启动 Clash 代理服务
|
|
41
|
-
|
|
45
|
+
ck start
|
|
42
46
|
|
|
43
47
|
# 启动并自动开启系统代理
|
|
44
|
-
|
|
48
|
+
ck start -s
|
|
45
49
|
```
|
|
46
50
|
|
|
47
51
|
### 4. 添加订阅
|
|
48
52
|
|
|
49
53
|
```bash
|
|
50
|
-
#
|
|
51
|
-
|
|
54
|
+
# 交互式管理订阅(添加、切换、删除等)【推荐使用这种方式来管理订阅】
|
|
55
|
+
ck sub
|
|
52
56
|
|
|
53
57
|
# 手动添加订阅
|
|
54
|
-
|
|
58
|
+
ck sub -a "https://example.com/subscribe?token=xxx" -n "abcName"
|
|
55
59
|
```
|
|
56
60
|
|
|
57
61
|
### 4. 节点测速与切换
|
|
58
62
|
|
|
59
63
|
```bash
|
|
60
64
|
# 测速
|
|
61
|
-
|
|
65
|
+
ck test
|
|
62
66
|
|
|
63
67
|
# 切换节点
|
|
64
|
-
|
|
68
|
+
ck proxy
|
|
65
69
|
```
|
|
66
70
|
|
|
67
71
|
### 5. 更多功能
|
|
68
72
|
|
|
69
73
|
```bash
|
|
70
74
|
# 查看状态
|
|
71
|
-
|
|
75
|
+
ck status
|
|
72
76
|
|
|
73
77
|
# 开启 TUN 模式 (需要 sudo 权限)
|
|
74
|
-
sudo
|
|
78
|
+
sudo ck tun on
|
|
75
79
|
```
|
|
76
80
|
|
|
77
81
|
## 命令详解
|
|
78
82
|
|
|
79
|
-
| 命令
|
|
80
|
-
| --------------------- | -------------------------- |
|
|
81
|
-
| `
|
|
82
|
-
| `
|
|
83
|
-
| `
|
|
84
|
-
| `
|
|
85
|
-
| `
|
|
86
|
-
| `
|
|
87
|
-
| `
|
|
88
|
-
| `
|
|
89
|
-
| `
|
|
90
|
-
| `
|
|
91
|
-
| `
|
|
92
|
-
| `
|
|
83
|
+
| 命令 (别名) | 说明 | 示例 |
|
|
84
|
+
| --------------------- | -------------------------- | ------------------------------- |
|
|
85
|
+
| `ck init` (`i`) | 初始化内核及权限 | `ck i` |
|
|
86
|
+
| `ck start` (`on`) | 启动 Clash 服务 | `ck on -s` (启动并设置系统代理) |
|
|
87
|
+
| `ck stop` (`off`) | 停止服务并关闭代理 | `ck off` |
|
|
88
|
+
| `ck status` (`st`) | 查看运行状态及当前节点延迟 | `ck st` |
|
|
89
|
+
| `ck sub` (`s`) | 管理订阅(交互式) | `ck s` |
|
|
90
|
+
| `ck sub -a <url>` | 添加订阅 | `ck s -a "http..." -n "pro"` |
|
|
91
|
+
| `ck sub -u <name>` | 切换订阅 | `ck s -u "pro"` |
|
|
92
|
+
| `ck sub -l` | 列出所有订阅 | `ck s -l` |
|
|
93
|
+
| `ck proxy` (`p`) | 切换节点(交互式) | `ck p` |
|
|
94
|
+
| `ck test` (`t`) | 节点并发测速 | `ck t` |
|
|
95
|
+
| `ck sysproxy` (`sys`) | 设置系统代理 (on/off) | `ck sys on` |
|
|
96
|
+
| `ck tun` | 设置 TUN 模式 (on/off) | `sudo ck tun on` |
|
|
97
|
+
|
|
98
|
+
## 截图
|
|
99
|
+
|
|
100
|
+
<img width="2742" height="1994" alt="image" src="https://github.com/user-attachments/assets/1183f778-62b0-4ac7-ab55-b821b66161f0" />
|
|
93
101
|
|
|
94
102
|
## 目录结构
|
|
95
103
|
|
package/bin/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import { test } from '../lib/commands/test.js'
|
|
|
13
13
|
|
|
14
14
|
const program = new Command()
|
|
15
15
|
|
|
16
|
-
program.name('clash').description('Clash CLI 管理工具').version('1.0.0')
|
|
16
|
+
program.name('clash').alias('ck').description('Clash CLI 管理工具 (Alias: ck)').version('1.0.0')
|
|
17
17
|
|
|
18
18
|
// 初始化 clash 内核
|
|
19
19
|
program
|
|
@@ -29,13 +29,18 @@ program.command('start').description('启动 Clash 服务').option('-s, --syspro
|
|
|
29
29
|
program.command('stop').description('停止 Clash 服务').action(stop)
|
|
30
30
|
|
|
31
31
|
// 设置系统代理
|
|
32
|
-
program
|
|
32
|
+
program
|
|
33
|
+
.command('sysproxy')
|
|
34
|
+
.alias('sys')
|
|
35
|
+
.description('设置系统代理')
|
|
36
|
+
.argument('[action]', 'on 或 off')
|
|
37
|
+
.action(setSysProxy)
|
|
33
38
|
|
|
34
39
|
// 设置 TUN 模式(真正的全局代理,所有流量都会被代理)
|
|
35
40
|
program.command('tun').description('设置 TUN 模式 (可能需要提权)').argument('[action]', 'on 或 off').action(setTun)
|
|
36
41
|
|
|
37
42
|
// 查看 clash 状态
|
|
38
|
-
program.command('status').description('查看 Clash 运行状态').action(status)
|
|
43
|
+
program.command('status').alias('st').description('查看 Clash 运行状态').action(status)
|
|
39
44
|
|
|
40
45
|
// 管理订阅
|
|
41
46
|
program
|
|
@@ -48,9 +53,9 @@ program
|
|
|
48
53
|
.action(manageSub)
|
|
49
54
|
|
|
50
55
|
// 切换节点
|
|
51
|
-
program.command('proxy').description('切换节点').action(proxy)
|
|
56
|
+
program.command('proxy').alias('p').description('切换节点').action(proxy)
|
|
52
57
|
|
|
53
58
|
// 节点测速
|
|
54
|
-
program.command('test').description('节点测速').action(test)
|
|
59
|
+
program.command('test').alias('t').description('节点测速').action(test)
|
|
55
60
|
|
|
56
61
|
program.parse(process.argv)
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clash-kit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A command-line interface for managing Clash configurations, subscriptions, and proxies.",
|
|
6
6
|
"bin": {
|
|
7
|
+
"ck": "./bin/index.js",
|
|
7
8
|
"clash": "./bin/index.js"
|
|
8
9
|
},
|
|
9
10
|
"files": [
|