Skip to content

Commit f792a0b

Browse files
Copilotspacemeowx2
andcommitted
Add guide and reference docs pages
Co-authored-by: spacemeowx2 <8019167+spacemeowx2@users.noreply.github.com>
1 parent 6d72585 commit f792a0b

File tree

4 files changed

+236
-0
lines changed

4 files changed

+236
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@
66
*.dat
77
dist/
88
node_modules/
9+
docs/node_modules/
10+
docs/build/

docs/docs/config/reference.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
---
2+
sidebar_position: 3
3+
---
4+
5+
# 配置参考
6+
7+
本页汇总常用配置块的字段说明,方便在编写配置时快速查阅。更完整的字段说明可以结合 JSON Schema 进行补全。
8+
9+
## net 类型
10+
11+
`net` 中每个节点使用 `type` 字段指定具体实现。常见类型如下:
12+
13+
| 类型 | 说明 | 关键字段 |
14+
| --- | --- | --- |
15+
| `shadowsocks` | Shadowsocks 客户端 | `server`, `cipher`, `password`, `udp` |
16+
| `trojan` | Trojan 客户端 | `server`, `sni`, `password`, `udp` |
17+
| `http` | HTTP 代理客户端 | `server`, `port`, `username`, `password` |
18+
| `socks5` | SOCKS5 代理客户端 | `server`, `port`, `username`, `password` |
19+
| `rule` | 规则路由 | `rule`, `lru_cache_size` |
20+
| `local` | 本机直连 ||
21+
22+
> 不同 `net` 的字段以 Schema 生成结果为准,建议在编辑器中开启 Schema 补全。
23+
24+
### rule 规则项
25+
26+
`rule` 类型由若干 `rule` 条目组成,每个条目需要声明匹配条件与目标出口。
27+
28+
| 匹配类型 | 字段 | 说明 |
29+
| --- | --- | --- |
30+
| `domain` | `method`, `domain` | 域名匹配,`method` 支持 `keyword`/`suffix`/`match` |
31+
| `ipcidr` | `ipcidr` | 目标 IP 段匹配 |
32+
| `src_ipcidr` | `ipcidr` | 源 IP 段匹配 |
33+
| `geoip` | `country` | 国家代码匹配 |
34+
| `any` | - | 匹配所有流量 |
35+
36+
示例:
37+
38+
```yaml
39+
net:
40+
my_rule:
41+
type: rule
42+
rule:
43+
- type: domain
44+
method: suffix
45+
domain: example.com
46+
target: proxy
47+
- type: any
48+
target: local
49+
```
50+
51+
## server 类型
52+
53+
`server` 中每个条目定义本地监听的服务。
54+
55+
| 类型 | 说明 | 关键字段 |
56+
| --- | --- | --- |
57+
| `http` | HTTP 代理服务 | `bind`, `net` |
58+
| `socks5` | SOCKS5 代理服务 | `bind`, `net` |
59+
| `http+socks5` | 混合模式 | `bind`, `net` |
60+
61+
示例:
62+
63+
```yaml
64+
server:
65+
mixed:
66+
type: http+socks5
67+
bind: 127.0.0.1:10800
68+
net: my_rule
69+
```
70+
71+
## import 类型
72+
73+
`import` 用于导入外部配置或订阅。
74+
75+
| 类型 | 说明 | 关键字段 |
76+
| --- | --- | --- |
77+
| `merge` | 合并本地配置 | `source.path` |
78+
| `clash` | 导入 Clash 配置 | `source.poll.url`, `source.poll.interval`, `rule_name` |
79+
80+
示例:
81+
82+
```yaml
83+
import:
84+
- type: merge
85+
source:
86+
path: ./local.yaml
87+
- type: clash
88+
source:
89+
poll:
90+
url: https://example.com/subscribe.yaml
91+
interval: 86400
92+
rule_name: clash_rule
93+
```
94+
95+
## 常用顶级字段
96+
97+
| 字段 | 说明 |
98+
| --- | --- |
99+
| `id` | 配置标识(可选) |
100+
| `net` | 代理节点与链路 |
101+
| `server` | 本地监听服务 |
102+
| `import` | 配置导入 |

docs/docs/tutorial/guide.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
---
2+
sidebar_position: 4
3+
---
4+
5+
# 进阶使用指南
6+
7+
本页整理了一套较完整的实践流程,帮助你从「能跑」快速过渡到「稳定可维护」。所有示例都基于 YAML 配置格式。
8+
9+
## 1. 准备配置文件
10+
11+
建议从一个最小配置开始,确认服务可用后再逐步扩展。
12+
13+
```yaml
14+
net:
15+
ss_main:
16+
type: shadowsocks
17+
server: example.com:1234
18+
cipher: aes-256-cfb
19+
password: password
20+
udp: true
21+
server:
22+
mixed:
23+
type: http+socks5
24+
bind: 127.0.0.1:10800
25+
net: ss_main
26+
```
27+
28+
## 2. 启动与热重载
29+
30+
默认情况下程序会读取当前目录的 `config.yaml`:
31+
32+
```bash
33+
./rabbit-digger-pro
34+
```
35+
36+
配置文件更新后会自动热重载。建议先在日志中确认「已重载」的提示,再进行网络请求测试。
37+
38+
如果配置不在当前目录,可以显式指定:
39+
40+
```bash
41+
./rabbit-digger-pro -c /path/to/config.yaml
42+
```
43+
44+
## 3. 组合多个出口
45+
46+
使用 `rule` 类型可以对不同目标走不同出口,下面示例展示域名分流:
47+
48+
```yaml
49+
net:
50+
us:
51+
type: trojan
52+
server: us.example.com:443
53+
sni: us.example.com
54+
password: "uspassword"
55+
udp: true
56+
jp:
57+
type: shadowsocks
58+
server: jp.example.com:1234
59+
cipher: aes-256-cfb
60+
password: "jppassword"
61+
udp: true
62+
my_rule:
63+
type: rule
64+
rule:
65+
- type: domain
66+
method: suffix
67+
domain: google.com
68+
target: jp
69+
- type: domain
70+
method: keyword
71+
domain: twitter
72+
target: us
73+
- type: any
74+
target: local
75+
server:
76+
mixed:
77+
type: http+socks5
78+
bind: 0.0.0.0:10800
79+
net: my_rule
80+
```
81+
82+
## 4. 订阅与合并配置
83+
84+
如果有 Clash 订阅,可以在 `import` 中拉取并合并:
85+
86+
```yaml
87+
import:
88+
- type: clash
89+
poll:
90+
url: https://example.com/subscribe.yaml
91+
interval: 86400
92+
rule_name: clash_rule
93+
```
94+
95+
将合并后的规则在其他位置直接引用:
96+
97+
```yaml
98+
server:
99+
mixed:
100+
type: http+socks5
101+
bind: 127.0.0.1:10800
102+
net: clash_rule
103+
```
104+
105+
## 5. 使用 JSON Schema 做配置补全
106+
107+
生成 Schema 文件后可用于编辑器补全:
108+
109+
```bash
110+
./rabbit-digger-pro generate-schema > rabbit-digger-pro-schema.json
111+
```
112+
113+
编辑器中引用远程 Schema 也可获得补全(示例):
114+
115+
```yaml
116+
# yaml-language-server: $schema=https://rabbit-digger.github.io/schema/rabbit-digger-pro-schema.json
117+
```
118+
119+
## 6. 常见排查思路
120+
121+
1. **检查日志**:确认配置已成功加载。
122+
2. **确认端口监听**:例如 `10800` 端口是否已开启。
123+
3. **逐步缩减配置**:从最小配置排查出问题配置块。
124+
4. **检查订阅内容**:确认订阅 YAML 可在浏览器打开。
125+
126+
> 更多参数说明与字段参考请查阅「配置参考」页面。

docs/docusaurus.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ const config: Config = {
6969
position: 'left',
7070
label: '配置指南',
7171
},
72+
{
73+
type: 'doc',
74+
docId: 'config/reference',
75+
position: 'left',
76+
label: '配置参考',
77+
},
7278
{
7379
href: 'https://github.com/spacemeowx2/rabbit-digger-pro',
7480
label: 'GitHub',

0 commit comments

Comments
 (0)