Commit Graph
92 Commits
Author SHA1 Message Date
tsosunchia e060c33777 feat: Enhance traceroute output handling and add tests
- Added support for output path and default output flag in traceroute commands.
- Implemented output path resolution logic with conflict checks.
- Updated globalping and MTR modes to handle new output options.
- Enhanced MTU mode with styled output and improved result printing.
- Refactored table printer to support clear screen option and added tests for table output.
- Introduced new logging functions in tracelog for better file handling and real-time output.
- Added comprehensive tests for new features and existing functionalities.
2026-03-18 22:49:22 +08:00
tsosunchia d9dbcc2a38 feat: align psize semantics and add tos 2026-03-17 16:41:10 +08:00
tsosunchia f6816f9592 feat: add standalone mtu mode metadata and flavor gating 2026-03-17 11:33:36 +08:00
tsosunchia fc125bea4c refactor mtr ui render hotspots 2026-03-08 13:59:46 +08:00
tsosunchia 81797d4b5f Improve gocyclo complexity 2026-03-08 10:54:41 +08:00
tsosunchia d8e93c2a35 feat: improve fast trace flag naming and enhance layout computation tests 2026-03-07 23:05:43 +08:00
tsosunchia 816949e90c feat: enhance Windows compatibility by adjusting flag initialization and layout computation 2026-03-07 20:26:42 +08:00
tsosunchia 361e14a27d feat(mtr): 更新 MTR 模式参数,调整每跳探测间隔,忽略 -z/--send-time,新增 MPLS 显示切换功能 2026-03-01 04:58:49 +08:00
tsosunchia 7e2226f186 feat(mtr): discard over-final TTL destination replies and remove Round label from CLI output
remove higher-TTL destination folding after final TTL is known
discard disabled TTL results before accounting/callback/lowering
keep lowering + MigrateStats behavior unchanged
drop "Round:" from TUI status line and table fallback
add regressions for late over-final replies and raw emission fidelity
2026-03-01 03:15:36 +08:00
tsosunchia 92e93ff0d4 feat(mtr): 压缩 TUI 指标区、折叠高 TTL 目标、重排显示模式并新增 -y/--ipinfo
本次修改仅影响 CLI 下的 MTR TUI 模式,不涉及 --report/--wide/--raw、普通 traceroute 或 Web MTR。

主要变更:
- 指标区压缩:将 Loss% 列宽缩至 5、Snt 缩至 3、RTT 五列缩至 7,列名不变,双行表头仍保留,提高 Host 列宽度。
- 目标折叠:目标在某个 TTL 确认后,后续更高 TTL 的 dst‑ip 响应不再单独显示,而是折叠到最终 TTL;折叠后 Snt 不得超过 MaxPerHop,超出部分丢弃;调度器区分 originTTL/accountTTL,disabled TTL 的 dst‑ip 回复允许折叠。
- 显示模式扩展:新增 HostModeBase (0),五档依次为 IP/PTR、ASN、City、Owner、Full;默认显示 IP/PTR。`y` 键循环顺序调整为 0→1→2→3→4→0。
- 新增 CLI 参数 `-y, --ipinfo` (0..4) 用于设置 TUI 初始显示模式;在 --report/--wide/--raw 中可解析但被忽略;非法值报错。
- `runMTRTUI`/`newMTRUI` 支持传入初始 mode,`r` 键重置统计不再影响显示模式。
- 当 mode ≥ ASN 且无 ASN 时插入 `AS???` 占位符;Base 模式不显示占位符。
- 更新 CLI 帮助、README 与 README_zh_CN 文档,说明新的默认模式、y 键循环和 `-y/--ipinfo` 映射关系。
- 新增或调整单元测试,覆盖显示模式循环、默认与初始值、参数校验与忽略逻辑、主机信息渲染、紧凑布局以及目标折叠等场景。

非目标:report/wide/raw 模式、Web MTR 和普通 traceroute。
2026-03-01 02:03:56 +08:00
tsosunchia 69f2ca680b feat: 更新文档和代码,增强 MTR 功能,优化 API 信息输出 2026-02-28 13:14:03 +08:00
tsosunchia e377c8c7b4 Adjust traceroute interval defaults 2026-02-28 12:53:36 +08:00
tsosunchia c3bfb6c21e Revert MTR TUI host spacing 2026-02-28 11:49:13 +08:00
tsosunchia 1f2491f399 Fix frontend MTR flush scheduling 2026-02-28 11:24:22 +08:00
tsosunchia d41d8b2fba feat: Introduce MTR raw streaming functionality
- Added support for streaming probe-level MTR raw events via `trace.RunMTRRaw`.
- Implemented a new `mtrRawAggregator` to handle raw MTR data aggregation.
- Updated the web client to handle `mtr_raw` messages and render statistics accordingly.
- Introduced new JavaScript module `mtr_agg.js` for aggregating MTR raw data.
- Created new printer functions for formatting MTR raw records.
- Added tests for the new MTR raw functionality to ensure correct behavior.
- Deprecated the legacy snapshot aggregator for MTR.
2026-02-28 09:41:25 +08:00
tsosunchia 4bf6d68dc5 feat: 添加 --show-ips 选项以在 MTR 输出中同时显示 PTR 和 IP 地址 2026-02-28 01:23:17 +08:00
tsosunchia 5d12ac877b feat(mtr): 重构 MTR 指标格式化,添加等待状态处理和合并逻辑 2026-02-27 23:31:20 +08:00
tsosunchia b9a6b945e7 fix(tests): 修复测试代码格式,调整注释对齐 2026-02-27 22:30:49 +08:00
tsosunchia 39ab110f82 feat(tui): 增强 TUI 渲染,支持动态前缀宽度和 tab 感知对齐 2026-02-27 22:30:22 +08:00
tsosunchia ae08ec9796 fix(mtr): 提前冲突校验并修复 report 模式 CJK 对齐
- 将 MTR 冲突检查前移到所有 early-return 分支之前,避免 `-r --from`、`-t --fast-trace`、`--file` 等组合绕过校验
- report 输出改用 `go-runewidth` 计算显示宽度与截断(`StringWidth`/`Truncate`)
- 新增 `reportPadRight`,替换 `%*s` 对齐路径,修复中文场景下 HOST 与指标列错位
- 保持 wide/非 wide 逻辑不变,仅修复布局与参数校验时序
- tests: `go test -ldflags "-checklinkname=0" ./...`
2026-02-27 21:51:38 +08:00
tsosunchia 24224cf943 feat: Enhance MTR mode with source IP resolution and name mode toggle
- Removed the conflicting `--report` flag from MTR mode.
- Added `dataOrigin` parameter to `runMTRMode` for preferred API information.
- Implemented `resolveSrcIP` function to determine source IP based on priority.
- Introduced `nameMode` in `mtrUI` to toggle between PTR/IP and IP only display.
- Updated MTR table rendering functions to accommodate the new name mode.
- Enhanced tests to cover name mode functionality and API info display in TUI.
- Suppressed output of preferred API IP in MTR mode to avoid terminal pollution.
2026-02-27 20:50:47 +08:00
tsosunchia 86a2fd555b feat(mtr): 对齐 mtr 风格显示并完善窄屏右锚定
- 重构 TUI Header:
  - Line1 改为 `NextTrace [vX.Y.Z]`
  - Line2 改为 `srcHost(srcIP) -> dstName(dstIP) + 时间戳`(时间右侧对齐)
  - Keys 行增加 `y-display(...)` 模式提示
- Host 列新增 4 种显示模式并支持 `y/Y` 循环切换:
  - ASN / City / Owner / Full
  - `r` 重置统计不影响当前显示模式
- Host 基础标识调整为 PTR-or-IP(有 PTR 显示 PTR,无 PTR 显示 IP)
- City 模式改为单级回退链:`City -> Prov -> Country`
- 语言一致性修正:默认中文,`--language en` 才优先英文(缺失字段自动回退)
- MPLS 从主行内联改为独立续行显示(更贴近 mtr)

布局修复(review P2):
- 修复窄屏下指标区未贴右边界问题:
  - `computeLayout` 在 phase-2/3 收敛后回填 slack 到 hostW
  - 保证 `metricsStart + metricsWidth == termWidth`,指标区严格右锚定

测试:
- 更新/新增 Host 模式、语言回退、MPLS 多行、Header、`y` 键循环、窄屏右锚定断言等测试
- 全量测试通过
2026-02-27 20:09:16 +08:00
tsosunchia da10275b51 feat(mtr): 对齐 mtr 交互与展示,支持流式首屏/重置统计/目的跳截断
1. 启动与刷新:引入 `mtrPeeker + ProgressThrottle`,在首轮未完成时按节流推送预览快照,不再“整轮结束才出画面”。
2. 跳数前缀:每行开头改为 mtr 简约风格(`N.` / 同 TTL 续行空前缀)。
3. 运行中重置统计:新增 `r` 键(Restart statistics),重置聚合统计、轮次计数、退避状态与目的 TTL 缓存。
4. 表头版本信息:新增 `My traceroute [NextTrace <version>]`。
5. 表头目标信息:第二行展示 `domain (ip)`;当输入本身是 IP 时避免 `1.1.1.1 (1.1.1.1)` 重复显示。
6. MPLS 展示恢复:Host 列直接拼接底层提取的 MPLS 标签,修复不显示/双重包裹问题。
7. 目的跳后停止:检测 `DstIP` 命中后记录 `roundFinalTTL/knownFinalTTL`,后续轮次提前截断,不再把目标 IP 重复打印到 `maxHops`。

补充修正:
1. 流式预览中“未发送 TTL”保持 `nil` 槽位,不再被误计为 timeout(避免虚高 `Snt/Loss`)。
2. 新增对应单测覆盖未发送 TTL 场景与流式快照路径。

测试:
1. 新增/更新 `peekPartialResult`、流式刷新、重置统计、目的跳截断、Header/IP 去重、MPLS 展示等测试。
2. `go test ./...` 全量通过。
2026-02-27 19:05:06 +08:00
tsosunchia 9b9964d61f feat(tui): 增加自适应布局和双层表头渲染功能 2026-02-27 18:07:26 +08:00
tsosunchia 52b6b5cb22 mtr模式 2026-02-27 17:34:46 +08:00
tsosunchia 33873a5245 feat: 添加地理数据初始化和超时处理逻辑 2026-02-08 20:22:10 +08:00
tsosunchia ef76cdbbba 暂停使用部分网络加速
Signed-off-by: tsosunchia <59512455+tsosunchia@users.noreply.github.com>
2026-02-08 19:56:54 +08:00
tsosunchia fd56e8946a feat(trace): 异步化 Geo 查询以降低探测延迟
- 将 fetchIPData 改为通过 addWithGeoAsync 异步执行
- 新增 waitGeo 机制,在打印每个 TTL 前等待 Geo 数据就绪
- 为 geoWG.Wait 添加 30 秒总超时,防止无限阻塞
- 无论是否有错误都等待 geoWG 完成,避免返回后结果仍被修改
- 在 printer 中增加 pending 状态保护,避免空指针访问
- 导出 PendingGeoSource 常量供跨包使用
- 修改 Result.add 返回 (bool, int) 以追踪插入索引

此变更将 Geo/DNS 查询从主探测路径解耦,显著降低用户感知延迟,
同时通过 sync.Map 缓存和 singleflight 去重保持结果一致性。
2025-12-21 21:45:44 +08:00
Yunlq bf26596f61 修复了英文模式下无法显示RFC1918等信息的bug 2025-11-19 20:41:42 +08:00
tsosunchia a0f739af08 基础设施维护者增加MoeDove
Signed-off-by: tsosunchia <59512455+tsosunchia@users.noreply.github.com>
2025-10-28 21:56:42 +08:00
tsosunchia 6fbcf09684 加入win用户所必须的配置步骤提示;新增贡献者名单 2025-10-12 22:08:24 +08:00
Yunlq 10c567287e 完成了windows上的TCP路由跟踪 2025-09-13 02:04:26 +08:00
tsosunchia 7bb8cda280 移除邮箱信息 2025-08-30 23:49:12 +08:00
Yunlq 0070082101 运行了go fmt和goimports 2025-08-17 16:12:26 +08:00
Yunlq ea54b2c0c4 优化并统一了环境变量的读取和使用 2025-08-17 15:04:57 +08:00
Yunlq 6bb278a22b 允许用户设置SrcPort=-1来启用随机源端口模式 2025-08-17 02:11:15 +08:00
Yunlq 31d4de4218 启用环境变量NEXTTRACE_ENABLEHIDDENDSTIP时,同时隐藏其rDNS记录 2025-08-17 00:22:59 +08:00
Yunlq ffd67a1d2d 优化了低Query场景下高丢包跳的输出 2025-08-10 23:27:50 +08:00
tsosunchia 183516b14c 修改部分UI表达 2024-12-21 21:00:45 +08:00
tsosunchia f50ca1f7f8 修正之前对于payload size设置的错误表述 2024-05-30 00:29:53 +08:00
tsosunchia f76c9401f9 update credit 2023-12-20 13:52:08 +08:00
tsosunchia 21a92e1f89 高亮显示扩充 2023-12-08 16:57:01 +08:00
tsosunchia b32947a824 update credit 2023-11-30 16:12:47 +08:00
tsosunchia 8adceb8d77 update credit 2023-11-21 17:37:46 +08:00
tsosunchia 98c0fa38ca 可设置是否隐匿目的IP 2023-11-13 11:23:07 +08:00
tsosunchia 65d8ac5c14 修改credit 2023-11-05 16:16:59 +08:00
tsosunchia 99409089b2 update credit 2023-10-14 22:32:12 +08:00
tsosunchia a6848f8f23 仓库用途变更
要提交的变更:
	修改:     .github/workflows/build.yml
	修改:     .github/workflows/publishNewFormula.yml
	修改:     README.md
	修改:     README_zh_CN.md
	修改:     fast_trace/fast_trace_test.go
	修改:     go.mod
	修改:     go.sum
	修改:     pow/pow.go
	修改:     printer/basic.go
	修改:     util/latency.go
	修改:     util/latency_test.go
	修改:     util/util.go
	修改:     wshandle/client.go
2023-10-08 17:15:29 +08:00
tsosunchia 1580c6111f add mpls func 2023-10-06 21:03:38 +08:00
tsosunchia 580612ce08 refactor: preparatory work 2023-06-26 14:49:05 +08:00