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.
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.
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
- 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.
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)
- 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