Skip to content

Report connection start times and rank packet tunnel traffic - #10

Merged
MimoProxy merged 2 commits into
mainfrom
kernel/tunnel-traffic
Nov 21, 2026
Merged

MimoProxy merged 2 commits into
mainfrom
kernel/tunnel-traffic

Conversation

@MimoProxy

Copy link
Copy Markdown
Owner

Two changes for the iOS packet tunnel, one commit each.

Connection start times

  • connections rows gain startMs (Unix milliseconds) and are returned newest first, ties broken by ID.

Traffic ranking

  • The packet tunnel session totals upload, download and connection counts per destination host (routing domain, then sniffed domain, then IP) and per selected policy.
  • Closed connections are booked once from their final counters when they leave the active table. Active connections add their current counters at query time.
  • Totals are bounded (512 hosts, 256 policies). Overflow goes into other / otherOutbounds, so the overall totals are conserved.
  • New operations:
    • trafficRanking (limit, default 50, max 200) returns {sinceMs, hosts, outbounds, other}.
    • resetTrafficRanking clears the totals.
  • The sagernet backend gains an optional OnConnectionClosed callback. Only the packet tunnel registers it, so other platforms are unchanged.
  • With the callback set, UDP flows wait for in-flight writes before reporting final counters.

Interface change for clients

  • startMs is a new field on connection rows.
  • trafficRanking and resetTrafficRanking are new operations.
  • Existing callers are unaffected.

🤖 Generated with Claude Code

@MimoProxy
MimoProxy force-pushed the kernel/tunnel-traffic branch from 662744d to d43824d Compare November 21, 2026 15:58
MimoProxy and others added 2 commits November 22, 2026 00:15
Active connection rows now carry the start time in Unix milliseconds and
are returned newest first, so clients can list recent connections at the
top without guessing from connection IDs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The packet tunnel session now totals upload, download and connection
counts per destination host and per selected policy. Closed connections
are booked once from their final counters when they leave the active
table; active connections add their current counters at query time.
Totals are bounded and overflow into an aggregate entry.

New operations: trafficRanking returns the totals since the session
started or was last reset, and resetTrafficRanking clears them. The
backend gains an optional close callback, which only the packet tunnel
registers, and UDP flows wait for in-flight writes before reporting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MimoProxy
MimoProxy force-pushed the kernel/tunnel-traffic branch from d43824d to 810269d Compare November 21, 2026 16:17
@MimoProxy
MimoProxy enabled auto-merge (rebase) November 21, 2026 16:17
@MimoProxy
MimoProxy merged commit c487c86 into main Nov 21, 2026
17 checks passed
@MimoProxy
MimoProxy deleted the kernel/tunnel-traffic branch November 21, 2026 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant