mirror of
https://github.com/status-im/consul.git
synced 2025-01-19 18:19:53 +00:00
9dc7194321
See https://github.com/hashicorp/consul/issues/3977 While trying to improve furthermore #3948 (This pull request is still valid since we are not using Compression to compute the result anyway). I saw a strange behaviour of dns library. Basically, msg.Len() and len(msg.Pack()) disagree on Message len. Thus, calculation of DNS response is false consul relies on msg.Len() instead of the result of Pack() This is linked to miekg/dns#453 and a fix has been provided with miekg/dns#454 Would it be possible to upgrade miekg/dns to a more recent function ? Consul might for instance upgrade to a post 1.0 release such as https://github.com/miekg/dns/releases/tag/v1.0.4
119 lines
2.9 KiB
Go
119 lines
2.9 KiB
Go
// Code generated by "go run compress_generate.go"; DO NOT EDIT.
|
|
|
|
package dns
|
|
|
|
func compressionLenHelperType(c map[string]int, r RR) {
|
|
switch x := r.(type) {
|
|
case *AFSDB:
|
|
compressionLenHelper(c, x.Hostname)
|
|
case *CNAME:
|
|
compressionLenHelper(c, x.Target)
|
|
case *DNAME:
|
|
compressionLenHelper(c, x.Target)
|
|
case *HIP:
|
|
for i := range x.RendezvousServers {
|
|
compressionLenHelper(c, x.RendezvousServers[i])
|
|
}
|
|
case *KX:
|
|
compressionLenHelper(c, x.Exchanger)
|
|
case *LP:
|
|
compressionLenHelper(c, x.Fqdn)
|
|
case *MB:
|
|
compressionLenHelper(c, x.Mb)
|
|
case *MD:
|
|
compressionLenHelper(c, x.Md)
|
|
case *MF:
|
|
compressionLenHelper(c, x.Mf)
|
|
case *MG:
|
|
compressionLenHelper(c, x.Mg)
|
|
case *MINFO:
|
|
compressionLenHelper(c, x.Rmail)
|
|
compressionLenHelper(c, x.Email)
|
|
case *MR:
|
|
compressionLenHelper(c, x.Mr)
|
|
case *MX:
|
|
compressionLenHelper(c, x.Mx)
|
|
case *NAPTR:
|
|
compressionLenHelper(c, x.Replacement)
|
|
case *NS:
|
|
compressionLenHelper(c, x.Ns)
|
|
case *NSAPPTR:
|
|
compressionLenHelper(c, x.Ptr)
|
|
case *NSEC:
|
|
compressionLenHelper(c, x.NextDomain)
|
|
case *PTR:
|
|
compressionLenHelper(c, x.Ptr)
|
|
case *PX:
|
|
compressionLenHelper(c, x.Map822)
|
|
compressionLenHelper(c, x.Mapx400)
|
|
case *RP:
|
|
compressionLenHelper(c, x.Mbox)
|
|
compressionLenHelper(c, x.Txt)
|
|
case *RRSIG:
|
|
compressionLenHelper(c, x.SignerName)
|
|
case *RT:
|
|
compressionLenHelper(c, x.Host)
|
|
case *SIG:
|
|
compressionLenHelper(c, x.SignerName)
|
|
case *SOA:
|
|
compressionLenHelper(c, x.Ns)
|
|
compressionLenHelper(c, x.Mbox)
|
|
case *SRV:
|
|
compressionLenHelper(c, x.Target)
|
|
case *TALINK:
|
|
compressionLenHelper(c, x.PreviousName)
|
|
compressionLenHelper(c, x.NextName)
|
|
case *TKEY:
|
|
compressionLenHelper(c, x.Algorithm)
|
|
case *TSIG:
|
|
compressionLenHelper(c, x.Algorithm)
|
|
}
|
|
}
|
|
|
|
func compressionLenSearchType(c map[string]int, r RR) (int, bool) {
|
|
switch x := r.(type) {
|
|
case *AFSDB:
|
|
k1, ok1 := compressionLenSearch(c, x.Hostname)
|
|
return k1, ok1
|
|
case *CNAME:
|
|
k1, ok1 := compressionLenSearch(c, x.Target)
|
|
return k1, ok1
|
|
case *MB:
|
|
k1, ok1 := compressionLenSearch(c, x.Mb)
|
|
return k1, ok1
|
|
case *MD:
|
|
k1, ok1 := compressionLenSearch(c, x.Md)
|
|
return k1, ok1
|
|
case *MF:
|
|
k1, ok1 := compressionLenSearch(c, x.Mf)
|
|
return k1, ok1
|
|
case *MG:
|
|
k1, ok1 := compressionLenSearch(c, x.Mg)
|
|
return k1, ok1
|
|
case *MINFO:
|
|
k1, ok1 := compressionLenSearch(c, x.Rmail)
|
|
k2, ok2 := compressionLenSearch(c, x.Email)
|
|
return k1 + k2, ok1 && ok2
|
|
case *MR:
|
|
k1, ok1 := compressionLenSearch(c, x.Mr)
|
|
return k1, ok1
|
|
case *MX:
|
|
k1, ok1 := compressionLenSearch(c, x.Mx)
|
|
return k1, ok1
|
|
case *NS:
|
|
k1, ok1 := compressionLenSearch(c, x.Ns)
|
|
return k1, ok1
|
|
case *PTR:
|
|
k1, ok1 := compressionLenSearch(c, x.Ptr)
|
|
return k1, ok1
|
|
case *RT:
|
|
k1, ok1 := compressionLenSearch(c, x.Host)
|
|
return k1, ok1
|
|
case *SOA:
|
|
k1, ok1 := compressionLenSearch(c, x.Ns)
|
|
k2, ok2 := compressionLenSearch(c, x.Mbox)
|
|
return k1 + k2, ok1 && ok2
|
|
}
|
|
return 0, false
|
|
}
|