Commit Graph
47 Commits
Author SHA1 Message Date
tsosunchia 2cab379924 test(bench): 建立 geo mtr websocket 性能与输出基线 2026-09-04 11:43:21 +08:00
tsosunchia 07b23a767b fix(trace): 省略未知的分片 MTU 数值 2026-08-14 21:34:55 +08:00
tsosunchia a39fa7031f fix(trace): 按响应语义收敛 traceroute 终止边界 2026-08-13 11:25:18 +08:00
EveCat ebef637eb2 feat(trace): explain traceroute stop responses 2026-08-13 03:16:18 +08:00
EveCat 1c065129d3 fix(trace): classify probe responses before stopping
Use ICMP response semantics instead of source-address equality to detect transit, destination, and unreachable replies.

Keep tracing when any ECMP path returns a transit response, expose structured stop reasons, and preserve raw and JSON output behavior.
2026-08-12 17:11:34 +08:00
tsosunchia 844d3c1742 Harden regression scripts and preserve WinDivert errors 2026-04-08 22:31:38 +08:00
tsosunchia 4d5f682393 Fix Windows source-device errors and WinDivert retries 2026-04-08 21:14:43 +08:00
tsosunchia 0ddac64b7a Fix source-device normalization and deploy smoke tests 2026-04-08 20:46:33 +08:00
tsosunchia fc0277a93f darwin: avoid promiscuous pcap for TCP and UDP sniffing 2026-04-08 18:05:21 +08:00
tsosunchia 5d8918c191 Add Linux test for non-syscall packet conn binding 2026-04-07 22:11:08 +08:00
tsosunchia 212254d380 Prevent unsupported binds and invalid sniff handles 2026-04-07 21:56:13 +08:00
tsosunchia 28d90ae267 Tighten regression cleanup and source device errors 2026-04-07 21:10:29 +08:00
tsosunchia 0ca093b6aa Harden source-device handling and WinDivert regression checks 2026-04-07 18:27:09 +08:00
tsosunchia 2a5717aedf Fix explicit source/device handling across platforms
Keep the default traceroute path unchanged when neither --source nor --dev is set so existing source address selection, socket setup, and logging stay untouched.

Add a shared explicit source/device normalization helper and route the CLI traceroute path, standalone --mtu path, fast_trace, and server trace requests through it. The helper keeps --source higher priority than --dev, resolves device-derived source addresses by destination family, rejects devices without a usable address, and emits at most one runtime warning.

On macOS, bind TCP and UDP send sockets to the requested interface with IP_BOUND_IF/IPV6_BOUND_IF so explicit --dev survives utun default routes. On Linux, bind ICMP/TCP/UDP send sockets with SO_BINDTODEVICE only when a source device is explicitly configured.

On Windows, keep the existing no-rewrite constraint for real device binding. Explicit --dev now resolves a source address, clears SourceDevice before the tracer is built, and surfaces a single warning that actual egress still follows system routing.

Update CLI help text and README platform notes to document the supported --dev semantics, and add unit tests that cover no-op behavior without explicit overrides, --source priority, device family resolution, mismatch errors, and the Windows downgrade warning.
2026-04-07 17:00:53 +08:00
tsosunchia e4e6c7d270 Catch WinDivert panics in the shared Windows open path 2026-03-22 12:58:59 +08:00
tsosunchia b513155647 Handle missing WinDivert runtime gracefully on Windows 2026-03-22 12:53:04 +08:00
tsosunchia a4efe60ea0 Add regression CI 2026-03-21 09:15:34 +08:00
tsosunchia 21396148d0 fix: improve Windows mtu handling and privilege prompts 2026-03-19 00:14:08 +08:00
tsosunchia 976156ba91 fix: restore windows icmpv6 tos handling 2026-03-17 23:12:15 +08:00
tsosunchia d9dbcc2a38 feat: align psize semantics and add tos 2026-03-17 16:41:10 +08:00
tsosunchia 65e2661668 Plan reduce gocyclo complexity 2026-03-08 11:32:39 +08:00
tsosunchia eecc232450 Plan gocyclo complexity improvements 2026-03-08 11:06:51 +08:00
tsosunchia a9a2325762 feat: enhance build scripts and improve error handling for Windows TCP traces 2026-03-06 13:48:16 +08:00
tsosunchia f69903a00c fix(web): resolve post-v1.5.0 review findings
Address all three review findings from the v1.5.0..HEAD audit:\n- Remove Web MTR reliance on process-wide globals (SrcDev/DisableMPLS) by passing session-scoped trace.Config fields.\n- Apply dot_server consistently to Web/API Geo DNS and LeoMoe/FastIP initialization via scoped resolver setup.\n- Restore Web MTR default per-hop cadence to 1000ms and send hop_interval_ms from frontend.\n\nAlso added regression tests in server/trace_handler_test.go and util/dns_resolver_test.go, and updated CLAUDE.md.\n\nValidation passed:\n- go test ./...\n- go build ./...\n- go build -tags flavor_ntr ./...\n- go build -tags flavor_tiny ./...\n- node --check server/web/assets/app.js
2026-03-06 13:04:42 +08:00
tsosunchia 357c03604d feat: remove unnecessary -checklinkname flag from build scripts and documentation 2026-03-02 16:31:46 +08:00
tsosunchia efb437fbac fix: improve error handling and logging across multiple packages
- Enhanced error handling in `mtr_ui.go` to log warnings when raw mode cannot be enabled.
- Updated `geofeed.go` to return a more informative error instead of panicking when geofeed data cannot be loaded.
- Refined error handling in `ptr.go` to return an error if `ptrPath` is not configured.
- Improved error handling in `fast_trace.go` for network interface address retrieval.
- Added error checks in `chunzhen.go` and `ipapicom.go` for HTTP request creation and response reading.
- Enhanced error handling in `ipdbone.go` to return descriptive errors for authentication failures.
- Updated `ipfilter.go` to ensure proper IP parsing before filtering.
- Improved error handling in `ipinfoLocal.go` for database access and record parsing.
- Enhanced error handling in `ipsb.go` for HTTP request creation and response reading.
- Added checks for closed channels in `leo.go` to prevent panics.
- Improved panic recovery in `ws_handler.go` to log errors in the write loop.
- Added read deadline to WebSocket connections in `ws_handler.go` to prevent blocking.
- Enhanced configuration checks in `globalping.go` to avoid nil pointer dereferences.
- Improved error logging in `icmp_ipv4.go` and `icmp_ipv6.go` for send errors.
- Enhanced error handling in `icmp_darwin.go`, `icmp_unix.go`, and `icmp_windows.go` for checksum setting.
- Improved error handling in TCP and UDP implementations across various platforms for checksum settings.
- Enhanced error handling in `tracemap.go` for proxy configuration.
- Improved type assertions in `util.go` for DNS cache lookups.
2026-03-02 00:14:49 +08:00
tsosunchia 46a8c77e83 fix: close WinDivert handle on context cancel to prevent hang after last hop
Recv() is a blocking call - when traceroute completes and ctx is cancelled,
the goroutine stays stuck in Recv() forever. Fix by spawning a goroutine
that closes the handle on ctx.Done(), causing Recv() to return an error
and exit the loop.

Affected functions:
- ICMPSpec.listenICMPWinDivert (icmp_windows.go)
- TCPSpec.listenICMPWinDivert (tcp_windows.go)
- TCPSpec.ListenTCP (tcp_windows.go)
- UDPSpec.listenICMPWinDivert (udp_windows.go)
2026-02-09 20:35:21 +08:00
tsosunchia ac655be473 feat: replace Npcap with WinDivert SNIFF mode on Windows
- Remove gopacket/pcap dependency from Windows builds
- Replace pcapAvailable() with winDivertAvailable() using WinDivert SNIFF test
- Refactor listenICMPPcap() to listenICMPWinDivert() for ICMP traceroute
- Refactor ListenTCP() to use WinDivert SNIFF mode for TCP response capture
- Update util/pcap.go build tag from 'darwin || (windows && amd64)' to 'darwin only'
- WinDivert now handles all packet reception on Windows (ICMP, TCP, UDP modes)
- Tested on macOS, Windows (cross-compile), and Linux
- All tests passing
2026-02-09 20:13:00 +08:00
Yunlq 72a3781ec5 优化了ICMP模式,提升了其在Windows上的表现 2025-10-04 10:59:43 +08:00
Yunlq c7e663fa99 优化了UDP模式,提升了其在NAT环境下的表现 2025-09-22 21:01:43 +08:00
Yunlq 1d1591ca6b 调整了go:build选项 2025-09-13 19:48:17 +08:00
Yunlq 867008a0c0 优化了启动阶段,减少首跳丢包率 2025-09-13 12:20:22 +08:00
Yunlq 10c567287e 完成了windows上的TCP路由跟踪 2025-09-13 02:04:26 +08:00
Yunlq 5c0fd6eb22 修改了mac端的抓包语句,修复了诸多TCP最终跳相关的问题 2025-08-24 14:56:19 +08:00
Yunlq e1ec195b00 修复了TCP/TCPv6模式中,mac端最终跳捕获失败的bug 2025-08-22 20:36:21 +08:00
Yunlq 3e2f16be8b 精简了listenICMP()函数中重复的逻辑 2025-08-16 23:05:53 +08:00
Yunlq ffd67a1d2d 优化了低Query场景下高丢包跳的输出 2025-08-10 23:27:50 +08:00
tsosunchia b0c0f8d3ce macOS下编译时,无论uid==0,icmpPktListen均使用fakeboboliu的实现方式 2024-10-06 10:55:17 +08:00
tsosunchia 970cff3b72 优化代码 2024-05-13 20:42:56 +08:00
tsosunchia b053ee646b 优化代码 2024-05-13 20:39:22 +08:00
bobo liu 47698be2ed add source ip support for macOS rootless solution
do you guys not have macos devices?
2023-11-11 21:38:28 +08:00
tsosunchia 1580c6111f add mpls func 2023-10-06 21:03:38 +08:00
sjlleo bb522ed859 refactor && feat: add plugin system && cobra 2023-09-05 22:18:28 +08:00
tsosunchia 4f94f01e87 Merge pull request #128 from fakeboboliu/fix1
improve: rootless trace on macOS
2023-06-26 14:52:12 +08:00
tsosunchia 580612ce08 refactor: preparatory work 2023-06-26 14:49:05 +08:00
tsosunchia a92cfc7783 删除无意义文件 2023-06-03 19:52:25 +08:00
bobo liu 2bac716bd7 improve: rootless trace on macOS 2023-06-03 16:50:21 +08:00