DanielLavrushin 说明 b4 的 ASN 前缀选择与描述缓存修复
在 b4 #727 的讨论中,DanielLavrushin 表示,lookupASN 在较宽前缀排在前面时原会使用覆盖网络的 AS,修改后无论记录顺序如何都选择较窄前缀。他增加了两种顺序的假 DoH 服务测试,让 hub 直接调用 asnorigin.Pick,并收敛相关接口。他还说明,AS 描述查询失败时不再缓存空的组织名称,以免解析器一直被显示为遭到劫持,直至 b4 重启;ASN 仍保留缓存,只重新查询描述。此外,他补充了变更日志及 hub 测试发现规则。
作者原文@DanielLavrushinThanks for the fix, @RyoKusnadi. It does what #685 asks: with the wide prefix first,
lookupASNon main named the covering prefix's AS, and with this change it names the narrow one in either order.I pushed a few commits on top so it can go in as is:
- Removed the code comments in
src/asnorigin. The repo keeps none; explanations go in commit messages.- Added
src/detector/asn_test.go. It runslookupASNagainst a fake DoH server with the wide prefix first and the narrow prefix first, so going back to the first record fails a test.- The hub calls
asnorigin.Pickdirectly. ThePickOriginandParseOriginwrappers are gone andparseis unexported, soPickis the only way in.lookupASNno longer keeps an empty org in its cache when the AS description lookup fails, which made a resolver show as hijacked until b4 restarted. The ASN stays cached and only the description is asked again.- Changelog entries in
changelog.md,changelog_ru.mdandhub/CHANGELOG.md.b4-checknow lists the hub tests when asrcpackage the hub imports changes, since the hub importssrc/asnoriginnow.