No description
Find a file
Nicklas Yli-Länttä dbab43ef59 Initial commit: mtrx MTR/traceroute client
A traceroute/MTR CLI that highlights bogon and special-use IP space and
resolves each hop's origin AS to its organisation name.

- enrich/bogon: longest-prefix special-use/bogon classifier (IPv4 + IPv6)
- enrich/asn:   Team Cymru DNS whois resolver with caching
- prober:       raw ICMP echo and TCP SYN probe engines (CAP_NET_RAW)
- session:      continuous rounds with per-hop loss/latency/jitter stats
- tui:          live bubbletea/lipgloss table with sparklines
- report:       static text and JSON output modes

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-16 18:37:38 +03:00
internal Initial commit: mtrx MTR/traceroute client 2026-08-16 18:37:38 +03:00
.gitignore Initial commit: mtrx MTR/traceroute client 2026-08-16 18:37:38 +03:00
go.mod Initial commit: mtrx MTR/traceroute client 2026-08-16 18:37:38 +03:00
go.sum Initial commit: mtrx MTR/traceroute client 2026-08-16 18:37:38 +03:00
main.go Initial commit: mtrx MTR/traceroute client 2026-08-16 18:37:38 +03:00
README.md Initial commit: mtrx MTR/traceroute client 2026-08-16 18:37:38 +03:00

mtrx

A custom MTR / traceroute client that colour-highlights bogon and special-use IP space and resolves each hop's origin AS number to its organisation name — plus reverse DNS, per-hop loss/latency statistics, and a live terminal UI.

Hop  Host / AS                                Loss%  Snt   Last   Avg  Best  Wrst  StDev  Recent
 1   10.10.40.1 [private]                      0.0%    8    0.6   0.6   0.6   0.7    0.1   ▄▁▂▄█
 2   vl17.core02-toh-fi.as206125.net  AS206125 TIMNET, FI [FI]   0.0% …
 …
13   one.one.one.one  AS13335 CLOUDFLARENET - Cloudflare, Inc. [AU]  0.0% …

Features

  • Bogon / special-use highlighting — longest-prefix classification of RFC 1918 private, RFC 6598 CGNAT, loopback, link-local, IPv6 ULA, documentation, benchmarking, multicast and reserved/future ranges (IPv4 & IPv6), colour-coded by category.
  • ASN → organisation resolution via Team Cymru's DNS whois service (no API key), with in-memory caching. Shows AS<n> <org> [<country>].
  • Reverse DNS per hop.
  • Live TUI (bubbletea/lipgloss): loss%, sent, last/avg/best/worst/stddev, and a latency sparkline, refreshed continuously.
  • Continuous stats with online mean/variance (Welford) and detection of load-balanced paths (multiple addresses per hop).
  • Probe protocols: ICMP echo (default) and TCP SYN (--tcp, for paths that filter ICMP).
  • Report & JSON modes for one-shot runs and scripting.

Requirements

  • Go 1.24+

  • CAP_NET_RAW (raw sockets). Either run with sudo, or grant the binary the capability once:

    go build -o mtrx .
    sudo setcap cap_net_raw+ep ./mtrx
    

Usage

mtrx 1.1.1.1                    # live TUI (ICMP echo)
mtrx --tcp -p 443 example.com   # TCP SYN probes to port 443
mtrx --report 10 1.1.1.1        # run 10 cycles, print a static table
mtrx --report 10 --json 1.1.1.1 # emit JSON instead

Flags

Flag Default Meaning
-m 30 max hops (TTL)
-i 1s interval between rounds
-w 1s per-probe timeout
--tcp false use TCP SYN probes instead of ICMP echo
-p 443 destination port (TCP mode)
--report N 0 run N cycles then print a static report (0 = live TUI)
--json false with --report, emit JSON

TUI keys

  • q / Ctrl-C — quit
  • n — toggle reverse-DNS names vs raw IPs

Colour key: yellow = private, orange = CGNAT, red = bogon/reserved.

Architecture

main.go                     flags, target resolution, mode selection
internal/
  prober/                   TTL-sweep probe engines
    icmp.go                 ICMP echo (raw socket, shared reader, seq-matched)
    tcp_linux.go            TCP SYN (raw sockets, checksummed, port/seq-matched)
  session/                  continuous rounds + per-hop stat aggregation
  enrich/
    bogon/                  special-use/bogon longest-prefix classifier
    asn/                    Team Cymru DNS whois resolver + cache
  tui/                      bubbletea live table + lipgloss styling
  report/                   static text + JSON output

Notes & limitations

  • TCP SYN mode is IPv4 only for now; ICMP mode supports IPv4 and IPv6.
  • TCP traceroute commonly shows more missing intermediate hops than ICMP because many routers do not return time-exceeded for TCP — this matches system traceroute -T behaviour.
  • ASN/rDNS lookups are asynchronous; enrichment fills in a moment after a hop first appears.