-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
348cb1c
commit b169074
Showing
22 changed files
with
1,076 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
--- | ||
icon: material/new-box | ||
--- | ||
|
||
# DNS Rule Action | ||
|
||
!!! question "Since sing-box 1.11.0" | ||
|
||
### route | ||
|
||
```json | ||
{ | ||
"action": "route", // default | ||
"server": "", | ||
|
||
// for compatibility | ||
"disable_cache": false, | ||
"rewrite_ttl": 0, | ||
"client_subnet": null | ||
} | ||
``` | ||
|
||
`route` inherits the classic rule behavior of routing DNS requests to the specified server. | ||
|
||
#### server | ||
|
||
==Required== | ||
|
||
Tag of target server. | ||
|
||
#### disable_cache/rewrite_ttl/client_subnet | ||
|
||
!!! failure "Deprecated in sing-box 1.11.0" | ||
|
||
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). | ||
|
||
### route-options | ||
|
||
```json | ||
{ | ||
"action": "route-options", | ||
"disable_cache": false, | ||
"rewrite_ttl": null, | ||
"client_subnet": null | ||
} | ||
``` | ||
|
||
#### disable_cache | ||
|
||
Disable cache and save cache in this query. | ||
|
||
#### rewrite_ttl | ||
|
||
Rewrite TTL in DNS responses. | ||
|
||
#### client_subnet | ||
|
||
Append a `edns0-subnet` OPT extra record with the specified IP prefix to every query by default. | ||
|
||
If value is an IP address instead of prefix, `/32` or `/128` will be appended automatically. | ||
|
||
Will overrides `dns.client_subnet` and `servers.[].client_subnet`. | ||
|
||
### reject | ||
|
||
```json | ||
{ | ||
"action": "reject", | ||
"method": "default", // default | ||
"no_drop": false | ||
} | ||
``` | ||
|
||
`reject` reject DNS requests. | ||
|
||
#### method | ||
|
||
- `default`: Reply with NXDOMAIN. | ||
- `drop`: Drop the request. | ||
|
||
#### no_drop | ||
|
||
If not enabled, `method` will be temporarily overwritten to `drop` after 50 triggers in 30s. | ||
|
||
Not available when `method` is set to drop. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
--- | ||
icon: material/new-box | ||
--- | ||
|
||
# DNS 规则动作 | ||
|
||
!!! question "自 sing-box 1.11.0 起" | ||
|
||
### route | ||
|
||
```json | ||
{ | ||
"action": "route", // 默认 | ||
"server": "", | ||
|
||
// 兼容性 | ||
"disable_cache": false, | ||
"rewrite_ttl": 0, | ||
"client_subnet": null | ||
} | ||
``` | ||
|
||
`route` 继承了将 DNS 请求 路由到指定服务器的经典规则动作。 | ||
|
||
#### server | ||
|
||
==必填== | ||
|
||
目标 DNS 服务器的标签。 | ||
|
||
#### disable_cache/rewrite_ttl/client_subnet | ||
|
||
!!! failure "自 sing-box 1.11.0 起" | ||
|
||
旧的路由选项已弃用,且将在 sing-box 1.12.0 中移除,参阅 [迁移指南](/migration/#migrate-legacy-dns-route-options-to-rule-actions). | ||
|
||
### route-options | ||
|
||
```json | ||
{ | ||
"action": "route-options", | ||
"disable_cache": false, | ||
"rewrite_ttl": null, | ||
"client_subnet": null | ||
} | ||
``` | ||
|
||
|
||
#### disable_cache | ||
|
||
在此查询中禁用缓存。 | ||
|
||
#### rewrite_ttl | ||
|
||
重写 DNS 回应中的 TTL。 | ||
|
||
#### client_subnet | ||
|
||
默认情况下,将带有指定 IP 前缀的 `edns0-subnet` OPT 附加记录附加到每个查询。 | ||
|
||
如果值是 IP 地址而不是前缀,则会自动附加 `/32` 或 `/128`。 | ||
|
||
将覆盖 `dns.client_subnet` 与 `servers.[].client_subnet`。 | ||
|
||
### reject | ||
|
||
```json | ||
{ | ||
"action": "reject", | ||
"method": "default", // default | ||
"no_drop": false | ||
} | ||
``` | ||
|
||
`reject` 拒绝 DNS 请求。 | ||
|
||
#### method | ||
|
||
- `default`: 返回 NXDOMAIN。 | ||
- `drop`: 丢弃请求。 | ||
|
||
#### no_drop | ||
|
||
如果未启用,则 30 秒内触发 50 次后,`method` 将被暂时覆盖为 `drop`。 | ||
|
||
当 `method` 设为 `drop` 时不可用。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.