From f0a690701d3d88f5b254280b826d795f8ff4a30b Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Mon, 2 Apr 2018 20:55:42 +0200 Subject: [PATCH] Print "additional certificate" when a server has multiple valid certs This doesn't mean anything but looks less confusing than having the same message twice Fixes #303 --- dnscrypt-proxy/dnscrypt_certs.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dnscrypt-proxy/dnscrypt_certs.go b/dnscrypt-proxy/dnscrypt_certs.go index 34109b3c..0ff3c68c 100644 --- a/dnscrypt-proxy/dnscrypt_certs.go +++ b/dnscrypt-proxy/dnscrypt_certs.go @@ -43,6 +43,7 @@ func FetchCurrentDNSCryptCert(proxy *Proxy, serverName *string, proto string, pk now := uint32(time.Now().Unix()) certInfo := CertInfo{CryptoConstruction: UndefinedConstruction} highestSerial := uint32(0) + var certCountStr string for _, answerRr := range in.Answer { binCert, err := packTxtString(strings.Join(answerRr.(*dns.TXT).Txt, "")) if err != nil { @@ -135,10 +136,11 @@ func FetchCurrentDNSCryptCert(proxy *Proxy, serverName *string, proto string, pk copy(certInfo.ServerPk[:], serverPk[:]) copy(certInfo.MagicQuery[:], binCert[104:112]) if isNew { - dlog.Noticef("[%s] OK (crypto v%d) - rtt: %dms", *serverName, cryptoConstruction, rtt.Nanoseconds()/1000000) + dlog.Noticef("[%s] OK (crypto v%d) - rtt: %dms%s", *serverName, cryptoConstruction, rtt.Nanoseconds()/1000000, certCountStr) } else { - dlog.Infof("[%s] OK (crypto v%d) - rtt: %dms", *serverName, cryptoConstruction, rtt.Nanoseconds()/1000000) + dlog.Infof("[%s] OK (crypto v%d) - rtt: %dms%s", *serverName, cryptoConstruction, rtt.Nanoseconds()/1000000, certCountStr) } + certCountStr = " - additional certificate" } if certInfo.CryptoConstruction == UndefinedConstruction { return certInfo, 0, errors.New("No useable certificate found")