Skip to content

feat(traceroute): hop-by-hop path probing (ICMP/UDP/TCP, goscapy)#38

Merged
smallnest merged 1 commit into
mainfrom
feat/issue-37-traceroute
Jun 29, 2026
Merged

feat(traceroute): hop-by-hop path probing (ICMP/UDP/TCP, goscapy)#38
smallnest merged 1 commit into
mainfrom
feat/issue-37-traceroute

Conversation

@smallnest

Copy link
Copy Markdown
Contributor

Summary

  • New traceroute/ package + cmd/traceroute entry point — hop-by-hop path probing, no server-side deployment required.
  • Three probe protocols: ICMP Echo (default), UDP (per-hop dest port), TCP SYN, via --protocol.
  • All packet encode/decode goes through smallnest/goscapy (builder + packet.Dissect); no hand-rolled byte ordering or checksums.
  • Concurrent probing across TTLs and across targets, capped by --parallel.
  • UDP/TCP source/destination overrides: --src-port, --fixed-dport, --src-ip, --dst-ip.
  • Per-hop min/avg/max RTT + loss; ECMP responders shown inline; optional reverse DNS (--no-dns).
  • ICMP Echo Reply matched by id+seq so a single reply from the destination is not misattributed across concurrent probes.
  • Build integration: Makefile (build-traceroute, package, phony), .goreleaser.yml build + archive; docs (docs/traceroute.html, index card) and README/README list updated.

Closes #37

Test plan

  • go build ./...
  • go test -race ./traceroute/... (config validation, hop stats, matcher identity/embedded, port/IP overrides, output formatting)
  • go vet ./traceroute/... ./cmd/traceroute/... clean
  • gofmt clean
  • Manual: sudo traceroute 8.8.8.8 and sudo traceroute -p tcp/udp produce correct hops (verified against system traceroute)

Requires root / CAP_NET_RAW for raw sockets.

Add a concurrent traceroute tool with ICMP/UDP/TCP SYN probes. All probe
construction and reply parsing go through smallnest/goscapy (no hand-rolled
byte ordering or checksums). Probes across TTLs and across targets run
concurrently, capped by --parallel.

- traceroute/ core package + cmd/traceroute entry point
- UDP/TCP support --src-port/--fixed-dport/--src-ip/--dst-ip overrides
- per-hop min/avg/max RTT and loss, ECMP responders shown inline
- ICMP Echo Reply matched by id+seq to avoid concurrent misattribution
- Makefile / goreleaser build integration, docs + README updates
@smallnest
smallnest merged commit c2514bd into main Jun 29, 2026
2 checks passed
@smallnest
smallnest deleted the feat/issue-37-traceroute branch June 29, 2026 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

实现 traceroute 工具:逐跳路径探测(ICMP/UDP/TCP,无需服务端)

1 participant