Leadaxe 解释 DNS group 使用独立 hosts 字段及本地优先应答
Leadaxe 在 sing-box-lx #60 中说明,hosts 使用组的独立字段,不放入 servers;理由是它没有网络延迟、健康状态或恢复过程。按配置顺序先查 hosts,命中时原样返回,包括仅有另一地址族时的空 NOERROR;未命中则沿用原网络选择路径。hosts 不参与胜负、扇出或生存模式,不出现在 GetDNSGroups 中;servers 仍须非空,内含 hosts 仍会被拒绝。他在该评论发出时称改动已合入 lx、将随下一稳定标签发布,并注明已做单元测试、尚未设备实测。
作者原文@LeadaxeLanded in
lx: b3cdb00dd (code and tests), 9bb311b6d (spec and docs). Ships with the next stable tag.The shape differs from the proposal above: instead of a
hostsmember insideservers, the group gets a separate key.{ "type": "group", "tag": "resolver", "hosts": ["local"], "servers": ["google", "cloudflare"], "mode": "stable" }Why a key and not a member: the group decides which network server to trust right now, and a
hostsserver has no network, no latency, nothing to fail and nothing to recover — the same reasonfakeipis kept out. Listing it inserverswould make the order partly significant, show it inGetDNSGroupswith health it does not have, and turn the LxBox validator's ban into "allowed, but not all of them". A key leavesserversas it is.Behaviour is as proposed. Hosts members are asked first, in key order. A hit — A/AAAA, the member knows the name (
PreferredDomain, the same check thepreferred_byrule item uses), NOERROR — is returned as is, including the empty NOERROR when only the other family is listed. A miss takes the network path unchanged in every mode. Hosts members get no ERROR/WIN records, never join a fan or survival mode, never become current and are absent fromGetDNSGroups. A hit shows as the effective server with oneansweredprobe and adns_memberstage in the connection test; a miss records nothing.serversstays required and non-empty;hostsinsideserversis still rejected at start, the error now points at the key.Docs:
docs-lx/lx-config.md§5, specSPECS/TASKS/143-DNS_GROUP_HOSTS_OVERLAY. Unit-tested in all modes including the realhoststransport; not checked on a device yet — if the dual-stackwg.homecase misbehaves there, reopen and I will look.