Skip to content

An open-source CLI tool developed in Go to analyze network performance. Measure latency, packet loss, and trace data paths with this network analyzer.

Notifications You must be signed in to change notification settings

thc2cat/GoTrace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

6 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

GoTrace โ€” a Go Network Analyzer, a diagnostic tool for latency and packet loss ๐ŸŒ

Meta-description: "An open-source CLI tool developed in Go to analyze network performance. Measure latency, packet loss, and trace data paths with this network analyzer."

This project is a command-line tool written in Go for analyzing network connectivity and performance. It combines traceroute and ping features to provide a complete view of latency, packet loss, and the path that data takes to a destination.

docs/GoTrace.png

Features ๐Ÿ› ๏ธ

The program is organized into three distinct phases for detailed analysis:

Phase 1: Router Discovery (Traceroute)

This phase identifies intermediate routers (hops) between your machine and the final destination. It uses ICMP packets with an incremental Time-to-Live (TTL) to map the full route.

Phase 2: Performance Measurement (Ping)

After the route is traced, the program sends a specified number of ICMP packets to each router in the list. It collects latency data for each hop, allowing you to pinpoint weak spots or bottlenecks along the path.

Phase 3: Statistics Display

Results are presented in a compact, easy-to-read table. For each router, the tool shows:

  • The router's IP address.
  • The average latency in microseconds (ยตs).
  • The latency standard deviation in microseconds (ยตs), indicating variability.
  • The packet loss percentage, a key indicator of connection reliability.

Requirements ๐Ÿ“‹

  • Go (version 1.18 or newer)
  • Administrator privileges (sudo on Linux/macOS) or equivalent on other systems, since the program requires access to raw ICMP sockets.

Installation and Usage ๐Ÿš€

Clone the repository:

git clone https://github.com/votre_utilisateur/go-network-analyzer.git

Run the program: Execute the application by specifying the target host (domain name or IP) and the number of packets to send.

sudo go run main.go <hostname_or_ip> <number_of_packets> [delay_in_ms]

Example: To analyze the path to google.com by sending 10 packets to each hop, run:

sudo go run main.go google.com 10

Example Output ๐Ÿ“Š

Here is an example of the tool's final output:

   ----- Tracing routers to www.google.com (142.250.178.132) ----- 
Hop   | IP Address       | Avg (ยตs)     | Std Dev (ยตs)    | Loss (%)  
---------------------------------------------------------------------
1     | 192.168.1.1      | 528.25       | 104.78          | 0.00
2     | 10.12.0.1        | 1256.74      | 258.91          | 0.00
3     | 172.16.25.1      | 2530.12      | 450.32          | 0.00
...
10    | 142.250.75.14    | 25687.55     | 1205.80         | 0.00

Notes and Caveats

  • The program may require elevated privileges to send ICMP packets.
  • Raw ICMP sockets are restricted on some platforms (e.g., native Windows). Use WSL on Windows or adapt the code to use platform-specific ICMP APIs for native Windows support.
  • This tool is provided for educational and diagnostic purposes. Ensure you have permission to probe target hosts.
  • Results may vary depending on network conditions, firewalls, or other security settings.

Acknowledgments

Thanks to the Go community and contributors to the x/net package.

About

An open-source CLI tool developed in Go to analyze network performance. Measure latency, packet loss, and trace data paths with this network analyzer.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages