Browse Source

reduce log spam

JackDoan 2 months ago
parent
commit
26a00a5647
1 changed files with 10 additions and 6 deletions
  1. 10 6
      handshake_ix.go

+ 10 - 6
handshake_ix.go

@@ -166,14 +166,18 @@ func ixHandshakeStage1(f *Interface, addr netip.AddrPort, via *ViaSender, packet
 
 
 	if remoteCert.Certificate.Version() != ci.myCert.Version() {
 	if remoteCert.Certificate.Version() != ci.myCert.Version() {
 		// We started off using the wrong certificate version, lets see if we can match the version that was sent to us
 		// We started off using the wrong certificate version, lets see if we can match the version that was sent to us
-		rc := cs.getCertificate(remoteCert.Certificate.Version())
-		if rc == nil {
-			f.l.WithError(err).WithField("udpAddr", addr).
-				WithField("handshake", m{"stage": 1, "style": "ix_psk0"}).WithField("cert", remoteCert).
-				Info("Might be unable to handshake with host due to missing certificate version")
+		myCertOtherVersion := cs.getCertificate(remoteCert.Certificate.Version())
+		if myCertOtherVersion == nil {
+			if f.l.Level >= logrus.DebugLevel {
+				f.l.WithError(err).WithFields(m{
+					"udpAddr":   addr,
+					"handshake": m{"stage": 1, "style": "ix_psk0"},
+					"cert":      remoteCert,
+				}).Debug("Might be unable to handshake with host due to missing certificate version")
+			}
 		} else {
 		} else {
 			// Record the certificate we are actually using
 			// Record the certificate we are actually using
-			ci.myCert = rc
+			ci.myCert = myCertOtherVersion
 		}
 		}
 	}
 	}