mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-09-28 07:36:38 +08:00
1.9 KiB
1.9 KiB
PLAN: Detailed Hop-by-Hop Tunnel Quality Probing (Option B)
Objective
Enhance the tunnel quality monitoring to correctly execute and record hop-by-hop latency and loss through the entire forwarding chain (Entry -> Mids -> Exit), rather than directly forcing Entry to ping Exit. Expose these details in the UI for advanced troubleshooting.
Tasks
- 1. DB Schema & Model Updates
- Update
model.TunnelQualityinmodel.gowithChainDetails string(gorm:"column:chain_details;type:text"). - GORM AutoMigrate will handle adding the column to SQLite/PostgreSQL automatically on backend restart.
- Update
- 2. Backend Data Structures (
tunnel_quality_prober.go)- Define
TunnelQualityHopto storeFromNodeID,FromNodeName,ToNodeID,ToNodeName,Latency,Loss. - Update
tunnelQualitySnapshotto includeChainDetails []TunnelQualityHop(json:"chainDetails,omitempty"). - Update DB query models to pass
ChainDetailsback to the frontend.
- Define
- 3. Prober Logic Restructuring
- In
tunnel_quality_prober.go:probeTunnel(), handleType 2(Forwarding Chain) properly. - Extract the intermediate nodes using
splitChainNodeGroups. - Form the hop pairs:
in[0]->mid[0],mid[i]->mid[i+1],mid[last]->out[0]. - Probe each hop sequentially. Resolve target IPs via
resolveChainProbeTargetusingconnect_ipfields and node preferences. - Cumulative metrics:
EntryToExitLatency=sum(latency).EntryToExitLoss=1 - \prod (1 - loss\_i).
- In
- 4. Frontend API & Component
- Add
chainDetails?: string;toTunnelQualityApiIteminvite-frontend/src/api/types.ts. - In
TunnelMonitorView, parse the JSON string back into an array of hops if it exists. - Design a horizontal topology diagram (e.g., using
heroui/chipandlucide-reactarrows) to show[上海入口] --25ms--> [香港跳板] --15ms--> [落地出口]. - Highlight bottlenecks (e.g., > 100ms or loss > 0%) in yellow or red.
- Add