Skip to content

This project provides comprehensive network diagnostics through parallel testing of HTTP connectivity, speed, VPN detection, and ping.

License

Notifications You must be signed in to change notification settings

ehsanghaffar/ultimate-internet-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unified Internet Testing Tool in Go

A comprehensive Go application for network diagnostics and internet connectivity testing. Performs parallel HTTP, speed, VPN detection, and ping tests with structured result storage and robust error handling.

Features

  • HTTP Testing: Test HTTP/HTTPS connectivity with TLS information
  • Speed Testing: Measure download speed in Mbps
  • VPN Detection: Detect if connection uses VPN or proxy
  • Ping Testing: ICMP ping with packet loss statistics
  • Parallel Execution: All tests run concurrently for faster execution
  • Structured Results: Results saved to JSON with timestamps
  • Error Resilience: Individual test failures don't crash the application
  • Type Safety: Strongly-typed result structures
  • Configuration Management: Centralized config with sensible defaults
  • Minimal Dependencies: Only one external package (go-ping/ping)

Quick Start

Prerequisites

  • Go 1.19 or higher
  • Network access for tests
  • Ping tests may require elevated privileges on Linux

Installation

# Clone the repository
git clone https://github.com/ehsanghaffar/ultimate-internet-test.git
cd ultimate-internet-test

# Build
go build -o ultimate-internet-test

# Run
./ultimate-internet-test

Usage

# Run all tests
go run .

# Build and execute binary
go build && ./ultimate-internet-test

# Run specific URL tests
go run . https://example.com https://test.com

# View results
cat data.json

Documentation

Project Structure

.
├── config/              # Configuration management
│   └── config.go        # Config struct, constants
├── modules/             # Test implementations
│   ├── httpTest.go      # HTTP connectivity tests
│   ├── speedTest.go     # Speed measurement
│   ├── checkVPN.go      # VPN/proxy detection
│   └── pingTest.go      # ICMP ping tests
├── utils/               # Shared utilities
│   ├── structs.go       # Result data types
│   ├── errors.go        # Error hierarchy
│   └── storage.go       # JSON persistence
├── docs/                # Documentation
│   ├── ARCHITECTURE.md
│   ├── API.md
│   ├── DEVELOPMENT.md
│   └── TROUBLESHOOTING.md
├── main.go              # Application entry
├── go.mod               # Module definition
└── data.json            # Results (generated)

Example Output

{
  "http_tests": [
    {
      "url": "https://www.google.com/",
      "status": "200 OK",
      "proto": "HTTP/2.0",
      "tls_version": "771",
      "response_length": 15678
    }
  ],
  "speed_tests": [
    {
      "url": "https://google.com",
      "download_mbps": 45.32,
      "elapsed_time": "2.345s",
      "bytes_received": 1048576
    }
  ],
  "vpn_test": {
    "status": "Not using VPN or proxy."
  },
  "ping_test": {
    "url": "www.google.com",
    "transmitted_packets": 5,
    "received_packets": 5,
    "loss_packets": 0
  },
  "timestamp": "2024-01-15T10:30:45Z"
}

Configuration

The application uses sensible defaults but can be customized:

cfg := config.New()
cfg.HTTPTimeout = 10 * time.Second
cfg.PingCount = 10
cfg.SpeedTestTimeout = 20 * time.Second

See Configuration Constants for all options.

Development

Build

go build -o ultimate-internet-test

Test

# All tests
go test ./...

# With coverage
go test -cover ./...

# With race detector
go test -race ./...

Add Tests

Tests are located in *_test.go files. See Development Guide for patterns and examples.

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/your-feature
  3. Make changes with tests
  4. Run: go test ./... && go build
  5. Commit with clear messages
  6. Push and create a Pull Request

Architecture Highlights

  • Modular Design: Independent test modules with clear interfaces
  • Type Safety: Strongly-typed result structures for all tests
  • Error Handling: Custom error hierarchy with proper context
  • Concurrency: Parallel execution using goroutines and sync.WaitGroup
  • Data Persistence: Mutex-protected JSON I/O for thread safety
  • Configuration: Centralized config with all magic numbers as constants

See Architecture Documentation for detailed information.

Troubleshooting

Common Issues

Ping:Permission Denied

# Linux: Use sudo
sudo go run .

# Or set capabilities
sudo setcap cap_net_raw=+ep ./ultimate-internet-test
./ultimate-internet-test

Network Timeouts

cfg := config.New()
cfg.HTTPTimeout = 15 * time.Second

VPN Detection Fails Use alternative IP detection service or check network connectivity.

See Troubleshooting Guide for more solutions.

Performance

  • Tests run in parallel for faster execution
  • Single atomic write to data.json per run
  • Configurable timeouts to prevent hanging
  • Minimal memory footprint with streaming I/O

Authors and Contact

Resources

About

This project provides comprehensive network diagnostics through parallel testing of HTTP connectivity, speed, VPN detection, and ping.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages