Implement an actual estimator for the response size

Scale back the minimum question size when relevant.

Did I mention that this is yet another thing that was never properly
implemented in dnscrypt-proxy 1.x?
This commit is contained in:
Frank Denis 2018-01-10 09:46:27 +01:00
parent f4346691bc
commit efd0477c2b
2 changed files with 24 additions and 2 deletions

View file

@ -163,6 +163,8 @@ func (proxy *Proxy) processIncomingQuery(serverInfo *ServerInfo, serverProto str
clientPc.(net.PacketConn).WriteTo(response, *clientAddr)
if HasTCFlag(response) {
proxy.questionSizeEstimator.blindAdjust()
} else {
proxy.questionSizeEstimator.adjust(len(response))
}
} else {
response, err = PrefixWithSize(response)