dns: Add timeout configuration

This commit is contained in:
世界 2026-04-28 14:29:52 +08:00
parent 60a5f874e2
commit 1bad8d87eb
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
18 changed files with 141 additions and 10 deletions

View file

@ -5,7 +5,8 @@ icon: material/alert-decagram
!!! quote "Changes in sing-box 1.14.0"
:material-delete-clock: [independent_cache](#independent_cache)
:material-plus: [optimistic](#optimistic)
:material-plus: [optimistic](#optimistic)
:material-plus: [timeout](#timeout)
!!! quote "Changes in sing-box 1.12.0"
@ -31,6 +32,7 @@ icon: material/alert-decagram
"independent_cache": false,
"cache_capacity": 0,
"optimistic": false, // or {}
"timeout": "",
"reverse_mapping": false,
"client_subnet": "",
"fakeip": {}
@ -115,6 +117,16 @@ The maximum time an expired cache entry can be served optimistically.
`3d` is used by default.
#### timeout
!!! question "Since sing-box 1.14.0"
Default timeout for each DNS query.
`10s` is used by default.
Can be overridden by `rules.[].timeout` (DNS rule action) or `domain_resolver.timeout`.
#### reverse_mapping
Stores a reverse mapping of IP addresses after responding to a DNS query in order to provide domain names when routing.

View file

@ -5,7 +5,8 @@ icon: material/alert-decagram
!!! quote "sing-box 1.14.0 中的更改"
:material-delete-clock: [independent_cache](#independent_cache)
:material-plus: [optimistic](#optimistic)
:material-plus: [optimistic](#optimistic)
:material-plus: [timeout](#timeout)
!!! quote "sing-box 1.12.0 中的更改"
@ -31,6 +32,7 @@ icon: material/alert-decagram
"independent_cache": false,
"cache_capacity": 0,
"optimistic": false, // or {}
"timeout": "",
"reverse_mapping": false,
"client_subnet": "",
"fakeip": {}
@ -114,6 +116,16 @@ LRU 缓存容量。
默认使用 `3d`
#### timeout
!!! question "自 sing-box 1.14.0 起"
每次 DNS 查询的默认超时时间。
默认使用 `10s`
可被 `rules.[].timeout`DNS 规则动作)或 `domain_resolver.timeout` 覆盖。
#### reverse_mapping
在响应 DNS 查询后存储 IP 地址的反向映射以为路由目的提供域名。

View file

@ -7,7 +7,8 @@ icon: material/new-box
:material-delete-clock: [strategy](#strategy)
:material-plus: [evaluate](#evaluate)
:material-plus: [respond](#respond)
:material-plus: [disable_optimistic_cache](#disable_optimistic_cache)
:material-plus: [disable_optimistic_cache](#disable_optimistic_cache)
:material-plus: [timeout](#timeout)
!!! quote "Changes in sing-box 1.12.0"
@ -26,6 +27,7 @@ icon: material/new-box
"disable_cache": false,
"disable_optimistic_cache": false,
"rewrite_ttl": null,
"timeout": "",
"client_subnet": null
}
```
@ -64,6 +66,14 @@ Disable optimistic DNS caching in this query.
Rewrite TTL in DNS responses.
#### timeout
!!! question "Since sing-box 1.14.0"
Override the DNS query timeout for matched queries.
Will override `dns.timeout`.
#### client_subnet
Append a `edns0-subnet` OPT extra record with the specified IP prefix to every query by default.
@ -83,6 +93,7 @@ Will override `dns.client_subnet`.
"disable_cache": false,
"disable_optimistic_cache": false,
"rewrite_ttl": null,
"timeout": "",
"client_subnet": null
}
```
@ -116,6 +127,14 @@ Disable optimistic DNS caching in this query.
Rewrite TTL in DNS responses.
#### timeout
!!! question "Since sing-box 1.14.0"
Override the DNS query timeout for matched queries.
Will override `dns.timeout`.
#### client_subnet
Append a `edns0-subnet` OPT extra record with the specified IP prefix to every query by default.
@ -148,6 +167,7 @@ Only allowed after a preceding top-level `evaluate` rule. If the action is reach
"disable_cache": false,
"disable_optimistic_cache": false,
"rewrite_ttl": null,
"timeout": "",
"client_subnet": null
}
```

View file

@ -7,7 +7,8 @@ icon: material/new-box
:material-delete-clock: [strategy](#strategy)
:material-plus: [evaluate](#evaluate)
:material-plus: [respond](#respond)
:material-plus: [disable_optimistic_cache](#disable_optimistic_cache)
:material-plus: [disable_optimistic_cache](#disable_optimistic_cache)
:material-plus: [timeout](#timeout)
!!! quote "sing-box 1.12.0 中的更改"
@ -26,6 +27,7 @@ icon: material/new-box
"disable_cache": false,
"disable_optimistic_cache": false,
"rewrite_ttl": null,
"timeout": "",
"client_subnet": null
}
```
@ -64,6 +66,14 @@ icon: material/new-box
重写 DNS 回应中的 TTL。
#### timeout
!!! question "自 sing-box 1.14.0 起"
覆盖匹配查询的 DNS 查询超时时间。
将覆盖 `dns.timeout`
#### client_subnet
默认情况下,将带有指定 IP 前缀的 `edns0-subnet` OPT 附加记录附加到每个查询。
@ -83,6 +93,7 @@ icon: material/new-box
"disable_cache": false,
"disable_optimistic_cache": false,
"rewrite_ttl": null,
"timeout": "",
"client_subnet": null
}
```
@ -114,6 +125,14 @@ icon: material/new-box
重写 DNS 回应中的 TTL。
#### timeout
!!! question "自 sing-box 1.14.0 起"
覆盖匹配查询的 DNS 查询超时时间。
将覆盖 `dns.timeout`
#### client_subnet
默认情况下,将带有指定 IP 前缀的 `edns0-subnet` OPT 附加记录附加到每个查询。
@ -146,6 +165,7 @@ icon: material/new-box
"disable_cache": false,
"disable_optimistic_cache": false,
"rewrite_ttl": null,
"timeout": "",
"client_subnet": null
}
```

View file

@ -9,7 +9,8 @@ icon: material/new-box
!!! quote "Changes in sing-box 1.14.0"
:material-plus: [resolve.disable_optimistic_cache](#disable_optimistic_cache)
:material-plus: [resolve.disable_optimistic_cache](#disable_optimistic_cache)
:material-plus: [resolve.timeout](#timeout)
!!! quote "Changes in sing-box 1.12.0"
@ -285,6 +286,7 @@ Timeout for sniffing.
"disable_cache": false,
"disable_optimistic_cache": false,
"rewrite_ttl": null,
"timeout": "",
"client_subnet": null
}
```
@ -319,6 +321,14 @@ Disable optimistic DNS caching in this query.
Rewrite TTL in DNS responses.
#### timeout
!!! question "Since sing-box 1.14.0"
Override the DNS query timeout for this lookup.
Will override `dns.timeout`.
#### client_subnet
!!! question "Since sing-box 1.12.0"

View file

@ -9,7 +9,8 @@ icon: material/new-box
!!! quote "sing-box 1.14.0 中的更改"
:material-plus: [resolve.disable_optimistic_cache](#disable_optimistic_cache)
:material-plus: [resolve.disable_optimistic_cache](#disable_optimistic_cache)
:material-plus: [resolve.timeout](#timeout)
!!! quote "sing-box 1.12.0 中的更改"
@ -277,6 +278,7 @@ UDP 连接超时时间。
"disable_cache": false,
"disable_optimistic_cache": false,
"rewrite_ttl": null,
"timeout": "",
"client_subnet": null
}
```
@ -311,6 +313,14 @@ DNS 解析策略,可用值有:`prefer_ipv4`、`prefer_ipv6`、`ipv4_only`、
重写 DNS 回应中的 TTL。
#### timeout
!!! question "自 sing-box 1.14.0 起"
覆盖此查询的 DNS 查询超时时间。
将覆盖 `dns.timeout`
#### client_subnet
!!! question "自 sing-box 1.12.0 起"

View file

@ -2,6 +2,10 @@
icon: material/new-box
---
!!! quote "Changes in sing-box 1.14.0"
:material-alert: [domain_resolver](#domain_resolver)
!!! quote "Changes in sing-box 1.13.0"
:material-plus: [disable_tcp_keep_alive](#disable_tcp_keep_alive)

View file

@ -2,6 +2,10 @@
icon: material/new-box
---
!!! quote "sing-box 1.14.0 中的更改"
:material-alert: [domain_resolver](#domain_resolver)
!!! quote "sing-box 1.13.0 中的更改"
:material-plus: [disable_tcp_keep_alive](#disable_tcp_keep_alive)