Feature/mtr monitor#25
Merged
Merged
Conversation
- Add HopStats, MTRStats, HopView types in internal/stats/mtr.go with EnsureLen/RecordReply/RecordLoss/SetIP/View/Reset methods - Add MTR() lazy accessor on TargetStats, mtrStats field - Include MTRHops []HopView in TargetStats.GetView() snapshot - Reset() now clears mtrStats - Add HopSummary to export.go and populate in BuildSnapshot - Table-driven unit tests with race detector coverage
…elpers - Add RegisterTraceChan/UnregisterTraceChan methods to Pinger, used by both TraceRoute and the new MTR engine (eliminates inline append/remove in traceroute.go) - Add OpenHopSocket: opens a persistent send socket + registers one traceChan for the full MTR loop lifetime (more efficient than per-call registration) - Add ProbeHop: single TTL-limited probe with traceChan or socket-fallback receive - Add acceptHopPacket: shared accept logic factored from TraceRoute - Add NextTraceID, GetASNFor exported accessors needed by the MTR engine - Define hopSendConnV4/hopSendConnV6 interfaces for testability - Refactor TraceRoute to use RegisterTraceChan/UnregisterTraceChan (no behaviour change) - Unit tests: accept/reject matching, traceChan receive, timeout, ctx cancel, unique IDs
- New package internal/mtr with Engine, HopProber interface, Config - One goroutine per target: discovery phase (sequential TTL probing) then continuous probe loop (one probe per hop per interval) - Periodic re-discovery via RediscoverEvery ticker for route changes - EnsureLen grows MTRStats gracefully; star hops accumulate loss at 100% - Config defaults: 30 hops, 1s interval, 1s hop timeout, 10m rediscover - Table-driven tests: clean path, star hop, loss accumulation, ctx cancel stops goroutines, multiple targets concurrently
…un loop - Add -M/--mtr CLI flag and mtr YAML key - Add pingerMTRAdapter satisfying mtr.HopProber interface (type-asserts mtr.HopSocket back to *pinger.HopSocket for ProbeHop dispatch) - Wire mtrEngine into startPinger/stopPinger/stopAll/resetMTR - Add MTREnabled, OnResetMTR to ui.RunOptions (TUI pane wired in Phase 5) - MTR stats now populate and appear in -j JSON export when -M is active
- Add internal/ui/mtr_view.go: renderMTRTable with mtr-standard columns (Hop, Host/ASN, Loss%, Snt, Recv, Last, Avg, Min, Max, Jitter) Color thresholds reuse lossColorForRate from tui_helpers.go Compact mode drops Min/Max/Jitter columns on narrow terminals Star (*) hops display with 100% loss and dashes for latency - Add MTR Monitor pane to tui.go (double-border, black background) - Replace combinatorial if-else layout with dynamic flex builder: append enabled panes (trace/mtr/port) with weight 3 (alone) or 2 (multiple) - Extend Tab focus cycle to include MTR pane; generalised loop-based cycle replaces the hard-coded trace/port specific cases - Wire renderMTRTable into the updateTable refresh loop - 'R' reset key triggers onResetMTR callback when MTR is enabled
…g pane style - Redesign mtr_view.go to use box-drawing characters (┌─┬─┐ │ └─┴─┘) matching the Port Monitor and Traceroute pane style - Fix '...' truncation: mtrHopColW increased to 5 (was 4) so ' 1. ' fits without overflow; paddedCell used instead of rightPaddedCell - Add mtrLossColorTag/mtrRTTColorTag returning tview color tag strings (e.g. '[green]', '[orange]', '[red::b]') instead of tcell.Color.String() - Target label displayed in a full-width header row inside the table border - Full mode: Hop | Host | Loss% | Snt | Recv | Last | Avg | Min | Max | Jitter - Compact mode (narrow terminal): Hop | Host | Loss% | Snt | Last | Avg - 'Discovering...' shown when hops not yet available - Add mtr_view_test.go: border structure, star hop, compact/full columns, multi-target, hop number never truncated (TTL 1-30)
…duced by ├─┬─┤ Before: ┌─┬─┬...┐ top border had column dividers, then label row had no internal separators, causing visual inconsistency (dividers appear out of nowhere). After: ┌──────────────────────────────────────────┐ ← full-width, no ┬ │ 8.8.8.8 (8.8.8.8) │ ← label, left/right only ├─────┬──────────────────┬────────┬...─────┤ ← ┬ introduces columns │ Hop │ Host │ Loss% │ ... │ ├─────┼──────────────────┼────────┼...─────┤ │ 1. │ 192.168.1.1 │ 0.0% │ ... │ └─────┴──────────────────┴────────┴...─────┘
Replace bare destination label with 'SrcIP -> DstIP' format using the existing displaySourceIPForDst helper (respects IPv4/IPv6 and 'Auto'). - IP target: '192.168.1.5 -> 8.8.8.8' - Hostname target: 'example.com (192.168.1.5 -> 93.184.216.34)'
- Add MTR Monitor pane to Features list (both EN/JA) - Add -M usage examples and -T -M simultaneous usage - Add -M / --mtr and -j / --json-output to Options table - Add mtr: true and json-output keys to hosts.yaml example - Update Tab key description to include MTR Monitor in cycle - Add dedicated 'MTR Monitor pane' section documenting all columns, compact mode, SrcIP->DstIP header, and JSON export integration - Fix duplicate license entry in README.ja.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.