OxiDNS v1.4.0
发布概览
OxiDNS v1.4.0 是一个 Minor Release,重点补齐复杂网络环境下的统一出口控制、上游诊断、并发上游结果裁决和缓存热路径优化。
本版本新增 network.outbound 统一出口层,让下载、升级检查、HTTP 请求、Webhook、outbound resolver、forward upstream 和部分探测场景可以复用同一套出口 profile;新增 oxidns probe upstream <addr>,用于在生产启用前验证真实上游链路;同时增强 forward 并发响应选择、DoH HTTP/1.1 / JSON API、WebUI 升级 / 重启体验,以及 query recorder 与 cache 的高负载表现。
未配置 network.outbound.default 的旧配置通常可以直接升级。若配置了默认 outbound profile,未显式设置 outbound 的 upstream 会继承该默认 profile。SOCKS5 proxy 只作用于 TCP、DoT 和 DoH2;UDP、DoQ、DoH3 upstream 会忽略 SOCKS5 proxy。
主要亮点
1. network.outbound 统一出口层
新增全局出口配置:
network:
outbound:
default: direct
profiles:
direct:
resolver: system
proxy: none
remote:
resolver:
nameservers:
- addr: "1.1.1.1:53"
- addr: "tls://dns.google:853"
dial_addr: 8.8.8.8
ip_version: 4
timeout: 5s
proxy:
socks5: 127.0.0.1:1080以下路径可以复用 outbound profile:
downloadupgradehttp_request- Webhook / 内部 HTTP client
- forward upstream
- outbound resolver nameserver
ip_selectorTCP 探测oxidns probe upstream
upstream 本地字段仍有更高优先级,例如 dial_addr、bootstrap、socks5 会覆盖 profile 注入值。
2. 新增 oxidns probe upstream
新增上游诊断命令:
oxidns probe upstream <addr>示例:
oxidns probe upstream udp://1.1.1.1:53
oxidns probe upstream tcp://1.1.1.1:53
oxidns probe upstream tls://dns.google:853 --qname example.com. --qtype A
oxidns probe upstream https://dns.google/dns-query --json
oxidns probe upstream tcp://dns.example.com:53 -c config.yaml --outbound remote它可以帮助检查:
- upstream 是否可达;
- 域名型 upstream 的解析结果;
- 实际解析来源,例如 literal、dial_addr、configured、bootstrap、system、proxy;
- 串行基线查询表现;
- TCP / DoT 是否适合开启 pipeline;
- UDP / DoH / DoH3 / DoQ 的并发或多路复用表现;
- 响应 ID、question、qtype 是否串线;
- 超时、协议错误、传输错误和诊断建议;
- human / JSON 两种输出格式。
建议在启用 network.outbound、bootstrap、pipeline、加密 upstream、QUIC upstream 或代理出口前,对关键上游先执行 probe。
3. forward.response_selection 并发响应选择
forward 新增并发响应选择模式:
plugins:
- tag: forward_main
type: forward
args:
concurrent: 3
response_selection: balanced
upstreams:
- addr: udp://1.1.1.1:53
- addr: udp://8.8.8.8:53支持模式:
fastest:第一个成功 DNS 响应胜出。balanced:默认模式。正向NOERROR答案立即胜出;NXDOMAIN或 NODATA 会短暂等待是否存在正向答案。prefer_positive:正向答案立即胜出;负向答案等待已发起的并发上游全部结束后再返回。consensus:正向答案立即胜出;负向答案需要两个上游确认,并发数不足时退化为prefer_positive。
forward.concurrent 上限提升到 1..=32,并会按实际 upstream 数量自动裁剪。常规配置建议使用 2..=8。
4. Cache 策略与热路径优化
cache 新增:
min_positive_ttl: 4正响应的有效 TTL 低于该值时不会写入缓存。该策略同时作用于普通写入和 lazy refresh。
新增指标:
cache_skip_total{reason="low_positive_ttl"}
同时优化了 cache hit 和 TTL rewrite 热路径:
- LRU touch 改为自适应间隔,降低高命中场景下的写竞争;
- TTL rewrite 复用
oxidns-proto新增 helper,减少逐记录 mutation 开销; - lazy refresh 返回低 TTL 响应时,不再误删较新的缓存项。
5. DoH HTTP/1.1 与 JSON DNS API
DoH 入站现在支持 HTTP/1.1 与 HTTP/2 在同一监听上自动协商,HTTP/3 仍为可选能力。
http_server.entries[] 可开启 JSON DNS API:
entries:
- path: "/dns-query"
exec: "seq_main"
json_api: true开启后,GET 请求可使用:
nametypecddoedns_client_subnetrandom_padding
如果同一个 GET 请求同时带有 RFC8484 dns= 和 JSON API 参数,优先按 dns= 处理。
6. Query Recorder 读取性能优化
query_recorder 新增派生表:
questionsmeta
qname / qtype 过滤、top qname / qtype / latency 等查询会使用索引化 question 表,不再反复展开 JSON 字段。
新增可选配置:
reader_concurrency: 2用于限制 WebUI / API 历史与统计查询的 SQLite reader 并发,避免大库场景下突发读请求占用过多 blocking 线程和内存。
现有 records / steps 表保持不变,派生 question index 会自动回填。
7. WebUI 改进
- 支持配置
network.outboundprofile、默认 profile、SOCKS5 和 resolver nameserver。 - 设置页展示 outbound 运行时指标。
- 升级流程新增状态展示和 Upgrade Overlay。
- 重启 / 升级检测改为识别新的 backend instance,而不是只依赖是否观察到停机窗口。
- WebUI HTML 入口和 SPA fallback 使用
Cache-Control: no-cache,避免升级后缓存旧 HTML shell。 - hashed 静态资源继续保持长期 immutable 缓存。
- 补齐 outbound、cache、ip_selector 等新增字段的中英文文案。
8. DNS 规则与文档
reject支持命名 RCODE,例如reject NXDOMAIN、reject SERVFAIL。- 新增 DNS 编码速查表,覆盖常见 RCODE、QCLASS、QTYPE 的数字值和英文助记名。
其他变更
- 整理 upstream runtime 模块边界,拆分 traits、pooled execution、bootstrap refresh、bootstrap pool factory 等结构。
- 拆分 forward executor,将 config、factory、single、concurrent、selection、metrics、tests 分离。
- 修复 HTTP/3 connection accept error 可能在 cached connection-level error 上空转的问题。
- fallback 无响应分支视为正常控制流,不再作为失败日志记录。
hotpath升级到0.17.0。- 升级
jiff、bytes、h2、webpki-roots、syn等依赖。 - GitHub Actions 工作流升级到
actions/checkout@v7。
升级说明
版本号
- 根 crate:
1.4.0 oxidns-proto:0.1.3- Release tag:
v1.4.0
配置兼容性
从 v1.3.0 升级时,如果没有配置 network.outbound.default,通常可以直接升级。
如果配置了 network.outbound.default,请检查所有未显式设置 outbound 的 upstream,因为它们会继承默认 profile。
SOCKS5 proxy 只作用于:
- TCP
- DoT
- DoH2
以下 upstream 协议会忽略 SOCKS5 proxy:
- UDP
- DoQ
- DoH3
建议升级检查
升级后建议执行:
oxidns build-info
oxidns check -c config.yaml
oxidns probe upstream <critical-upstream>尤其是以下场景:
- 使用
network.outbound - 使用
bootstrap - 使用 TCP / DoT pipeline
- 使用 DoH / DoQ / DoH3
- 使用代理出口
- 使用多上游并发转发
可选新增配置
以下配置都是可选项,不设置时保持默认行为:
forward.response_selectioncache.min_positive_ttlquery_recorder.reader_concurrencyhttp_server.entries[].json_api
致谢
感谢所有反馈 issue、参与讨论、提交 PR、验证网络路径和帮助完善 v1.4.0 诊断能力的用户与贡献者。
What's Changed
- Add explicit reject 0 soa option by @ksong008 in #218
- Serve WebUI HTML without immutable caching by @ksong008 in #217
- Improve query recorder SQLite read scalability by @ksong008 in #215
- fix(server): stop spinning on HTTP/3 accept errors by @svenshi in #220
- Feat/reject rcode by @svenshi in #221
- feat(docs): add DNS code reference and update configuration documentation by @svenshi in #223
- Refactor/infra network boundaries by @svenshi in #222
- feat(server): support HTTP/1.1 for DoH by @svenshi in #224
- ci: bump actions/checkout from 6 to 7 in the github-actions-all group by @dependabot[bot] in #230
- deps: bump hotpath from 0.16.1 to 0.17.0 in the cargo-major group by @dependabot[bot] in #229
- deps: bump the cargo-patch-and-minor group with 5 updates by @dependabot[bot] in #228
- Feat/network outbound by @svenshi in #231
- Feat/network outbound by @svenshi in #234
- refactor(network): clarify transport and upstream module layout by @svenshi in #235
- Fix/webui upgrade by @svenshi in #237
- feat(cli): add upstream probe diagnostics by @svenshi in #238
- Feat/225 forward response selection by @svenshi in #239
- refactor(forward): split executor implementation into modules by @svenshi in #240
- feat(cache): add minimum positive TTL admission by @svenshi in #241
- Fix/webui restart by @svenshi in #242
- perf(cache): optimize cache hit path and TTL rewrite hot path by @svenshi in #243
- Release/v1.4.0 by @svenshi in #244
New Contributors
Full Changelog: v1.3.0...v1.4.0