Skip to content

Commit e4eacf3

Browse files
committed
documentation: Add rule action
1 parent 903de67 commit e4eacf3

File tree

22 files changed

+1076
-43
lines changed

22 files changed

+1076
-43
lines changed

docs/configuration/dns/rule.md

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
icon: material/new-box
33
---
44

5+
!!! quote "Changes in sing-box 1.11.0"
6+
7+
:material-plus: [action](#action)
8+
:material-alert: [server](#server)
9+
:material-alert: [disable_cache](#disable_cache)
10+
:material-alert: [rewrite_ttl](#rewrite_ttl)
11+
:material-alert: [client_subnet](#client_subnet)
12+
513
!!! quote "Changes in sing-box 1.10.0"
614

715
:material-delete-clock: [rule_set_ipcidr_match_source](#rule_set_ipcidr_match_source)
@@ -14,7 +22,7 @@ icon: material/new-box
1422
:material-plus: [geoip](#geoip)
1523
:material-plus: [ip_cidr](#ip_cidr)
1624
:material-plus: [ip_is_private](#ip_is_private)
17-
:material-plus: [client_subnet](#client_subnet)
25+
:material-plus: [client_subnet](#client_subnet)
1826
:material-plus: [rule_set_ipcidr_match_source](#rule_set_ipcidr_match_source)
1927

2028
!!! quote "Changes in sing-box 1.8.0"
@@ -135,19 +143,15 @@ icon: material/new-box
135143
"outbound": [
136144
"direct"
137145
],
138-
"server": "local",
139-
"disable_cache": false,
140-
"rewrite_ttl": 100,
141-
"client_subnet": "127.0.0.1/24"
146+
"action": "route",
147+
"server": "local"
142148
},
143149
{
144150
"type": "logical",
145151
"mode": "and",
146152
"rules": [],
147-
"server": "local",
148-
"disable_cache": false,
149-
"rewrite_ttl": 100,
150-
"client_subnet": "127.0.0.1/24"
153+
"action": "route",
154+
"server": "local"
151155
}
152156
]
153157
}
@@ -354,29 +358,35 @@ Match outbound.
354358

355359
`any` can be used as a value to match any outbound.
356360

357-
#### server
361+
#### action
358362

359363
==Required==
360364

361-
Tag of the target dns server.
365+
See [DNS Rule Actions](../rule_action/) for details.
366+
367+
#### server
368+
369+
!!! failure "Deprecated in sing-box 1.11.0"
370+
371+
Moved to [DNS Rule Action](../rule_action#route).
362372

363373
#### disable_cache
364374

365-
Disable cache and save cache in this query.
375+
!!! failure "Deprecated in sing-box 1.11.0"
366376

367-
#### rewrite_ttl
377+
Moved to [DNS Rule Action](../rule_action#route).
368378

369-
Rewrite TTL in DNS responses.
379+
#### rewrite_ttl
370380

371-
#### client_subnet
381+
!!! failure "Deprecated in sing-box 1.11.0"
372382

373-
!!! question "Since sing-box 1.9.0"
383+
Moved to [DNS Rule Action](../rule_action#route).
374384

375-
Append a `edns0-subnet` OPT extra record with the specified IP prefix to every query by default.
385+
#### client_subnet
376386

377-
If value is an IP address instead of prefix, `/32` or `/128` will be appended automatically.
387+
!!! failure "Deprecated in sing-box 1.11.0"
378388

379-
Will overrides `dns.client_subnet` and `servers.[].client_subnet`.
389+
Moved to [DNS Rule Action](../rule_action#route).
380390

381391
### Address Filter Fields
382392

docs/configuration/dns/rule.zh.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ icon: material/new-box
1414
:material-plus: [geoip](#geoip)
1515
:material-plus: [ip_cidr](#ip_cidr)
1616
:material-plus: [ip_is_private](#ip_is_private)
17-
:material-plus: [client_subnet](#client_subnet)
17+
:material-plus: [client_subnet](#client_subnet)
1818
:material-plus: [rule_set_ipcidr_match_source](#rule_set_ipcidr_match_source)
1919

2020
!!! quote "sing-box 1.8.0 中的更改"
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
icon: material/new-box
3+
---
4+
5+
# DNS Rule Action
6+
7+
!!! question "Since sing-box 1.11.0"
8+
9+
### route
10+
11+
```json
12+
{
13+
"action": "route", // default
14+
"server": "",
15+
16+
// for compatibility
17+
"disable_cache": false,
18+
"rewrite_ttl": 0,
19+
"client_subnet": null
20+
}
21+
```
22+
23+
`route` inherits the classic rule behavior of routing DNS requests to the specified server.
24+
25+
#### server
26+
27+
==Required==
28+
29+
Tag of target server.
30+
31+
#### disable_cache/rewrite_ttl/client_subnet
32+
33+
!!! failure "Deprecated in sing-box 1.11.0"
34+
35+
Legacy route options is deprecated and will be removed in sing-box 1.12.0, check [Migration](/migration/#migrate-legacy-dns-route-options-to-rule-actions).
36+
37+
### route-options
38+
39+
```json
40+
{
41+
"action": "route-options",
42+
"disable_cache": false,
43+
"rewrite_ttl": null,
44+
"client_subnet": null
45+
}
46+
```
47+
48+
#### disable_cache
49+
50+
Disable cache and save cache in this query.
51+
52+
#### rewrite_ttl
53+
54+
Rewrite TTL in DNS responses.
55+
56+
#### client_subnet
57+
58+
Append a `edns0-subnet` OPT extra record with the specified IP prefix to every query by default.
59+
60+
If value is an IP address instead of prefix, `/32` or `/128` will be appended automatically.
61+
62+
Will overrides `dns.client_subnet` and `servers.[].client_subnet`.
63+
64+
### reject
65+
66+
```json
67+
{
68+
"action": "reject",
69+
"method": "default", // default
70+
"no_drop": false
71+
}
72+
```
73+
74+
`reject` reject DNS requests.
75+
76+
#### method
77+
78+
- `default`: Reply with NXDOMAIN.
79+
- `drop`: Drop the request.
80+
81+
#### no_drop
82+
83+
If not enabled, `method` will be temporarily overwritten to `drop` after 50 triggers in 30s.
84+
85+
Not available when `method` is set to drop.
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
icon: material/new-box
3+
---
4+
5+
# DNS 规则动作
6+
7+
!!! question "自 sing-box 1.11.0 起"
8+
9+
### route
10+
11+
```json
12+
{
13+
"action": "route", // 默认
14+
"server": "",
15+
16+
// 兼容性
17+
"disable_cache": false,
18+
"rewrite_ttl": 0,
19+
"client_subnet": null
20+
}
21+
```
22+
23+
`route` 继承了将 DNS 请求 路由到指定服务器的经典规则动作。
24+
25+
#### server
26+
27+
==必填==
28+
29+
目标 DNS 服务器的标签。
30+
31+
#### disable_cache/rewrite_ttl/client_subnet
32+
33+
!!! failure "自 sing-box 1.11.0 起"
34+
35+
旧的路由选项已弃用,且将在 sing-box 1.12.0 中移除,参阅 [迁移指南](/migration/#migrate-legacy-dns-route-options-to-rule-actions).
36+
37+
### route-options
38+
39+
```json
40+
{
41+
"action": "route-options",
42+
"disable_cache": false,
43+
"rewrite_ttl": null,
44+
"client_subnet": null
45+
}
46+
```
47+
48+
49+
#### disable_cache
50+
51+
在此查询中禁用缓存。
52+
53+
#### rewrite_ttl
54+
55+
重写 DNS 回应中的 TTL。
56+
57+
#### client_subnet
58+
59+
默认情况下,将带有指定 IP 前缀的 `edns0-subnet` OPT 附加记录附加到每个查询。
60+
61+
如果值是 IP 地址而不是前缀,则会自动附加 `/32``/128`
62+
63+
将覆盖 `dns.client_subnet``servers.[].client_subnet`
64+
65+
### reject
66+
67+
```json
68+
{
69+
"action": "reject",
70+
"method": "default", // default
71+
"no_drop": false
72+
}
73+
```
74+
75+
`reject` 拒绝 DNS 请求。
76+
77+
#### method
78+
79+
- `default`: 返回 NXDOMAIN。
80+
- `drop`: 丢弃请求。
81+
82+
#### no_drop
83+
84+
如果未启用,则 30 秒内触发 50 次后,`method` 将被暂时覆盖为 `drop`
85+
86+
`method` 设为 `drop` 时不可用。

docs/configuration/outbound/block.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
`block` outbound closes all incoming requests.
1+
---
2+
icon: material/delete-clock
3+
---
4+
5+
!!! failure "Deprecated in sing-box 1.11.0"
6+
7+
Legacy special outbounds are deprecated and will be removed in sing-box 1.13.0, check [Migration](/migration/#migrate-legacy-special-outbounds-to-rule-actions).
28

39
### Structure
410

5-
```json
11+
```json F
612
{
713
"type": "block",
814
"tag": "block"

docs/configuration/outbound/block.zh.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
---
2+
icon: material/delete-clock
3+
---
4+
5+
!!! failure "已在 sing-box 1.11.0 废弃"
6+
7+
旧的特殊出站已被弃用,且将在 sing-box 1.13.0 中被移除,参阅 [迁移指南](/migration/#migrate-legacy-special-outbounds-to-rule-actions).
8+
19
`block` 出站关闭所有传入请求。
210

311
### 结构
@@ -11,4 +19,4 @@
1119

1220
### 字段
1321

14-
无字段。
22+
无字段。

docs/configuration/outbound/dns.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
---
2+
icon: material/delete-clock
3+
---
4+
5+
!!! failure "Deprecated in sing-box 1.11.0"
6+
7+
Legacy special outbounds are deprecated and will be removed in sing-box 1.13.0, check [Migration](/migration/#migrate-legacy-special-outbounds-to-rule-actions).
8+
19
`dns` outbound is a internal DNS server.
210

311
### Structure

docs/configuration/outbound/dns.zh.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
---
2+
icon: material/delete-clock
3+
---
4+
5+
!!! failure "已在 sing-box 1.11.0 废弃"
6+
7+
旧的特殊出站已被弃用,且将在 sing-box 1.13.0 中被移除, 参阅 [迁移指南](/migration/#migrate-legacy-special-outbounds-to-rule-actions).
8+
19
`dns` 出站是一个内部 DNS 服务器。
210

311
### 结构

docs/configuration/route/rule.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
---
2-
icon: material/alert-decagram
2+
icon: material/new-box
33
---
44

5+
!!! quote "Changes in sing-box 1.11.0"
6+
7+
:material-plus: [action](#action)
8+
:material-alert: [outbound](#outbound)
9+
510
!!! quote "Changes in sing-box 1.10.0"
611

712
:material-plus: [client](#client)
@@ -129,13 +134,15 @@ icon: material/alert-decagram
129134
"rule_set_ipcidr_match_source": false,
130135
"rule_set_ip_cidr_match_source": false,
131136
"invert": false,
137+
"action": "route",
132138
"outbound": "direct"
133139
},
134140
{
135141
"type": "logical",
136142
"mode": "and",
137143
"rules": [],
138144
"invert": false,
145+
"action": "route",
139146
"outbound": "direct"
140147
}
141148
]
@@ -357,11 +364,17 @@ Make `ip_cidr` in rule-sets match the source IP.
357364

358365
Invert match result.
359366

360-
#### outbound
367+
#### action
361368

362369
==Required==
363370

364-
Tag of the target outbound.
371+
See [Rule Actions](../rule_action/) for details.
372+
373+
#### outbound
374+
375+
!!! failure "Deprecated in sing-box 1.11.0"
376+
377+
Moved to [Rule Action](../rule_action#route).
365378

366379
### Logical Fields
367380

0 commit comments

Comments
 (0)