1
0
mirror of https://github.com/DNSCrypt/dnscrypt-proxy.git synced 2025-01-19 03:00:29 +01:00

Reduce verbosity

This commit is contained in:
Frank Denis 2018-01-18 14:46:19 +01:00
parent 7e86477a7d
commit ed352cc28c
3 changed files with 11 additions and 3 deletions

2
Gopkg.lock generated
View File

@ -62,7 +62,7 @@
branch = "master" branch = "master"
name = "github.com/jedisct1/dlog" name = "github.com/jedisct1/dlog"
packages = ["."] packages = ["."]
revision = "fcbcc457e6a2b4eab2325a0902fd3d0a7d17e548" revision = "b53fa44bbfb62dc284a052d828390b21f50d61f9"
[[projects]] [[projects]]
branch = "master" branch = "master"

View File

@ -71,6 +71,14 @@ func FetchCurrentCert(proxy *Proxy, proto string, pk ed25519.PublicKey, serverAd
serial := binary.BigEndian.Uint32(binCert[112:116]) serial := binary.BigEndian.Uint32(binCert[112:116])
tsBegin := binary.BigEndian.Uint32(binCert[116:120]) tsBegin := binary.BigEndian.Uint32(binCert[116:120])
tsEnd := binary.BigEndian.Uint32(binCert[120:124]) tsEnd := binary.BigEndian.Uint32(binCert[120:124])
if tsBegin >= tsEnd {
dlog.Warnf("[%v] certificate ends before it starts")
continue
}
ttl := tsEnd - tsBegin
if ttl > 86400 {
dlog.Warnf("[%v] the key validity period for this server is excessively long (%d days), significantly reducing reliability and forward security.", providerName, ttl/86400)
}
if now > tsEnd || now < tsBegin { if now > tsEnd || now < tsBegin {
dlog.Debugf("[%v] Certificate not valid at the current date", providerName) dlog.Debugf("[%v] Certificate not valid at the current date", providerName)
continue continue
@ -108,7 +116,7 @@ func FetchCurrentCert(proxy *Proxy, proto string, pk ed25519.PublicKey, serverAd
certInfo.CryptoConstruction = cryptoConstruction certInfo.CryptoConstruction = cryptoConstruction
copy(certInfo.ServerPk[:], serverPk[:]) copy(certInfo.ServerPk[:], serverPk[:])
copy(certInfo.MagicQuery[:], binCert[104:112]) copy(certInfo.MagicQuery[:], binCert[104:112])
dlog.Noticef("[%v] Valid cert (crypto version %d) found - rtt: %dms", providerName, cryptoConstruction, rtt.Nanoseconds()/1000000) dlog.Noticef("[%v] OK (crypto v%d) - rtt: %dms", providerName, cryptoConstruction, rtt.Nanoseconds()/1000000)
} }
if certInfo.CryptoConstruction == UndefinedConstruction { if certInfo.CryptoConstruction == UndefinedConstruction {
return certInfo, 0, errors.New("No useable certificate found") return certInfo, 0, errors.New("No useable certificate found")

View File

@ -187,7 +187,7 @@ func logf(severity Severity, format string, args ...interface{}) {
if _globals.syslogger != nil { if _globals.syslogger != nil {
(*_globals.syslogger).WriteLevel(severityToSyslogPriority[severity], []byte(message)) (*_globals.syslogger).WriteLevel(severityToSyslogPriority[severity], []byte(message))
} else { } else {
line := fmt.Sprintf("[%d-%02d-%02d %02d:%02d:%02d] [%s] [%s] %s\n", year, int(month), day, hour, minute, second, _globals.appName, SeverityName[severity], message) line := fmt.Sprintf("[%d-%02d-%02d %02d:%02d:%02d] [%s] %s\n", year, int(month), day, hour, minute, second, SeverityName[severity], message)
if _globals.outFd != nil { if _globals.outFd != nil {
_globals.outFd.WriteString(line) _globals.outFd.WriteString(line)
_globals.outFd.Sync() _globals.outFd.Sync()