tag[:vors.TagLen],
buf[len(buf)-vors.TagLen:],
) != 1 {
- log.Println("decrypt:", stream.name, "tag differs")
+ stream.stats.bads++
continue
}
pkt = buf[4 : len(buf)-vors.TagLen]
type Stats struct {
pkts int64
bytes uint64
+ bads int64
lost int64
reorder int64
last time.Time
return
case now = <-tick:
s := fmt.Sprintf(
- "%s | %s | L/R: %s / %s",
+ "%s | %s | B/L/R: %s/%s/%s",
humanize.Comma(stats.pkts),
humanize.IBytes(stats.bytes),
+ humanize.Comma(stats.bads),
humanize.Comma(stats.lost),
humanize.Comma(stats.reorder),
)
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),
)
continue
}
if n <= 4+vors.TagLen {
- slog.Info("too small", "peer", peer.name, "len", n)
+ peer.stats.bads++
continue
}
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
}