feat: detect bad certificate error

This commit is contained in:
James Houlahan
2020-07-28 16:15:28 +02:00
committed by Jakub
parent 7baa4dc117
commit 2c910378ce
5 changed files with 27 additions and 2 deletions

View File

@ -29,6 +29,7 @@ import (
"github.com/ProtonMail/proton-bridge/pkg/listener"
"github.com/emersion/go-imap"
goIMAPBackend "github.com/emersion/go-imap/backend"
"github.com/sirupsen/logrus"
)
type panicHandler interface {
@ -219,3 +220,11 @@ func (ib *imapBackend) monitorDisconnectedUsers() {
ib.deleteUser(address)
}
}
func (ib *imapBackend) upgradeError(err error) {
logrus.WithError(err).Error("IMAP connection couldn't be upgraded to TLS during STARTTLS")
if strings.Contains(err.Error(), "remote error: tls: bad certificate") {
logrus.Info("TODO: Show troubleshooting popup")
}
}