DNS: Correct Host behavior

This commit is contained in:
Fangliding
2026-08-31 15:35:40 +08:00
parent 090e425873
commit 5d4ddd2ac3
3 changed files with 6 additions and 3 deletions
+2 -1
View File
@@ -95,9 +95,10 @@ A static IP mapping. The value consists of entries in the form `"domain": "addre
The mapping target may be a domain name. When the core finishes matching and the mapping contains domain name(s), the behavior is slightly different:
- If the mapping contains both IP addresses and domain names, the domain names are removed and only the IP addresses are returned.
- If the mapping contains several domain names, the result is ambiguous: the match fails, is treated as a miss, and the DNS query phase is entered.
- If the mapping contains several domain names, the result is ambiguous: the query fails.
- If the mapping contains exactly one domain name, that domain will be fed back into the Hosts module for recursive resolution, repeating the above steps with a maximum recursion depth of 5.
- If the above recursive resolution yields no IPs, and the final resolution result contains exactly one domain name, that domain replaces the original requested domain and is sent to the DNS query phase.
- In particular, if the "domain" is in the form of a hash followed by a number (such as `#3`), any request matched by this entry will fail immediately. If the request comes from the DNS outbound, the core will return an empty response with the rcode corresponding to that number to reject the request.
The matching format (`domain:`, `full:`, etc.) is the same as the domain in the commonly used [Routing System](./routing.md#ruleobject). The difference is that without a prefix, it defaults to using the `full:` prefix (similar to the common hosts file syntax).