DNS: Retry with EDNS0 when response is truncated (#4516)

This commit is contained in:
风扇滑翔翼 2025-03-21 08:22:04 +08:00 committed by RPRX
parent 6f8e253dec
commit 86a225cda1
3 changed files with 49 additions and 15 deletions

View file

@ -31,10 +31,11 @@ type record struct {
// IPRecord is a cacheable item for a resolved domain
type IPRecord struct {
ReqID uint16
IP []net.Address
Expire time.Time
RCode dnsmessage.RCode
ReqID uint16
IP []net.Address
Expire time.Time
RCode dnsmessage.RCode
RawHeader *dnsmessage.Header
}
func (r *IPRecord) getIPs() ([]net.Address, error) {
@ -179,9 +180,10 @@ func parseResponse(payload []byte) (*IPRecord, error) {
now := time.Now()
ipRecord := &IPRecord{
ReqID: h.ID,
RCode: h.RCode,
Expire: now.Add(time.Second * 600),
ReqID: h.ID,
RCode: h.RCode,
Expire: now.Add(time.Second * 600),
RawHeader: &h,
}
L: