mirror of
https://github.com/DNSCrypt/dnscrypt-proxy.git
synced 2025-01-14 02:25:52 +01:00
Reduce comparisons (#2148)
This commit is contained in:
parent
dc2fff05be
commit
568f54fabb
@ -106,10 +106,9 @@ func (proxy *Proxy) Encrypt(
|
|||||||
minQuestionSize += int(xpad[0])
|
minQuestionSize += int(xpad[0])
|
||||||
}
|
}
|
||||||
paddedLength := Min(MaxDNSUDPPacketSize, (Max(minQuestionSize, QueryOverhead)+1+63) & ^63)
|
paddedLength := Min(MaxDNSUDPPacketSize, (Max(minQuestionSize, QueryOverhead)+1+63) & ^63)
|
||||||
if proto == "udp" && serverInfo.knownBugs.fragmentsBlocked {
|
if serverInfo.knownBugs.fragmentsBlocked && proto == "udp" {
|
||||||
paddedLength = MaxDNSUDPSafePacketSize
|
paddedLength = MaxDNSUDPSafePacketSize
|
||||||
}
|
} else if serverInfo.Relay != nil && proto == "tcp" {
|
||||||
if serverInfo.Relay != nil && proto == "tcp" {
|
|
||||||
paddedLength = MaxDNSPacketSize
|
paddedLength = MaxDNSPacketSize
|
||||||
}
|
}
|
||||||
if QueryOverhead+len(packet)+1 > paddedLength {
|
if QueryOverhead+len(packet)+1 > paddedLength {
|
||||||
|
Loading…
Reference in New Issue
Block a user