mirror of
https://github.com/SagerNet/sing-box.git
synced 2026-04-11 17:47:20 +10:00
Replace internal terminology in docs and error messages
Remove all user-facing references to the internal `legacyDNSMode` variable
name. Error messages now reuse the deprecated.Note.MessageWithLink() method
to provide consistent deprecation text with migration URLs. Other internal
jargon ("consume response state", "response_*") is replaced with
user-friendly descriptions.
Add two migration guide entries under 1.14.0: one for strategy → rule items,
one for address filter fields → evaluate with match_response.
This commit is contained in:
@@ -964,7 +964,7 @@ func resolveLegacyDNSMode(router adapter.Router, rules []option.DNSRule) (bool,
|
||||
return false, flags, err
|
||||
}
|
||||
if flags.disabled && flags.neededFromStrategy {
|
||||
return false, flags, E.New("DNS rule action strategy is only supported in legacyDNSMode")
|
||||
return false, flags, E.New(deprecated.OptionLegacyDNSRuleStrategy.MessageWithLink())
|
||||
}
|
||||
if flags.disabled {
|
||||
return false, flags, nil
|
||||
@@ -1069,7 +1069,7 @@ func validateLegacyDNSModeDisabledRules(rules []option.DNSRule) error {
|
||||
}
|
||||
action := dnsRuleActionType(rule)
|
||||
if action == C.RuleActionTypeEvaluate && consumesResponse {
|
||||
return E.New("dns rule[", i, "]: evaluate rule cannot consume response state")
|
||||
return E.New("dns rule[", i, "]: evaluate action cannot be used with match_response in the same rule")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@@ -1097,10 +1097,10 @@ func validateLegacyDNSModeDisabledRuleTree(rule option.DNSRule) (bool, error) {
|
||||
func validateLegacyDNSModeDisabledDefaultRule(rule option.DefaultDNSRule) (bool, error) {
|
||||
hasResponseRecords := hasResponseMatchFields(rule)
|
||||
if hasResponseRecords && !rule.MatchResponse {
|
||||
return false, E.New("response_* items require match_response")
|
||||
return false, E.New("Response Match Fields (response_rcode, response_answer, response_ns, response_extra) require match_response to be enabled")
|
||||
}
|
||||
if (len(rule.IPCIDR) > 0 || rule.IPIsPrivate) && !rule.MatchResponse {
|
||||
return false, E.New("ip_cidr and ip_is_private require match_response when legacyDNSMode is disabled")
|
||||
return false, E.New(deprecated.OptionLegacyDNSAddressFilter.MessageWithLink())
|
||||
}
|
||||
// Intentionally do not reject rule_set here. A referenced rule set may mix
|
||||
// destination-IP predicates with pre-response predicates such as domain items.
|
||||
@@ -1108,10 +1108,10 @@ func validateLegacyDNSModeDisabledDefaultRule(rule option.DefaultDNSRule) (bool,
|
||||
// pre-response evaluation instead of consuming DNS response state, while sibling
|
||||
// non-response branches remain matchable.
|
||||
if rule.IPAcceptAny { //nolint:staticcheck
|
||||
return false, E.New("ip_accept_any is removed when legacyDNSMode is disabled, use ip_cidr with match_response")
|
||||
return false, E.New(deprecated.OptionIPAcceptAny.MessageWithLink())
|
||||
}
|
||||
if rule.RuleSetIPCIDRAcceptEmpty { //nolint:staticcheck
|
||||
return false, E.New("rule_set_ip_cidr_accept_empty is removed when legacyDNSMode is disabled")
|
||||
return false, E.New(deprecated.OptionRuleSetIPCIDRAcceptEmpty.MessageWithLink())
|
||||
}
|
||||
return rule.MatchResponse, nil
|
||||
}
|
||||
|
||||
@@ -383,7 +383,8 @@ func TestInitializeRejectsDirectLegacyRuleWhenRuleSetForcesNew(t *testing.T) {
|
||||
},
|
||||
},
|
||||
})
|
||||
require.ErrorContains(t, err, "ip_cidr and ip_is_private require match_response")
|
||||
require.ErrorContains(t, err, "Address Filter Fields")
|
||||
require.ErrorContains(t, err, "deprecated")
|
||||
}
|
||||
|
||||
func TestLookupLegacyDNSModeDefersRuleSetDestinationIPMatch(t *testing.T) {
|
||||
@@ -602,7 +603,7 @@ func TestRuleSetUpdateKeepsLastSuccessfullyCompiledRuleGraphWhenRebuildFails(t *
|
||||
ContainsDNSQueryTypeRule: true,
|
||||
})
|
||||
rebuildErrorEntry := waitForLogMessageContaining(t, logEntries, logDone, "rebuild DNS rules after rule-set update")
|
||||
require.Contains(t, rebuildErrorEntry.Message, "ip_cidr and ip_is_private require match_response")
|
||||
require.Contains(t, rebuildErrorEntry.Message, "Address Filter Fields")
|
||||
require.True(t, router.currentRules.Load().legacyDNSMode)
|
||||
require.Equal(t, 1, callbackRuleSet.refCount())
|
||||
require.Zero(t, rebuildTargetRuleSet.refCount())
|
||||
@@ -2128,7 +2129,8 @@ func TestInitializeRejectsDNSRuleStrategyWhenLegacyDNSModeIsDisabledByEvaluate(t
|
||||
},
|
||||
},
|
||||
}})
|
||||
require.ErrorContains(t, err, "legacyDNSMode")
|
||||
require.ErrorContains(t, err, "strategy")
|
||||
require.ErrorContains(t, err, "deprecated")
|
||||
}
|
||||
|
||||
func TestInitializeRejectsDNSRuleStrategyWhenLegacyDNSModeIsDisabledByMatchResponse(t *testing.T) {
|
||||
@@ -2157,7 +2159,8 @@ func TestInitializeRejectsDNSRuleStrategyWhenLegacyDNSModeIsDisabledByMatchRespo
|
||||
},
|
||||
},
|
||||
}})
|
||||
require.ErrorContains(t, err, "legacyDNSMode")
|
||||
require.ErrorContains(t, err, "strategy")
|
||||
require.ErrorContains(t, err, "deprecated")
|
||||
}
|
||||
|
||||
func TestLookupLegacyDNSModeDisabledReturnsRejectedErrorForRejectAction(t *testing.T) {
|
||||
|
||||
@@ -497,8 +497,8 @@ Enable response-based matching. When enabled, this rule matches against DNS resp
|
||||
(set by a preceding [`evaluate`](/configuration/dns/rule_action/#evaluate) action)
|
||||
instead of only matching the original query.
|
||||
|
||||
Required for `response_rcode`, `response_answer`, `response_ns`, `response_extra` fields.
|
||||
Also required for `ip_cidr` and `ip_is_private` when `legacyDNSMode` is disabled.
|
||||
Required for Response Match Fields (`response_rcode`, `response_answer`, `response_ns`, `response_extra`).
|
||||
Also required for `ip_cidr` and `ip_is_private` when used with `evaluate` or Response Match Fields.
|
||||
|
||||
#### invert
|
||||
|
||||
@@ -544,17 +544,13 @@ See [DNS Rule Actions](../rule_action/) for details.
|
||||
|
||||
Moved to [DNS Rule Action](../rule_action#route).
|
||||
|
||||
### Legacy DNS Mode
|
||||
|
||||
`legacyDNSMode` is an internal compatibility mode that is automatically detected from your DNS rule
|
||||
configuration. It is disabled when any rule uses features introduced in sing-box 1.14.0 such as
|
||||
`evaluate`, `match_response`, response fields (`response_rcode`, `response_answer`, etc.),
|
||||
`query_type`, or `ip_version`. When disabled, `ip_cidr` and `ip_is_private` require `match_response`
|
||||
to be set, and deprecated fields like `strategy`, `ip_accept_any`, and `rule_set_ip_cidr_accept_empty`
|
||||
are no longer accepted.
|
||||
|
||||
### Address Filter Fields
|
||||
|
||||
!!! failure "Deprecated in sing-box 1.14.0"
|
||||
|
||||
Address Filter Fields are deprecated and will be removed in sing-box 1.16.0,
|
||||
check [Migration](/migration/#migrate-address-filter-fields-to-response-matching).
|
||||
|
||||
Only takes effect for address requests (A/AAAA/HTTPS). When the query results do not match the address filtering rule items, the current rule will be skipped.
|
||||
|
||||
!!! info ""
|
||||
@@ -579,7 +575,8 @@ Match GeoIP with query response.
|
||||
|
||||
Match IP CIDR with query response.
|
||||
|
||||
When `legacyDNSMode` is disabled, `match_response` must be set to `true`.
|
||||
As an Address Filter Field, deprecated. Use with `match_response` instead,
|
||||
check [Migration](/migration/#migrate-address-filter-fields-to-response-matching).
|
||||
|
||||
#### ip_is_private
|
||||
|
||||
@@ -587,7 +584,8 @@ When `legacyDNSMode` is disabled, `match_response` must be set to `true`.
|
||||
|
||||
Match private IP with query response.
|
||||
|
||||
When `legacyDNSMode` is disabled, `match_response` must be set to `true`.
|
||||
As an Address Filter Field, deprecated. Use with `match_response` instead,
|
||||
check [Migration](/migration/#migrate-address-filter-fields-to-response-matching).
|
||||
|
||||
#### rule_set_ip_cidr_accept_empty
|
||||
|
||||
@@ -595,8 +593,8 @@ When `legacyDNSMode` is disabled, `match_response` must be set to `true`.
|
||||
|
||||
!!! failure "Deprecated in sing-box 1.14.0"
|
||||
|
||||
`rule_set_ip_cidr_accept_empty` is deprecated and will be removed in sing-box 1.16.0.
|
||||
Only supported in `legacyDNSMode`.
|
||||
`rule_set_ip_cidr_accept_empty` is deprecated and will be removed in sing-box 1.16.0,
|
||||
check [Migration](/migration/#migrate-address-filter-fields-to-response-matching).
|
||||
|
||||
Make `ip_cidr` rules in rule-sets accept empty query response.
|
||||
|
||||
@@ -606,8 +604,8 @@ Make `ip_cidr` rules in rule-sets accept empty query response.
|
||||
|
||||
!!! failure "Deprecated in sing-box 1.14.0"
|
||||
|
||||
`ip_accept_any` is deprecated and will be removed in sing-box 1.16.0.
|
||||
Only supported in `legacyDNSMode`. Use `match_response` with response items instead.
|
||||
`ip_accept_any` is deprecated and will be removed in sing-box 1.16.0,
|
||||
check [Migration](/migration/#migrate-address-filter-fields-to-response-matching).
|
||||
|
||||
Match any IP with query response.
|
||||
|
||||
|
||||
@@ -495,8 +495,8 @@ Available values: `wifi`, `cellular`, `ethernet` and `other`.
|
||||
|
||||
启用响应匹配。启用后,此规则将匹配 DNS 响应数据(由前序 [`evaluate`](/zh/configuration/dns/rule_action/#evaluate) 动作设置),而不仅是匹配原始查询。
|
||||
|
||||
`response_rcode`、`response_answer`、`response_ns`、`response_extra` 字段需要此选项。
|
||||
当 `legacyDNSMode` 未启用时,`ip_cidr` 和 `ip_is_private` 也需要此选项。
|
||||
响应匹配字段(`response_rcode`、`response_answer`、`response_ns`、`response_extra`)需要此选项。
|
||||
当与 `evaluate` 或响应匹配字段一起使用时,`ip_cidr` 和 `ip_is_private` 也需要此选项。
|
||||
|
||||
#### invert
|
||||
|
||||
@@ -542,16 +542,13 @@ Available values: `wifi`, `cellular`, `ethernet` and `other`.
|
||||
|
||||
已移动到 [DNS 规则动作](../rule_action#route).
|
||||
|
||||
### Legacy DNS Mode
|
||||
|
||||
`legacyDNSMode` 是一种内部兼容模式,会根据 DNS 规则配置自动检测。
|
||||
当任何规则使用了 sing-box 1.14.0 引入的特性(如 `evaluate`、`match_response`、
|
||||
响应字段(`response_rcode`、`response_answer` 等)、`query_type` 或 `ip_version`)时,
|
||||
该模式将被自动禁用。禁用后,`ip_cidr` 和 `ip_is_private` 需要设置 `match_response`,
|
||||
且已废弃的字段(如 `strategy`、`ip_accept_any`、`rule_set_ip_cidr_accept_empty`)将不再被接受。
|
||||
|
||||
### 地址筛选字段
|
||||
|
||||
!!! failure "已在 sing-box 1.14.0 废弃"
|
||||
|
||||
地址筛选字段已废弃,且将在 sing-box 1.16.0 中被移除,
|
||||
参阅[迁移指南](/zh/migration/#迁移地址筛选字段到响应匹配)。
|
||||
|
||||
仅对地址请求 (A/AAAA/HTTPS) 生效。 当查询结果与地址筛选规则项不匹配时,将跳过当前规则。
|
||||
|
||||
!!! info ""
|
||||
@@ -577,7 +574,8 @@ Available values: `wifi`, `cellular`, `ethernet` and `other`.
|
||||
|
||||
与查询响应匹配 IP CIDR。
|
||||
|
||||
当 `legacyDNSMode` 未启用时,`match_response` 必须设为 `true`。
|
||||
作为地址筛选字段已废弃。请改为配合 `match_response` 使用,
|
||||
参阅[迁移指南](/zh/migration/#迁移地址筛选字段到响应匹配)。
|
||||
|
||||
#### ip_is_private
|
||||
|
||||
@@ -585,7 +583,8 @@ Available values: `wifi`, `cellular`, `ethernet` and `other`.
|
||||
|
||||
与查询响应匹配非公开 IP。
|
||||
|
||||
当 `legacyDNSMode` 未启用时,`match_response` 必须设为 `true`。
|
||||
作为地址筛选字段已废弃。请改为配合 `match_response` 使用,
|
||||
参阅[迁移指南](/zh/migration/#迁移地址筛选字段到响应匹配)。
|
||||
|
||||
#### rule_set_ip_cidr_accept_empty
|
||||
|
||||
@@ -593,8 +592,8 @@ Available values: `wifi`, `cellular`, `ethernet` and `other`.
|
||||
|
||||
!!! failure "已在 sing-box 1.14.0 废弃"
|
||||
|
||||
`rule_set_ip_cidr_accept_empty` 已废弃且将在 sing-box 1.16.0 中被移除。
|
||||
仅在 `legacyDNSMode` 中可用。
|
||||
`rule_set_ip_cidr_accept_empty` 已废弃且将在 sing-box 1.16.0 中被移除,
|
||||
参阅[迁移指南](/zh/migration/#迁移地址筛选字段到响应匹配)。
|
||||
|
||||
使规则集中的 `ip_cidr` 规则接受空查询响应。
|
||||
|
||||
@@ -604,8 +603,8 @@ Available values: `wifi`, `cellular`, `ethernet` and `other`.
|
||||
|
||||
!!! failure "已在 sing-box 1.14.0 废弃"
|
||||
|
||||
`ip_accept_any` 已废弃且将在 sing-box 1.16.0 中被移除。
|
||||
仅在 `legacyDNSMode` 中可用。请使用 `match_response` 和响应项替代。
|
||||
`ip_accept_any` 已废弃且将在 sing-box 1.16.0 中被移除,
|
||||
参阅[迁移指南](/zh/migration/#迁移地址筛选字段到响应匹配)。
|
||||
|
||||
匹配任意 IP。
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ Tag of target server.
|
||||
|
||||
`strategy` is deprecated in sing-box 1.14.0 and will be removed in sing-box 1.16.0.
|
||||
|
||||
Set domain strategy for this query. Only supported when `legacyDNSMode` is active.
|
||||
Set domain strategy for this query. Deprecated, check [Migration](/migration/#migrate-dns-rule-action-strategy-to-rule-items).
|
||||
|
||||
One of `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`.
|
||||
|
||||
@@ -82,6 +82,8 @@ to match against using [`match_response`](/configuration/dns/rule/#match_respons
|
||||
Unlike `route`, it does **not** terminate rule evaluation.
|
||||
|
||||
Only allowed on top-level DNS rules (not inside logical sub-rules).
|
||||
The rule itself must not use `match_response` or contain sub-rules with Response Match Fields,
|
||||
since `evaluate` populates the response for subsequent rules to consume.
|
||||
|
||||
#### server
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ icon: material/new-box
|
||||
|
||||
`strategy` 已在 sing-box 1.14.0 废弃,且将在 sing-box 1.16.0 中被移除。
|
||||
|
||||
为此查询设置域名策略。仅在 `legacyDNSMode` 启用时可用。
|
||||
为此查询设置域名策略。已废弃,参阅[迁移指南](/zh/migration/#迁移-dns-规则动作-strategy-到规则项)。
|
||||
|
||||
可选项:`prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`。
|
||||
|
||||
@@ -80,6 +80,8 @@ icon: material/new-box
|
||||
`evaluate` 向指定服务器发送 DNS 查询并保存响应,供后续规则通过 [`match_response`](/zh/configuration/dns/rule/#match_response) 和响应字段进行匹配。与 `route` 不同,它**不会**终止规则评估。
|
||||
|
||||
仅允许在顶层 DNS 规则中使用(不可在逻辑子规则内部使用)。
|
||||
该规则本身不可使用 `match_response` 或包含带有响应匹配字段的子规则,
|
||||
因为 `evaluate` 是为后续规则填充响应数据。
|
||||
|
||||
#### server
|
||||
|
||||
|
||||
@@ -16,31 +16,30 @@ Old fields will be removed in sing-box 1.16.0.
|
||||
|
||||
#### `strategy` in DNS rule actions
|
||||
|
||||
`strategy` in DNS rule actions is deprecated
|
||||
and only supported in `legacyDNSMode`.
|
||||
`strategy` in DNS rule actions is deprecated,
|
||||
check [Migration](../migration/#migrate-dns-rule-action-strategy-to-rule-items).
|
||||
|
||||
Old fields will be removed in sing-box 1.16.0.
|
||||
|
||||
#### `ip_accept_any` in DNS rules
|
||||
|
||||
`ip_accept_any` in DNS rules is deprecated
|
||||
and only supported in `legacyDNSMode`.
|
||||
Use `match_response` with response items instead.
|
||||
`ip_accept_any` in DNS rules is deprecated,
|
||||
check [Migration](../migration/#migrate-address-filter-fields-to-response-matching).
|
||||
|
||||
Old fields will be removed in sing-box 1.16.0.
|
||||
|
||||
#### `rule_set_ip_cidr_accept_empty` in DNS rules
|
||||
|
||||
`rule_set_ip_cidr_accept_empty` in DNS rules is deprecated
|
||||
and only supported in `legacyDNSMode`.
|
||||
`rule_set_ip_cidr_accept_empty` in DNS rules is deprecated,
|
||||
check [Migration](../migration/#migrate-address-filter-fields-to-response-matching).
|
||||
|
||||
Old fields will be removed in sing-box 1.16.0.
|
||||
|
||||
#### Legacy address filter DNS rule items
|
||||
#### Address Filter Fields in DNS rules
|
||||
|
||||
Legacy address filter DNS rule items (`ip_cidr`, `ip_is_private` without `match_response`)
|
||||
are deprecated and only supported in `legacyDNSMode`.
|
||||
Use `match_response` with the `evaluate` action instead.
|
||||
Address Filter Fields (`ip_cidr`, `ip_is_private` without `match_response`)
|
||||
are deprecated,
|
||||
check [Migration](../migration/#migrate-address-filter-fields-to-response-matching).
|
||||
|
||||
Old behavior will be removed in sing-box 1.16.0.
|
||||
|
||||
|
||||
@@ -17,30 +17,28 @@ TLS 中的内联 ACME 选项(`tls.acme`)已废弃,
|
||||
#### DNS 规则动作中的 `strategy`
|
||||
|
||||
DNS 规则动作中的 `strategy` 已废弃,
|
||||
且仅在 `legacyDNSMode` 中可用。
|
||||
参阅[迁移指南](/zh/migration/#迁移-dns-规则动作-strategy-到规则项)。
|
||||
|
||||
旧字段将在 sing-box 1.16.0 中被移除。
|
||||
|
||||
#### DNS 规则中的 `ip_accept_any`
|
||||
|
||||
DNS 规则中的 `ip_accept_any` 已废弃,
|
||||
且仅在 `legacyDNSMode` 中可用。
|
||||
请使用 `match_response` 和响应项替代。
|
||||
参阅[迁移指南](/zh/migration/#迁移地址筛选字段到响应匹配)。
|
||||
|
||||
旧字段将在 sing-box 1.16.0 中被移除。
|
||||
|
||||
#### DNS 规则中的 `rule_set_ip_cidr_accept_empty`
|
||||
|
||||
DNS 规则中的 `rule_set_ip_cidr_accept_empty` 已废弃,
|
||||
且仅在 `legacyDNSMode` 中可用。
|
||||
参阅[迁移指南](/zh/migration/#迁移地址筛选字段到响应匹配)。
|
||||
|
||||
旧字段将在 sing-box 1.16.0 中被移除。
|
||||
|
||||
#### 旧的地址筛选 DNS 规则项
|
||||
#### 地址筛选 DNS 规则项
|
||||
|
||||
旧的地址筛选 DNS 规则项(不使用 `match_response` 的 `ip_cidr`、`ip_is_private`)已废弃,
|
||||
且仅在 `legacyDNSMode` 中可用。
|
||||
请使用 `match_response` 和 `evaluate` 动作替代。
|
||||
地址筛选 DNS 规则项(不使用 `match_response` 的 `ip_cidr`、`ip_is_private`)已废弃,
|
||||
参阅[迁移指南](/zh/migration/#迁移地址筛选字段到响应匹配)。
|
||||
|
||||
旧行为将在 sing-box 1.16.0 中被移除。
|
||||
|
||||
|
||||
@@ -79,6 +79,111 @@ See [ACME](/configuration/shared/certificate-provider/acme/) for fields newly ad
|
||||
}
|
||||
```
|
||||
|
||||
### Migrate DNS rule action strategy to rule items
|
||||
|
||||
`strategy` in DNS rule actions is deprecated.
|
||||
|
||||
In sing-box 1.14.0, internal domain resolution (Lookup) now splits A and AAAA queries
|
||||
at the rule level, so each query type is evaluated independently through the full rule chain.
|
||||
Use `ip_version` or `query_type` rule items to control which query types a rule matches.
|
||||
|
||||
!!! info "References"
|
||||
|
||||
[DNS Rule](/configuration/dns/rule/) /
|
||||
[DNS Rule Action](/configuration/dns/rule_action/)
|
||||
|
||||
=== ":material-card-remove: Deprecated"
|
||||
|
||||
```json
|
||||
{
|
||||
"dns": {
|
||||
"rules": [
|
||||
{
|
||||
"domain_suffix": ".cn",
|
||||
"action": "route",
|
||||
"server": "local",
|
||||
"strategy": "ipv4_only"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
=== ":material-card-multiple: New"
|
||||
|
||||
```json
|
||||
{
|
||||
"dns": {
|
||||
"rules": [
|
||||
{
|
||||
"domain_suffix": ".cn",
|
||||
"ip_version": 4,
|
||||
"action": "route",
|
||||
"server": "local"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Migrate address filter fields to response matching
|
||||
|
||||
Address Filter Fields (`ip_cidr`, `ip_is_private` without `match_response`) are deprecated,
|
||||
along with `ip_accept_any` and `rule_set_ip_cidr_accept_empty`.
|
||||
|
||||
In sing-box 1.14.0, use the [`evaluate`](/configuration/dns/rule_action/#evaluate) action
|
||||
to fetch a DNS response, then match against it explicitly with `match_response`.
|
||||
|
||||
!!! info "References"
|
||||
|
||||
[DNS Rule](/configuration/dns/rule/) /
|
||||
[DNS Rule Action](/configuration/dns/rule_action/#evaluate)
|
||||
|
||||
=== ":material-card-remove: Deprecated"
|
||||
|
||||
```json
|
||||
{
|
||||
"dns": {
|
||||
"rules": [
|
||||
{
|
||||
"rule_set": "geoip-cn",
|
||||
"action": "route",
|
||||
"server": "local"
|
||||
},
|
||||
{
|
||||
"action": "route",
|
||||
"server": "remote"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
=== ":material-card-multiple: New"
|
||||
|
||||
```json
|
||||
{
|
||||
"dns": {
|
||||
"rules": [
|
||||
{
|
||||
"action": "evaluate",
|
||||
"server": "remote"
|
||||
},
|
||||
{
|
||||
"match_response": true,
|
||||
"rule_set": "geoip-cn",
|
||||
"action": "route",
|
||||
"server": "local"
|
||||
},
|
||||
{
|
||||
"action": "route",
|
||||
"server": "remote"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 1.12.0
|
||||
|
||||
### Migrate to new DNS server formats
|
||||
|
||||
@@ -79,6 +79,111 @@ sing-box 1.14.0 新增字段参阅 [ACME](/zh/configuration/shared/certificate-p
|
||||
}
|
||||
```
|
||||
|
||||
### 迁移 DNS 规则动作 strategy 到规则项
|
||||
|
||||
DNS 规则动作中的 `strategy` 已废弃。
|
||||
|
||||
在 sing-box 1.14.0 中,内部域名解析(Lookup)现在在规则层拆分 A 和 AAAA 查询,
|
||||
每种查询类型独立通过完整的规则链评估。
|
||||
请使用 `ip_version` 或 `query_type` 规则项来控制规则匹配的查询类型。
|
||||
|
||||
!!! info "参考"
|
||||
|
||||
[DNS 规则](/zh/configuration/dns/rule/) /
|
||||
[DNS 规则动作](/zh/configuration/dns/rule_action/)
|
||||
|
||||
=== ":material-card-remove: 弃用的"
|
||||
|
||||
```json
|
||||
{
|
||||
"dns": {
|
||||
"rules": [
|
||||
{
|
||||
"domain_suffix": ".cn",
|
||||
"action": "route",
|
||||
"server": "local",
|
||||
"strategy": "ipv4_only"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
=== ":material-card-multiple: 新的"
|
||||
|
||||
```json
|
||||
{
|
||||
"dns": {
|
||||
"rules": [
|
||||
{
|
||||
"domain_suffix": ".cn",
|
||||
"ip_version": 4,
|
||||
"action": "route",
|
||||
"server": "local"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 迁移地址筛选字段到响应匹配
|
||||
|
||||
地址筛选字段(不使用 `match_response` 的 `ip_cidr`、`ip_is_private`)已废弃,
|
||||
`ip_accept_any` 和 `rule_set_ip_cidr_accept_empty` 也已废弃。
|
||||
|
||||
在 sing-box 1.14.0 中,请使用 [`evaluate`](/zh/configuration/dns/rule_action/#evaluate) 动作
|
||||
获取 DNS 响应,然后通过 `match_response` 显式匹配。
|
||||
|
||||
!!! info "参考"
|
||||
|
||||
[DNS 规则](/zh/configuration/dns/rule/) /
|
||||
[DNS 规则动作](/zh/configuration/dns/rule_action/#evaluate)
|
||||
|
||||
=== ":material-card-remove: 弃用的"
|
||||
|
||||
```json
|
||||
{
|
||||
"dns": {
|
||||
"rules": [
|
||||
{
|
||||
"rule_set": "geoip-cn",
|
||||
"action": "route",
|
||||
"server": "local"
|
||||
},
|
||||
{
|
||||
"action": "route",
|
||||
"server": "remote"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
=== ":material-card-multiple: 新的"
|
||||
|
||||
```json
|
||||
{
|
||||
"dns": {
|
||||
"rules": [
|
||||
{
|
||||
"action": "evaluate",
|
||||
"server": "remote"
|
||||
},
|
||||
{
|
||||
"match_response": true,
|
||||
"rule_set": "geoip-cn",
|
||||
"action": "route",
|
||||
"server": "local"
|
||||
},
|
||||
{
|
||||
"action": "route",
|
||||
"server": "remote"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 1.12.0
|
||||
|
||||
### 迁移到新的 DNS 服务器格式
|
||||
|
||||
@@ -99,7 +99,7 @@ var OptionIPAcceptAny = Note{
|
||||
DeprecatedVersion: "1.14.0",
|
||||
ScheduledVersion: "1.16.0",
|
||||
EnvName: "DNS_RULE_IP_ACCEPT_ANY",
|
||||
MigrationLink: "https://sing-box.sagernet.org/configuration/dns/rule/",
|
||||
MigrationLink: "https://sing-box.sagernet.org/migration/#migrate-address-filter-fields-to-response-matching",
|
||||
}
|
||||
|
||||
var OptionRuleSetIPCIDRAcceptEmpty = Note{
|
||||
@@ -108,16 +108,16 @@ var OptionRuleSetIPCIDRAcceptEmpty = Note{
|
||||
DeprecatedVersion: "1.14.0",
|
||||
ScheduledVersion: "1.16.0",
|
||||
EnvName: "DNS_RULE_RULE_SET_IP_CIDR_ACCEPT_EMPTY",
|
||||
MigrationLink: "https://sing-box.sagernet.org/configuration/dns/rule/",
|
||||
MigrationLink: "https://sing-box.sagernet.org/migration/#migrate-address-filter-fields-to-response-matching",
|
||||
}
|
||||
|
||||
var OptionLegacyDNSAddressFilter = Note{
|
||||
Name: "legacy-dns-address-filter",
|
||||
Description: "legacy address filter DNS rule items",
|
||||
Description: "Address Filter Fields in DNS rules",
|
||||
DeprecatedVersion: "1.14.0",
|
||||
ScheduledVersion: "1.16.0",
|
||||
EnvName: "LEGACY_DNS_ADDRESS_FILTER",
|
||||
MigrationLink: "https://sing-box.sagernet.org/configuration/dns/rule/",
|
||||
MigrationLink: "https://sing-box.sagernet.org/migration/#migrate-address-filter-fields-to-response-matching",
|
||||
}
|
||||
|
||||
var OptionLegacyDNSRuleStrategy = Note{
|
||||
@@ -126,7 +126,7 @@ var OptionLegacyDNSRuleStrategy = Note{
|
||||
DeprecatedVersion: "1.14.0",
|
||||
ScheduledVersion: "1.16.0",
|
||||
EnvName: "LEGACY_DNS_RULE_STRATEGY",
|
||||
MigrationLink: "https://sing-box.sagernet.org/configuration/dns/rule_action/",
|
||||
MigrationLink: "https://sing-box.sagernet.org/migration/#migrate-dns-rule-action-strategy-to-rule-items",
|
||||
}
|
||||
|
||||
var Options = []Note{
|
||||
|
||||
@@ -181,7 +181,7 @@ func NewDefaultDNSRule(ctx context.Context, logger log.ContextLogger, options op
|
||||
if legacyDNSMode {
|
||||
deprecated.Report(ctx, deprecated.OptionIPAcceptAny)
|
||||
} else {
|
||||
return nil, E.New("ip_accept_any is removed when legacyDNSMode is disabled, use ip_cidr with match_response")
|
||||
return nil, E.New(deprecated.OptionIPAcceptAny.MessageWithLink())
|
||||
}
|
||||
item := NewIPAcceptAnyItem()
|
||||
rule.destinationIPCIDRItems = append(rule.destinationIPCIDRItems, item)
|
||||
@@ -339,7 +339,7 @@ func NewDefaultDNSRule(ctx context.Context, logger log.ContextLogger, options op
|
||||
if legacyDNSMode {
|
||||
deprecated.Report(ctx, deprecated.OptionRuleSetIPCIDRAcceptEmpty)
|
||||
} else {
|
||||
return nil, E.New("rule_set_ip_cidr_accept_empty is removed when legacyDNSMode is disabled")
|
||||
return nil, E.New(deprecated.OptionRuleSetIPCIDRAcceptEmpty.MessageWithLink())
|
||||
}
|
||||
}
|
||||
item := NewRuleSetItem(router, options.RuleSet, matchSource, options.RuleSetIPCIDRAcceptEmpty) //nolint:staticcheck
|
||||
|
||||
Reference in New Issue
Block a user