]> Sergey Matveev's repositories - vors.git/blobdiff - cmd/server/main.go
Show bad packets counter
[vors.git] / cmd / server / main.go
index 17c9ce3daecaf66a17ffd27dc99ed892e04e60262e1f76e2e71f89ed98af2980..fd60e914b190568e27db7e55096cb07083e2813f65e07933b736316f0dd9c2fb 100644 (file)
@@ -256,10 +256,11 @@ func newPeer(conn *net.TCPConn) {
                                return
                        case now = <-tick:
                                s := fmt.Sprintf(
-                                       "%s | Rx/Tx: %s / %s  |  %s / %s",
+                                       "%s | Rx/Tx/Bad: %s / %s / %s |  %s / %s",
                                        peer.addr,
                                        humanize.Comma(stats.pktsRx),
                                        humanize.Comma(stats.pktsTx),
+                                       humanize.Comma(stats.bads),
                                        humanize.IBytes(stats.bytesRx),
                                        humanize.IBytes(stats.bytesTx),
                                )
@@ -394,7 +395,7 @@ func main() {
                                continue
                        }
                        if n <= 4+vors.TagLen {
-                               slog.Info("too small", "peer", peer.name, "len", n)
+                               peer.stats.bads++
                                continue
                        }
 
@@ -415,8 +416,7 @@ func main() {
                                tag[:vors.TagLen],
                                buf[n-vors.TagLen:n],
                        ) != 1 {
-                               log.Println("decrypt:", peer.name, "tag differs")
-                               slog.Info("MAC failed", "peer", peer.name, "len", n)
+                               peer.stats.bads++
                                continue
                        }