Files
dns-server/dns/.trae/documents/plan_20251225_123636.md
Alex Yang cdac4fcf43 update
2026-01-16 11:09:11 +08:00

53 lines
965 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
1. **修改QueryLog结构体**
*`dns/server.go`中的`QueryLog`结构体添加`ResponseCode`字段
2. **修改addQueryLog函数**
*`dns/server.go`中的`addQueryLog`函数添加`responseCode`参数
* 将响应代码记录到QueryLog结构体中
3. **修改DNS请求处理逻辑**
*`handleDNSRequest`函数中,获取实际的响应代码
* 将响应代码传递给`addQueryLog`函数
4. **修改前端模板**
*`static/js/logs.js`中,将响应代码的硬编码值"无"替换为从日志数据中获取的实际响应代码
* 添加响应代码映射,将数字响应代码转换为可读的字符串
5. **编译和测试**
* 重新编译项目
* 测试DNS查询详情中响应代码是否正确显示
**DNS响应代码映射**
* 0: NOERROR
* 1: FORMERR
* 2: SERVFAIL
* 3: NXDOMAIN
* 4: NOTIMP
* 5: REFUSED
* 6: YXDOMAIN
* 7: YXRRSET
* 8: NXRRSET
* 9: NOTAUTH
* 10: NOTZONE