diff --git a/server/middleware.go b/server/middleware.go index c9f7918..3433447 100644 --- a/server/middleware.go +++ b/server/middleware.go @@ -51,7 +51,7 @@ func Authenticate(store peering.Store, key *rsa.PublicKey, funcs ...OptionFunc) serverClaims, err := assertServerToken(key, serverToken) if err != nil { - logger.Printf("[ERROR] %s", err) + logger.Printf("[ERROR] %+v", err) sendError(w, http.StatusUnauthorized) return } @@ -64,13 +64,13 @@ func Authenticate(store peering.Store, key *rsa.PublicKey, funcs ...OptionFunc) options.IgnoredClientTokenErrors..., ) if err != nil { - logger.Printf("[ERROR] %s", err) + logger.Printf("[ERROR] %+v", err) switch err { case peering.ErrPeerNotFound: sendError(w, http.StatusUnauthorized) case ErrNotPeered: if err := store.UpdateLastContact(serverClaims.PeerID, r.RemoteAddr, time.Now()); err != nil { - logger.Printf("[ERROR] %s", err) + logger.Printf("[ERROR] %+v", err) sendError(w, http.StatusInternalServerError) return } @@ -78,7 +78,7 @@ func Authenticate(store peering.Store, key *rsa.PublicKey, funcs ...OptionFunc) return case ErrPeerRejected: if err := store.UpdateLastContact(serverClaims.PeerID, r.RemoteAddr, time.Now()); err != nil { - logger.Printf("[ERROR] %s", err) + logger.Printf("[ERROR] %+v", err) sendError(w, http.StatusInternalServerError) return } @@ -92,19 +92,19 @@ func Authenticate(store peering.Store, key *rsa.PublicKey, funcs ...OptionFunc) match, body, err := assertBodySum(r.Body, clientClaims.BodySum) if err != nil { - logger.Printf("[ERROR] %s", err) + logger.Printf("[ERROR] %+v", err) sendError(w, http.StatusInternalServerError) return } if !match { - logger.Printf("[ERROR] %s", ErrInvalidChecksum) + logger.Printf("[ERROR] %+v", ErrInvalidChecksum) sendError(w, http.StatusBadRequest) return } if err := store.UpdateLastContact(serverClaims.PeerID, r.RemoteAddr, time.Now()); err != nil { - logger.Printf("[ERROR] %s", err) + logger.Printf("[ERROR] %+v", err) sendError(w, http.StatusInternalServerError) return }