]> Sergey Matveev's repositories - vors.git/blobdiff - cmd/server/main.go
Consider overhead length in statistics
[vors.git] / cmd / server / main.go
index 37efdfbc779ca0f439de16289649c90a75fd573b4d8eb9f780daa9c6170ec2a6..354de6c88e68634b77459312a2dccff594a3b6cef1a64b2e949c2929f38e5aa2 100644 (file)
@@ -406,7 +406,7 @@ func main() {
                        }
 
                        peer.stats.pktsRx++
-                       peer.stats.bytesRx += uint64(n)
+                       peer.stats.bytesRx += vors.IPHdrLen(from.IP) + 8 + uint64(n)
                        if n == 1 {
                                continue
                        }
@@ -442,7 +442,7 @@ func main() {
                                        continue
                                }
                                p.stats.pktsTx++
-                               p.stats.bytesTx += uint64(n)
+                               p.stats.bytesTx += vors.IPHdrLen(p.addr.IP) + 8 + uint64(n)
                                if _, err = lnUDP.WriteToUDP(buf[:n], p.addr); err != nil {
                                        slog.Warn("sendto", "peer", peer.name, "err", err)
                                }