Report per-peer byte counters, not just packets

The overlay peer report carried packet counts only, so the GUI could show
packets/s but no byte throughput. Adds tx_bytes/rx_bytes to OverlayPeerReport
and fills them from each data plane:

- the wg and wg-quic plugins already counted plaintext bytes per peer; the CLI
  now maps them into the report;
- the generic tunnel (tcp-tls) gains tx_bytes/rx_bytes on its peer state and
  report, incremented by the plaintext length at the same points it counts
  packets.

The local control protocol version is bumped (TSN 15 -> 16) since the report
shape changed; a client and agent on different builds already detect and report
the mismatch.

Checks: fmt, clippy --workspace --all-targets -D warnings, and the tsunagi lib,
tsunagi-cli and wg-quic local_control tests pass on macOS.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
UltradesuandClaude Opus 4.8 committed 2026-10-02 15:30:37 +01:00
1 parent 2cda56e1f8
commit 0a344c1b4f
3 files changed
+31 -1

No files matched your search

+10
View File
@@ -4078,6 +4078,8 @@ async fn build_report(
handshake_secs_ago: tunnel.health.since_handshake.map(|s| s.as_secs()),
tx_packets: tunnel.stats.tx_packets,
rx_packets: tunnel.stats.rx_packets,
tx_bytes: tunnel.stats.tx_bytes,
rx_bytes: tunnel.stats.rx_bytes,
dropped: tunnel.stats.dropped_wrong_source
+ tunnel.stats.dropped_oversize,
protocol_errors: tunnel.stats.protocol_errors,
@@ -4096,6 +4098,8 @@ async fn build_report(
handshake_secs_ago: Some(tcp_tls.uptime_secs),
tx_packets: tcp_tls.tx_packets,
rx_packets: tcp_tls.rx_packets,
tx_bytes: tcp_tls.tx_bytes,
rx_bytes: tcp_tls.rx_bytes,
dropped: tcp_tls.dropped,
protocol_errors: 0,
path: tcp_tls.path.clone(),
@@ -4114,6 +4118,8 @@ async fn build_report(
handshake_secs_ago: tunnel.health.since_handshake.map(|s| s.as_secs()),
tx_packets: tunnel.stats.tx_packets,
rx_packets: tunnel.stats.rx_packets,
tx_bytes: tunnel.stats.tx_bytes,
rx_bytes: tunnel.stats.rx_bytes,
dropped: tunnel.stats.dropped_wrong_source
+ tunnel.stats.dropped_oversize,
protocol_errors: tunnel.stats.protocol_errors,
@@ -4131,6 +4137,8 @@ async fn build_report(
handshake_secs_ago: None,
tx_packets: 0,
rx_packets: 0,
tx_bytes: 0,
rx_bytes: 0,
dropped: 0,
protocol_errors: 0,
path: "no data link".into(),
@@ -4147,6 +4155,8 @@ async fn build_report(
handshake_secs_ago: None,
tx_packets: 0,
rx_packets: 0,
tx_bytes: 0,
rx_bytes: 0,
dropped: 0,
protocol_errors: 0,
path: "no data link".into(),